コード例 #1
0
 static function CheckCronForErrors()
 {
     global $zdbh;
     global $controller;
     $retval = FALSE;
     //Try to create the cron file if it doesnt exist...
     if (!file_exists(ctrl_options::GetSystemOption('cron_file'))) {
         fs_filehandler::UpdateFile(ctrl_options::GetSystemOption('cron_file'), 0644, "");
     }
     $currentuser = ctrl_users::GetUserDetail();
     // Check to make sure the cron is not blank before we go any further...
     if ($controller->GetControllerRequest('FORM', 'inScript') == '') {
         self::$blank = TRUE;
         $retval = TRUE;
     }
     // Check to make sure the cron script exists before we go any further...
     if (!is_file(fs_director::RemoveDoubleSlash(fs_director::ConvertSlashes(ctrl_options::GetSystemOption('hosted_dir') . $currentuser['username'] . '/public_html/' . $controller->GetControllerRequest('FORM', 'inScript'))))) {
         self::$noexists = TRUE;
         $retval = TRUE;
     }
     // Check to see if creating system cron file was successful...
     if (!is_file(ctrl_options::GetSystemOption('cron_file'))) {
         self::$cronnoexists = TRUE;
         $retval = TRUE;
     }
     // Check to makesystem cron file is writable...
     if (!is_writable(ctrl_options::GetSystemOption('cron_file'))) {
         self::$cronnowrite = TRUE;
         $retval = TRUE;
     }
     // Check to make sure the cron is not a duplicate...
     $sql = "SELECT COUNT(*) FROM x_cronjobs WHERE ct_acc_fk=:userid AND ct_script_vc=:inScript AND ct_deleted_ts IS NULL";
     $numrows = $zdbh->prepare($sql);
     $numrows->bindParam(':userid', $currentuser['userid']);
     $numrows->bindParam(':inScript', $controller->GetControllerRequest('FORM', 'inScript'));
     if ($numrows->execute()) {
         if ($numrows->fetchColumn() != 0) {
             self::$alreadyexists = TRUE;
             $retval = TRUE;
         }
     }
     return $retval;
 }