function postInstall()
 {
     global $cache;
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     Debug::text('l: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     $cjlf = new CronJobListFactory();
     $cjlf->getAll();
     if ($cjlf->getRecordCount() > 0) {
         foreach ($cjlf as $cj_obj) {
             Debug::text('Original Command: ' . $cj_obj->getCommand(), __FILE__, __LINE__, __METHOD__, 9);
             $retval = preg_match('/([A-Za-z0-9]+\\.php)/i', $cj_obj->getCommand(), $matches);
             if (isset($matches[0]) and $matches[0] != '') {
                 Debug::text('New Command: ' . $matches[0], __FILE__, __LINE__, __METHOD__, 9);
                 $cj_obj->setCommand($matches[0]);
                 if ($cj_obj->isValid()) {
                     $cj_obj->Save();
                 }
             }
         }
     }
     return TRUE;
 }
Пример #2
0
 */
/*
 * Cron replica
 * Run this script every minute from the real cron.
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php';
if (isset($config_vars['other']['installer_enabled']) and $config_vars['other']['installer_enabled'] == TRUE) {
    Debug::text('CRON: Installer is enabled, skipping cron jobs for now...', __FILE__, __LINE__, __METHOD__, 0);
} else {
    //$current_epoch = strtotime('28-Mar-08 1:30 PM');
    $current_epoch = TTDate::getTime();
    $executed_jobs = 0;
    $cjlf = new CronJobListFactory();
    $job_arr = $cjlf->getArrayByListFactory($cjlf->getAll());
    $total_jobs = count($job_arr);
    foreach ($job_arr as $job_id => $job_name) {
        //Get each cronjob row again individually incase the status has changed.
        $cjlf = new CronJobListFactory();
        $cjlf->getById($job_id);
        //Let Execute determine if job is running or not so it can find orphans.
        if ($cjlf->getRecordCount() > 0) {
            foreach ($cjlf as $cjf_obj) {
                //Debug::text('Checking if Job ID: '. $job_id .' is scheduled to run...', __FILE__, __LINE__, __METHOD__, 0);
                if ($cjf_obj->isScheduledToRun($current_epoch) == TRUE) {
                    $executed_jobs++;
                    $cjf_obj->Execute($config_vars['path']['php_cli'], dirname(__FILE__));
                }
            }
        }