Ejemplo n.º 1
0
 public static function getPluginJobs($a_only_active = false)
 {
     global $ilPluginAdmin;
     $res = array();
     foreach ($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Cron", "crnhk") as $pl_name) {
         $plugin_obj = $ilPluginAdmin->getPluginObject(IL_COMP_SERVICE, "Cron", "crnhk", $pl_name);
         foreach ((array) $plugin_obj->getCronJobInstances() as $job) {
             $item = array_pop(ilCronManager::getCronJobData($job->getId()));
             if (!sizeof($item)) {
                 // as job is not "imported" from xml
                 ilCronManager::createDefaultEntry($job, $pl_name, IL_COMP_PLUGIN, "");
             }
             $item = array_pop(ilCronManager::getCronJobData($job->getId()));
         }
         if (!$a_only_active || $item["job_status"] == 1) {
             $res[$job->getId()] = array($job, $item);
         }
     }
     return $res;
 }
 /**
  * @return ilPropertyFormGUI
  */
 protected function getSettingsForm()
 {
     require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
     $form->setTitle($this->lng->txt('settings'));
     $frm_radio = new ilRadioGroupInputGUI($this->lng->txt('show_topics_overview'), 'forum_overview');
     $frm_radio->addOption(new ilRadioOption($this->lng->txt('new') . ', ' . $this->lng->txt('is_read') . ', ' . $this->lng->txt('unread'), '0'));
     $frm_radio->addOption(new ilRadioOption($this->lng->txt('is_read') . ', ' . $this->lng->txt('unread'), '1'));
     $frm_radio->setInfo($this->lng->txt('topics_overview_info'));
     $form->addItem($frm_radio);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_fora_statistics'), 'fora_statistics');
     $check->setInfo($this->lng->txt('enable_fora_statistics_desc'));
     $form->addItem($check);
     $check = new ilCheckboxInputGui($this->lng->txt('enable_anonymous_fora'), 'anonymous_fora');
     $check->setInfo($this->lng->txt('enable_anonymous_fora_desc'));
     $form->addItem($check);
     require_once 'Services/Cron/classes/class.ilCronManager.php';
     if (ilCronManager::isJobActive('frm_notification')) {
         require_once 'Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php';
         ilAdministrationSettingsFormHandler::addFieldsToForm(ilAdministrationSettingsFormHandler::FORM_FORUM, $form, $this);
     } else {
         $notifications = new ilCheckboxInputGui($this->lng->txt('cron_forum_notification'), 'forum_notification');
         $notifications->setInfo($this->lng->txt('cron_forum_notification_desc'));
         $notifications->setValue(1);
         $form->addItem($notifications);
     }
     require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
     $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_anonymous_short'), 'activate_captcha_anonym');
     $cap->setInfo($this->lng->txt('adm_captcha_anonymous_frm'));
     $cap->setValue(1);
     if (!ilCaptchaUtil::checkFreetype()) {
         $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage());
     }
     $form->addItem($cap);
     $form->addCommandButton('saveSettings', $this->lng->txt('save'));
     $form->addCommandButton('cancel', $this->lng->txt('cancel'));
     return $form;
 }
Ejemplo n.º 3
0
 protected function getItems()
 {
     global $ilPluginAdmin, $lng;
     include_once "Services/User/classes/class.ilUserUtil.php";
     include_once "Services/Cron/classes/class.ilCronJobResult.php";
     // systems
     $data = ilCronManager::getCronJobData();
     foreach ($data as $idx => $item) {
         $job = ilCronManager::getJobInstance($item["job_id"], $item["component"], $item["class"], $item["path"]);
         if ($job) {
             $data[$idx] = $this->parseJobToData($item, $job);
         }
     }
     // plugins
     $lng->loadLanguageModule("cmps");
     foreach (ilCronManager::getPluginJobs() as $item) {
         $job = $item[0];
         $item = $item[1];
         $item["job_id"] = "pl__" . $item["component"] . "__" . $job->getId();
         $item["component"] = $lng->txt("cmps_plugin") . "/" . $item["component"];
         $data[] = $this->parseJobToData($item, $job);
     }
     $this->setData($data);
 }
