Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -11,7 +11,7 @@
|
||||
namespace IPS\core\modules\admin\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -22,6 +22,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _background extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -55,9 +60,11 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function process()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
$self = $this;
|
||||
$multiRedirect = new \IPS\Helpers\MultipleRedirect(
|
||||
\IPS\Http\Url::internal('app=core&module=system&controller=background&do=process'),
|
||||
\IPS\Http\Url::internal('app=core&module=system&controller=background&do=process')->csrf(),
|
||||
function( $data ) use ( $self )
|
||||
{
|
||||
/* Make sure the task is locked */
|
||||
@@ -66,11 +73,11 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
$task->next_run = time() + 900;
|
||||
$task->save();
|
||||
|
||||
if ( ! is_array( $data ) )
|
||||
if ( ! \is_array( $data ) )
|
||||
{
|
||||
$count = $self->getCount();
|
||||
|
||||
return array( array( 'count' => $count, 'done' => 0 ), 'Starting...' );
|
||||
return array( array( 'count' => $count, 'done' => 0 ), \IPS\Member::loggedIn()->language()->addToStack('background_process_starting') );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,9 +85,6 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/* Run the next queue task, if any */
|
||||
$queueData = \IPS\Task::runQueue();
|
||||
|
||||
/* Update count */
|
||||
$data['count'] = $self->getCount();
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
@@ -109,7 +113,7 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
if ( isset( $json['count'] ) )
|
||||
{
|
||||
/* If the offset is larger than the count, then we should just show the count instead (to avoid situations where it will display 150 / 139, for example) */
|
||||
$offset = intval( $queueData['offset'] );
|
||||
$offset = \intval( $queueData['offset'] );
|
||||
if ( $offset > $json['count'] )
|
||||
{
|
||||
$offset = $json['count'];
|
||||
@@ -150,9 +154,13 @@ class _background extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$data = json_decode( $row['data'], TRUE );
|
||||
|
||||
if ( isset( $data['count'] ) )
|
||||
if( isset( $data['realCount'] ) )
|
||||
{
|
||||
$count += intval( $data['count'] );
|
||||
$count += \intval( $data['realCount'] );
|
||||
}
|
||||
elseif ( isset( $data['count'] ) )
|
||||
{
|
||||
$count += \intval( $data['count'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user