Skip to content

Commit

Permalink
matomo-org#6085 Removed $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED…
Browse files Browse the repository at this point in the history
…_TASKS'] and replaced it with DEBUG_FORCE_SCHEDULED_TASKS
  • Loading branch information
mnapoli committed Oct 12, 2014
1 parent fe73ae8 commit b6dcd8b
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions core/ScheduledTaskTimetable.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public function getScheduledTaskTime($taskName)
*/
public function shouldExecuteTask($taskName)
{
$forceTaskExecution =
(isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'])
|| DEBUG_FORCE_SCHEDULED_TASKS;
$forceTaskExecution = (defined('DEBUG_FORCE_SCHEDULED_TASKS') && DEBUG_FORCE_SCHEDULED_TASKS);

return $forceTaskExecution || ($this->taskHasBeenScheduledOnce($taskName) && time() >= $this->timetable[$taskName]);
}
Expand Down
2 changes: 1 addition & 1 deletion core/TaskScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Piwik\Plugin\Manager as PluginManager;

// When set to true, all scheduled tasks will be triggered in all requests (careful!)
define('DEBUG_FORCE_SCHEDULED_TASKS', false);
//define('DEBUG_FORCE_SCHEDULED_TASKS', true);

/**
* Manages scheduled task execution.
Expand Down
2 changes: 1 addition & 1 deletion core/Tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ protected static function runScheduledTasks()

$nextRunTime = $cache['lastTrackerCronRun'] + $minimumInterval;

if ((isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'])
if ((defined('DEBUG_FORCE_SCHEDULED_TASKS') && DEBUG_FORCE_SCHEDULED_TASKS)
|| $cache['lastTrackerCronRun'] === false
|| $nextRunTime < $now
) {
Expand Down
1 change: 0 additions & 1 deletion piwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// Note: if you wish to debug the Tracking API please see this documentation:
// http://developer.piwik.org/api-reference/tracking-api#debugging-the-tracker

$GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
define('PIWIK_ENABLE_TRACKING', true);

if (!defined('PIWIK_DOCUMENT_ROOT')) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreAdminHome/Commands/RunScheduledTasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private function forceRunAllTasksIfRequested(InputInterface $input)
$force = $input->getOption('force');

if ($force) {
$GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = true;
define('DEBUG_FORCE_SCHEDULED_TASKS', true);
}
}
}
1 change: 0 additions & 1 deletion tests/LocalTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Piwik\Tracker\Cache;

$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
$GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] = false;
if (!defined('PIWIK_ENABLE_TRACKING')) {
define('PIWIK_ENABLE_TRACKING', true);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Integration/ReleaseCheckListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testCheckThatConfigurationValuesAreProductionValues()
$this->_checkEqual(array('log' => 'logger_api_call'), null);

require_once PIWIK_INCLUDE_PATH . "/core/TaskScheduler.php";
$this->assertFalse(DEBUG_FORCE_SCHEDULED_TASKS);
$this->assertFalse(defined('DEBUG_FORCE_SCHEDULED_TASKS'));

// Check the index.php has "backtrace disabled"
$content = file_get_contents(PIWIK_INCLUDE_PATH . "/index.php");
Expand Down

0 comments on commit b6dcd8b

Please sign in to comment.