Example #1
0
 /**
  * Add a cronjob to the crontab
  *
  * @access public
  * @param string    $m          minute
  * @param string    $h          hour
  * @param string    $dom        day of month
  * @param string    $mo         month
  * @param string    $dow        day of week
  * @param string    $className  name of class, which's execute() is called by croncall.php
  * @param string    $params     the parameter(s)
  * @return bool     true if success else PEAR error.
  */
 function addCronJob($m, $h, $dom, $mo, $dow, $className, $params)
 {
     if ($this->ctAccess == 'write') {
         $this->ct->addCron($m, $h, $dom, $mo, $dow, $this->getCommand($className, $params));
         return true;
     } else {
         return PEAR::raiseError('CronJob::addCronJob : ' . 'The crontab is not writable');
     }
 }
Example #2
0
    public function addCron($min = '*', $hour = '*', $dayOfMonth = '*', $month = '*', $dayOfWeek = '*', $cmd = '')
    {
        if (!in_array('exec', explode(', ', ini_get('disable_functions')))) {
            include_once dirname(__FILE__) . '/classes/Crontab.php';
            $cron = new Crontab(get_current_user());
            $cron->addCron($c_min, $c_hour, $dayOfMonth, $month, $dayOfWeek, $cmd);
            $cron->writeCrontab();
        } else {
            echo '<div class="alert alert-error"><strong>' . Translate('EXEC function is disabled') . '</strong>&nbsp;' . Translate('Creƫer handmatig de conjob') . '<br />
			Min: ' . $min . '<br />
			Hour: ' . $hour . '<br />
			Day of the month: ' . $dayOfMonth . '<br />
			Month: ' . $month . '<br />
			Day of the week: ' . $dayOfWeek . '<br />
			Command: ' . $cmd . '<br />
			</div>';
        }
    }