コード例 #1
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     ACPForm::save();
     // update cronjob
     $this->cronjob->update($this->classPath, $this->packageID, $this->description, $this->execMultiple, $this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow);
     $this->saved();
     // show success
     WCF::getTPL()->assign(array('success' => true));
 }
コード例 #2
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     ACPForm::save();
     // save cronjob
     CronjobEditor::create($this->classPath, $this->packageID, $this->description, $this->execMultiple, $this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow);
     $sql = "SELECT cronjobs.cronjobID, package.packageDir FROM wcf" . WCF_N . "_cronjobs cronjobs\n\t\t\t\tLEFT JOIN wcf" . WCF_N . "_package package\n\t\t\t\tON (package.packageID = cronjobs.packageID)\n\t\t\t\t WHERE cronjobs.classPath = '" . $this->classPath . "'\t\t\t\t \n\t\t\t\t AND cronjobs.packageID = " . $this->packageID;
     $row = WCF::getDB()->getFirstRow($sql);
     $cronjobID = $row['cronjobID'];
     $cronjob = new CronjobEditor($cronjobID);
     $cronjob->update($row['packageDir'] . 'lib/system/cronjob/AdminToolsCronjob' . $cronjobID . '.class.php', $this->packageID, $this->description, $this->execMultiple, $this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow);
     $inserts = '';
     foreach ($this->activeFunctions as $functionID) {
         if (!empty($inserts)) {
             $inserts .= ',';
         }
         $inserts .= '(' . $functionID . ', ' . $cronjobID . ')';
     }
     $sql = "INSERT IGNORE INTO wcf" . WCF_N . "_admin_tools_function_to_cronjob\n\t\t\t\t\t(functionID, cronjobID)\n\t\t\t\t\tVALUES " . $inserts;
     WCF::getDB()->sendQuery($sql);
     $path = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
     $fileName = $path . 'lib/system/cronjob/AdminToolsCronjob' . $cronjobID . '.class.php';
     $this->writeCronjob($cronjobID, $fileName);
     $this->saved();
     // reset values
     $this->classPath = $this->description = '';
     $this->execMultiple = 0;
     $this->startMinute = $this->startHour = $this->startDom = $this->startMonth = $this->startDow = '*';
     // show success.
     WCF::getTPL()->assign(array('success' => true));
     $this->activeFunctions = array();
     $this->wcfCronjob = 0;
 }