Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -13,6 +13,12 @@
|
||||
// e.g: /usr/bin/php /path/to/site/applications/core/interface/task/task.php abc1234 6
|
||||
// would execute task with ID 6
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Log;
|
||||
use IPS\Settings;
|
||||
use IPS\Task;
|
||||
use const IPS\CIC;
|
||||
|
||||
@header( "Cache-Control: no-cache, no-store, must-revalidate, max-age=0, s-maxage=0" );
|
||||
@header( "Expires: 0" );
|
||||
|
||||
@@ -24,8 +30,8 @@ if ( !isset( $_SERVER['argv'] ) )
|
||||
}
|
||||
|
||||
/* Init Invision Community */
|
||||
\define('READ_WRITE_SEPARATION', FALSE);
|
||||
\define('REPORT_EXCEPTIONS', TRUE);
|
||||
define('READ_WRITE_SEPARATION', FALSE);
|
||||
define('REPORT_EXCEPTIONS', TRUE);
|
||||
|
||||
$path = str_replace( 'interface/task/task.php', 'data/requirements.json', str_replace( '\\', '/', __FILE__ ) );
|
||||
|
||||
@@ -42,7 +48,7 @@ if( version_compare($phpVersion, $requirements['php']['required'] ) < 0 )
|
||||
|
||||
require_once str_replace( 'applications/core/interface/task/task.php', 'init.php', str_replace( '\\', '/', __FILE__ ) );
|
||||
|
||||
if ( !\IPS\CIC and $_SERVER['argv'][1] !== \IPS\Settings::i()->task_cron_key )
|
||||
if ( !CIC and $_SERVER['argv'][1] !== Settings::i()->task_cron_key )
|
||||
{
|
||||
echo "Incorrect key\n";
|
||||
exit;
|
||||
@@ -52,30 +58,30 @@ if ( !\IPS\CIC and $_SERVER['argv'][1] !== \IPS\Settings::i()->task_cron_key )
|
||||
try
|
||||
{
|
||||
/* Ensure applications set up correctly before task is executed. Pages, for example, needs to set up spl autoloaders first */
|
||||
\IPS\Application::applications();
|
||||
Application::applications();
|
||||
|
||||
if( isset( $_SERVER['argv'][2] ) )
|
||||
{
|
||||
$task = \IPS\Task::load( $_SERVER['argv'][2], ( \is_numeric( $_SERVER['argv'][2] ) ) ? NULL : 'key' );
|
||||
$task = Task::load( $_SERVER['argv'][2], ( is_numeric( $_SERVER['argv'][2] ) ) ? NULL : 'key' );
|
||||
|
||||
if ( !$task )
|
||||
{
|
||||
throw new \OutOfRangeException( 'NO_TASK' );
|
||||
throw new OutOfRangeException( 'NO_TASK' );
|
||||
}
|
||||
|
||||
$task->runAndLog();
|
||||
}
|
||||
else
|
||||
{
|
||||
while( $task = \IPS\Task::queued() )
|
||||
while( $task = Task::queued() )
|
||||
{
|
||||
$task->runAndLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
catch (Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'uncaught_exception' );
|
||||
Log::log( $e, 'uncaught_exception' );
|
||||
|
||||
echo "Exception:\n";
|
||||
print_r( $e );
|
||||
|
||||
Reference in new issue
Block a user