Index: branches/5.2.x/core/kernel/managers/scheduled_task_manager.php =================================================================== diff -u -N -r15433 -r15456 --- branches/5.2.x/core/kernel/managers/scheduled_task_manager.php (.../scheduled_task_manager.php) (revision 15433) +++ branches/5.2.x/core/kernel/managers/scheduled_task_manager.php (.../scheduled_task_manager.php) (revision 15456) @@ -1,6 +1,6 @@ Application->ConfigValue('RunScheduledTasksFromCron') ) { - // if scheduled tasks are set to run from cron + $use_cron = $this->Application->ConfigValue('RunScheduledTasksFromCron'); + + if ( ($use_cron && !$from_cron) || (!$use_cron && $from_cron) ) { + // match execution place with one, set in config return ; } Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r15445 -r15456 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 15445) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 15456) @@ -1,6 +1,6 @@ isDebugMode(); - if ( $debug_mode && kUtil::constOn('DBG_PROFILE_MEMORY') ) { - $this->Debugger->appendMemoryUsage('Application before Done:'); - } - if ( $debug_mode ) { - $this->EventManager->runScheduledTasks(); - $this->Session->SaveData(); + if ( kUtil::constOn('DBG_PROFILE_MEMORY') ) { + $this->Debugger->appendMemoryUsage('Application before Done:'); + } + $this->Session->SaveData(); // adds session data to debugger report $this->HTML = ob_get_clean() . $this->HTML . $this->Debugger->printReport(true); } else { // send "Set-Cookie" header before any output is made $this->Session->SetSession(); - $this->HTML = ob_get_clean() . $this->HTML; } + $this->_outputPage(); + $this->cacheManager->UpdateApplicationCache(); + + if ( !$debug_mode ) { + $this->Session->SaveData(); + } + + $this->EventManager->runScheduledTasks(); + + if ( defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !$this->isAdmin ) { + $this->_storeStatistics(); + } + } + + /** + * Outputs generated page content to end-user + * + * @return void + * @access protected + */ + protected function _outputPage() + { $this->setContentType(); if ( $this->UseOutputCompression() ) { @@ -1197,17 +1216,7 @@ echo $this->HTML; } - $this->cacheManager->UpdateApplicationCache(); flush(); - - if ( !$debug_mode ) { - $this->EventManager->runScheduledTasks(); - $this->Session->SaveData(); - } - - if ( defined('DBG_CAPTURE_STATISTICS') && DBG_CAPTURE_STATISTICS && !$this->isAdmin ) { - $this->_storeStatistics(); - } } /** Index: branches/5.2.x/tools/cron.php =================================================================== diff -u -N -r15344 -r15456 --- branches/5.2.x/tools/cron.php (.../cron.php) (revision 15344) +++ branches/5.2.x/tools/cron.php (.../cron.php) (revision 15456) @@ -1,6 +1,6 @@ EventManager->runScheduledTasks(true); -$application->Done(); - $end = microtime(true); \ No newline at end of file