Changeset View
Changeset View
Standalone View
Standalone View
in-portal
Show All 14 Lines | |||||
if ( PHP_SAPI !== 'cli' ) { | if ( PHP_SAPI !== 'cli' ) { | ||||
echo 'This script is intended to be used from command-line only !'; | echo 'This script is intended to be used from command-line only !'; | ||||
exit(64); | exit(64); | ||||
} | } | ||||
$start = microtime(true); | $start = microtime(true); | ||||
define('CRON', 1); | define('CRON', 1); // Means 'used in CLI' (name kept for BC reasons). | ||||
define('INDEX_FILE', 'index.php'); | define('INDEX_FILE', 'index.php'); | ||||
define('DBG_SKIP_REPORTING', 1); | define('DBG_SKIP_REPORTING', 1); | ||||
$_SERVER['REQUEST_URI'] = 'CRON'; | $_SERVER['REQUEST_URI'] = 'CRON'; | ||||
$_SERVER['HTTP_USER_AGENT'] = 'gecko'; | $_SERVER['HTTP_USER_AGENT'] = 'gecko'; | ||||
define('FULL_PATH', realpath(dirname(__FILE__))); | define('FULL_PATH', realpath(dirname(__FILE__))); | ||||
include_once(FULL_PATH . '/core/kernel/startup.php'); | include_once(FULL_PATH . '/core/kernel/startup.php'); | ||||
$application =& kApplication::Instance(); | $application =& kApplication::Instance(); | ||||
$application->Init(); | $application->Init(); | ||||
$application->Run(); | |||||
// Assume user with all privileges, because nobody is doing authentication from CLI. | |||||
$application->StoreVar('user_id', USER_ROOT, true); | |||||
$application->getConsoleApplication()->run(); | |||||
$application->Done(); | $application->Done(); | ||||
$end = microtime(true); | $end = microtime(true); |