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
@@ -9,33 +9,41 @@
|
||||
*/
|
||||
|
||||
/* Init Invision Community */
|
||||
\define('REPORT_EXCEPTIONS', TRUE);
|
||||
\define('READ_WRITE_SEPARATION', FALSE);
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Log;
|
||||
use IPS\Login;
|
||||
use IPS\Request;
|
||||
use IPS\Settings;
|
||||
use IPS\Task;
|
||||
|
||||
define('REPORT_EXCEPTIONS', TRUE);
|
||||
define('READ_WRITE_SEPARATION', FALSE);
|
||||
require_once str_replace( 'applications/core/interface/task/web.php', 'init.php', str_replace( '\\', '/', __FILE__ ) );
|
||||
|
||||
@header( "Cache-Control: no-cache, no-store, must-revalidate, max-age=0, s-maxage=0" );
|
||||
@header( "Expires: 0" );
|
||||
|
||||
/* Set HTTP status */
|
||||
$http = ( isset( $_SERVER['SERVER_PROTOCOL'] ) and \strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) !== false ) ? '1.0' : '1.1';
|
||||
$http = ( isset( $_SERVER['SERVER_PROTOCOL'] ) and strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) !== false ) ? '1.0' : '1.1';
|
||||
|
||||
/* Execute */
|
||||
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( \IPS\Settings::i()->task_use_cron != 'web' )
|
||||
if( Settings::i()->task_use_cron != 'web' )
|
||||
{
|
||||
throw new \OutOfRangeException( "Invalid Task Method" );
|
||||
throw new OutOfRangeException( "Invalid Task Method" );
|
||||
}
|
||||
|
||||
if( !\IPS\Login::compareHashes( (string) \IPS\Settings::i()->task_cron_key, (string) \IPS\Request::i()->key ) )
|
||||
if( !Login::compareHashes( (string) Settings::i()->task_cron_key, (string) Request::i()->key ) )
|
||||
{
|
||||
throw new \OutOfRangeException( "Invalid Key" );
|
||||
throw new OutOfRangeException( "Invalid Key" );
|
||||
}
|
||||
|
||||
$task = \IPS\Task::queued();
|
||||
$task = Task::queued();
|
||||
|
||||
if ( $task )
|
||||
{
|
||||
@@ -45,17 +53,17 @@ try
|
||||
@header( "HTTP/{$http} 200 OK" );
|
||||
print "Task Ran";
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch (OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Log::debug( $e, $e->getMessage() );
|
||||
Log::debug( $e, $e->getMessage() );
|
||||
|
||||
@header( "HTTP/{$http} 500 Internal Server Error" );
|
||||
echo "Exception:\n";
|
||||
print $e->getMessage();
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
catch (Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'uncaught_exception' );
|
||||
Log::log( $e, 'uncaught_exception' );
|
||||
|
||||
@header( "HTTP/{$http} 500 Internal Server Error" );
|
||||
echo "Exception:\n";
|
||||
|
||||
Reference in new issue
Block a user