Ejemplo n.º 4
0
 public function addToExternalSettingsForm($a_form_id)
 {
     $fields = array();
     $data = ilCronManager::getCronJobData();
     foreach ($data as $item) {
         $job = ilCronManager::getJobInstance($item["job_id"], $item["component"], $item["class"], $item["path"]);
         if (method_exists($job, "addToExternalSettingsForm")) {
             $job->addToExternalSettingsForm($a_form_id, $fields, $item["job_status"]);
         }
     }
     if (sizeof($fields)) {
         return array("cron_jobs" => array("jumpToCronJobs", $fields));
     }
 }
Ejemplo n.º 5
0
<?php

chdir(dirname(__FILE__));
chdir('..');
include_once "Services/Context/classes/class.ilContext.php";
ilContext::init(ilContext::CONTEXT_CRON);
include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
ilAuthFactory::setContext(ilAuthFactory::CONTEXT_CRON);
$_COOKIE["ilClientId"] = $_SERVER['argv'][3];
$_POST['username'] = $_SERVER['argv'][1];
$_POST['password'] = $_SERVER['argv'][2];
if ($_SERVER['argc'] < 4) {
    die("Usage: cron.php username password client\n");
}
include_once './include/inc.header.php';
// Start checks here
include_once './cron/classes/class.ilCronCheck.php';
$cron_check = new ilCronCheck();
$cron_check->start();
include_once './Services/Cron/classes/class.ilCronManager.php';
ilCronManager::runActiveJobs();
 function linkChecker()
 {
     global $ilias, $ilUser, $tpl;
     $this->__initLinkChecker();
     $this->setTabs();
     $this->setContentSubTabs("link_check");
     require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
     $toolbar = new ilToolbarGUI();
     // #13684
     include_once "Services/Cron/classes/class.ilCronManager.php";
     if (ilCronManager::isJobActive("lm_link_check")) {
         include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
         include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
         $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
         $chb->setValue(1);
         $chb->setChecked((bool) ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
         $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
         $toolbar->addInputItem($chb);
         $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
         $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
     }
     $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
     $tgui->setLinkChecker($this->link_checker_obj)->setRowHandler($this)->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
     return $tpl->setContent($tgui->prepareHTML()->getHTML() . $toolbar->getHTML());
 }
 protected function calculateDeletionData($date_for_deletion)
 {
     $cron_timing = ilCronManager::getCronJobData($this->getId());
     $time_difference = 0;
     $multiplier = 1;
     if (!is_array($cron_timing) || !is_array($cron_timing[0])) {
         return time() + $date_for_deletion + $time_difference;
     }
     if (array_key_exists('schedule_type', $cron_timing[0])) {
         if (array_key_exists('schedule_type', $cron_timing[0]) && $cron_timing[0]['schedule_value'] != null) {
             $multiplier = $cron_timing[0]['schedule_value'];
         }
         $time_difference = $this->getTimeDifferenceBySchedule($cron_timing[0]['schedule_type'], $multiplier);
     }
     return time() + $date_for_deletion + $time_difference;
 }
Ejemplo n.º 8
0
 /**
  * End tag handler
  * 
  * @param object internal xml_parser_handler
  * @param string element tag name
  */
 function handlerEndTag($a_xml_parser, $a_name)
 {
     // call special reader
     if ($this->current_reader != "") {
         $this->readers[$this->current_reader]["reader"]->handlerEndTag($a_xml_parser, $a_name);
     } else {
         // cron
         if ($a_name == "module" || $a_name == "service") {
             include_once "Services/Cron/classes/class.ilCronManager.php";
             ilCronManager::clearFromXML($this->current_component, (array) $this->has_cron[$this->current_component]);
         }
     }
     // check if a special reader needs to be activated
     if (isset($this->readers[$a_name])) {
         $this->current_reader = null;
     }
 }