HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //var/www/innodrive/cron/sync.php
<?php

define('CRON_ROOT', __DIR__ . '/');
define('SHORTINIT', true);
define( 'BASE_PATH', realpath(CRON_ROOT . '../public/') . '/' );


if( php_sapi_name() !== 'cli' ) {
    die("Meant to be run from command line");
}

if (!empty($argv[1])) {
    define('APPLICATION_ENV', $argv[1]);
} else {
    define('APPLICATION_ENV', 'production');
}

define('WP_USE_THEMES', false);
global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header, $wpdb, $phpmailer;
require(BASE_PATH . 'wp-load.php');
require(CRON_ROOT . 'wp-mock.php');
require(BASE_PATH . 'wp-includes/post.php');
require(CRON_ROOT . 'wp-mailer.php');
require(BASE_PATH . 'wp-content/plugins/smtp-mailer/main.php');
require(BASE_PATH . 'wp-content/plugins/e-mailer/e-mailer.php');
require(BASE_PATH . 'wp-content/plugins/import/import.php');
require(BASE_PATH . 'api/v1/class/Job.php');
require(BASE_PATH . 'api/v1/class/Reminder.php');
require(BASE_PATH . 'wp-content/plugins/import/class/Stock.php');

if (APPLICATION_ENV == 'production') {
    $running = exec( "ps aux|grep " . basename( __FILE__ ) . "|grep -v grep|grep -v '/bin/sh'|wc -l" );
    if ( $running > 1 ) {
        Output::log( 'Another instance running. Exit!' );
        exit;
    }
}

$jobs = $wpdb->get_results('SELECT * FROM sync WHERE status = 0 ORDER BY id ASC');

if (!empty($jobs)) {
    foreach($jobs as $job) {
        echo 'Job id: ' . $job->id . PHP_EOL;
        Job::run( $job );
        echo PHP_EOL;
    }
} else {
    echo 'No job' . PHP_EOL . PHP_EOL;
}