WCF.Dropdown.init();
{event name='javascriptInit'}
+
+ {if $executeCronjobs}
+ new WCF.Action.Proxy({
+ autoSend: true,
+ data: {
+ className: 'wcf\\data\\cronjob\\CronjobAction',
+ actionName: 'executeCronjobs'
+ },
+ showLoadingOverlay: false,
+ failure: function() {
+ return false;
+ }
+ });
+ {/if}
});
//]]>
</script>
namespace wcf\data\cronjob;
use wcf\data\cronjob\log\CronjobLogEditor;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\system\cronjob\CronjobScheduler;
use wcf\system\exception\ValidateActionException;
use wcf\system\WCF;
use wcf\util\DateUtil;
*/
protected $permissionsUpdate = array('admin.system.cronjob.canEditCronjob');
+ /**
+ * @see wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess
+ */
+ protected $allowGuestAccess = array('executeCronjobs');
+
/**
* Validates permissions and parameters
*/
return $return;
}
+
+ /**
+ * Validates permissions and parameters
+ */
+ public function validateExecuteCronjobs() {}
+
+ /**
+ * Executes open cronjobs.
+ */
+ public function executeCronjobs() {
+ CronjobScheduler::getInstance()->executeCronjobs();
+ }
}
<?php
namespace wcf\system;
-use wcf\util\StringStack;
-
use wcf\data\application\Application;
use wcf\data\package\Package;
use wcf\data\package\PackageCache;
use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
+use wcf\system\cronjob\CronjobScheduler;
use wcf\system\database\statement\PreparedStatement;
use wcf\system\language\LanguageFactory;
use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\template\TemplateEngine;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\exception;
+use wcf\util\StringStack;
use wcf\util;
// try to disable execution time limit
$this->initSession();
$this->initLanguage();
$this->initTPL();
+ $this->initCronjobs();
$this->initBlacklist();
$this->initCoreObjects();
$this->initApplications();
return $baseHref . 'index.php' . $path . '#' . $fragment;
}
+
+ /**
+ * Initialises the cronjobs.
+ */
+ protected function initCronjobs() {
+ if (defined('PACKAGE_ID')) {
+ self::getTPL()->assign('executeCronjobs', CronjobScheduler::getInstance()->getNextExec() < TIME_NOW);
+ }
+ }
}