コード例 #1
0
 /**
  * Create a task
  * Parameters must be passed as an associative array => array('param1' => 'value1')
  */
 function createTask($sTask, $sScript, $aParams, $sFreq, $iStartTime = NULL)
 {
     // Path to scripts
     $ktPath = '/var/tasks/';
     $path = KT_DIR . $ktPath;
     if (!is_dir($path)) {
         mkdir($path, '0755');
     }
     // Create script file
     $sName = str_replace(' ', '_', $sTask);
     $sName = str_replace('', "'", $sName);
     $sName = str_replace('', "&", $sName);
     $sFileName = $sName . '_' . mt_rand(1, 999) . '.php';
     while (file_exists($path . $sFileName)) {
         $sFileName = $sTask . '_' . mt_rand(1, 9999) . '.php';
     }
     $fp = fopen($path . $sFileName, 'w');
     fwrite($fp, $sScript);
     fclose($fp);
     // Register task in the schedule
     schedulerUtil::registerTask($sTask, $ktPath . $sFileName, $sParams, $sFreq, $iStartTime);
 }
コード例 #2
0
ファイル: scheduler.php プロジェクト: 5haman/knowledgetree
 /**
  * Register the task in the scheduler
  */
 function registerTask()
 {
     schedulerUtil::registerTask($this->sName, $this->sPath, $this->aParams, $this->sFreq, $this->iStartTime, $this->sStatus);
 }