Index: core/kernel/application.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/application.php (revision 15940) +++ core/kernel/application.php (revision ) @@ -2143,12 +2143,13 @@ * @param string $short_name name to be used to store last maintenance run info * @param string $event_string * @param int $run_schedule run schedule like for Cron + * @param string $module * @param int $status * @access public */ - public function registerScheduledTask($short_name, $event_string, $run_schedule, $status = STATUS_ACTIVE) + public function registerScheduledTask($short_name, $event_string, $run_schedule, $module, $status = STATUS_ACTIVE) { - $this->EventManager->registerScheduledTask($short_name, $event_string, $run_schedule, $status); + $this->EventManager->registerScheduledTask($short_name, $event_string, $run_schedule, $module, $status); } /** Index: core/install/upgrades.sql IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/upgrades.sql (revision 15940) +++ core/install/upgrades.sql (revision ) @@ -2941,6 +2941,9 @@ INSERT INTO SystemSettings VALUES(DEFAULT, 'ForceCanonicalUrls', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_ForceCanonicalUrls', 'checkbox', '', '', 10.0125, 0, 0, NULL); +ALTER TABLE ScheduledTasks ADD Module varchar(30) NOT NULL DEFAULT 'Core'; + + UPDATE LanguageLabels SET l1_HintTranslation = '' WHERE Phrase = 'la_title_SystemToolsDeploy'; Index: core/kernel/managers/scheduled_task_manager.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/managers/scheduled_task_manager.php (revision 15940) +++ core/kernel/managers/scheduled_task_manager.php (revision ) @@ -81,13 +81,14 @@ * @param string $short_name name to be used to store last maintenance run info * @param string $event_string * @param int $run_schedule run schedule like for Cron + * @param string $module * @param int $status * @access public */ - public function add($short_name, $event_string, $run_schedule, $status = STATUS_ACTIVE) + public function add($short_name, $event_string, $run_schedule, $module, $status = STATUS_ACTIVE) { $this->tasks[$short_name] = Array ( - 'Event' => $event_string, 'RunSchedule' => $run_schedule, 'Status' => $status + 'Event' => $event_string, 'RunSchedule' => $run_schedule, 'Status' => $status, 'Module' => $module ); } \ No newline at end of file Index: core/install/upgrades.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/upgrades.php (revision 15940) +++ core/install/upgrades.php (revision ) @@ -2358,15 +2358,29 @@ */ public function Upgrade_5_3_0_B1($mode) { - if ( $mode != 'before' ) { - return; - } - + if ($mode == 'before') { - $ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); - /* @var $ml_helper kMultiLanguageHelper */ + $ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ - // add new ml columns to phrases/e-mail events - $ml_helper->createFields('phrases'); - $ml_helper->createFields('emailevents'); + // add new ml columns to phrases/e-mail events + $ml_helper->createFields('phrases'); + $ml_helper->createFields('emailevents'); + } + + if ($mode == 'after') { + $sql = 'SELECT Event, ScheduledTaskId + FROM ' . TABLE_PREFIX . 'ScheduledTasks'; + $scheduled_tasks = $this->Conn->GetCol($sql, 'ScheduledTaskId'); + + foreach ($scheduled_tasks as $id => $event) { + $event = new kEvent($event); + $config = $event->getUnitConfig(); + $module = $config->getModule(); + $sql = 'UPDATE ' . TABLE_PREFIX . 'ScheduledTasks + SET Module = ' . $this->Conn->qstr($module == 'In-Portal' ? 'Core' : $module) . ' + WHERE ScheduledTaskId = ' . $id; + $this->Conn->Query($sql); + } + } } } \ No newline at end of file Index: core/units/scheduled_tasks/scheduled_task_eh.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/units/scheduled_tasks/scheduled_task_eh.php (revision 15940) +++ core/units/scheduled_tasks/scheduled_task_eh.php (revision ) @@ -87,6 +87,7 @@ 'Event' => $scheduled_task_params['Event'], 'Name' => $scheduled_task_name, 'Type' => ScheduledTask::TYPE_SYSTEM, + 'Module' => $scheduled_task_params['Module'], 'Status' => isset($scheduled_task_params['Status']) ? $scheduled_task_params['Status'] : STATUS_ACTIVE, 'RunSchedule' => $scheduled_task_params['RunSchedule'], ); @@ -287,6 +288,14 @@ protected function OnAfterConfigRead(kEvent $event) { parent::OnAfterConfigRead($event); + + if ( $this->Application->findModule('Name', 'Custom') ) { + $config = $event->getUnitConfig(); + + $fields = $config->getFields(); + $fields['Module']['default'] = 'Custom'; + $config->setFields($fields); + } $cron_helper = $this->Application->recallObject('kCronHelper'); /* @var $cron_helper kCronHelper */ \ No newline at end of file Index: core/kernel/event_manager.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/event_manager.php (revision 15940) +++ core/kernel/event_manager.php (revision ) @@ -119,12 +119,13 @@ * @param string $short_name name to be used to store last maintenance run info * @param string $event_string * @param int $run_schedule run schedule like for Cron + * @param string $module * @param int $status * @access public */ - public function registerScheduledTask($short_name, $event_string, $run_schedule, $status = STATUS_ACTIVE) + public function registerScheduledTask($short_name, $event_string, $run_schedule, $module, $status = STATUS_ACTIVE) { - $this->ScheduledTasks->add($short_name, $event_string, $run_schedule, $status); + $this->ScheduledTasks->add($short_name, $event_string, $run_schedule, $module, $status); } /** \ No newline at end of file Index: core/admin_templates/scheduled_tasks/scheduled_task_edit.tpl IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/admin_templates/scheduled_tasks/scheduled_task_edit.tpl (revision 15940) +++ core/admin_templates/scheduled_tasks/scheduled_task_edit.tpl (revision ) @@ -69,11 +69,13 @@ + + \ No newline at end of file Index: core/kernel/utility/unit_config.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/utility/unit_config.php (revision 15940) +++ core/kernel/utility/unit_config.php (revision ) @@ -1141,8 +1141,29 @@ foreach ($scheduled_tasks as $short_name => $scheduled_task_info) { $event_status = array_key_exists('Status', $scheduled_task_info) ? $scheduled_task_info['Status'] : STATUS_ACTIVE; - $this->Application->delayUnitProcessing('registerScheduledTask', Array ($short_name, $this->_prefix . ':' . $scheduled_task_info['EventName'], $scheduled_task_info['RunSchedule'], $event_status)); + $this->Application->delayUnitProcessing('registerScheduledTask', Array ($short_name, $this->_prefix . ':' . $scheduled_task_info['EventName'], $scheduled_task_info['RunSchedule'], $this->getModule(), $event_status)); } + } + + /** + * Determines module by unit path + * + * @return string + * @access public + */ + public function getModule() + { + $ret = ''; + $module_path = $this->getModuleFolder() . '/'; + + foreach ($this->Application->ModuleInfo AS $module_name => $module_data) { + if ( $module_data['Path'] == $module_path ) { + $ret = $module_name; + break; + } + } + + return $ret; } protected function _parseHooks() Index: core/units/scheduled_tasks/scheduled_tasks_config.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/units/scheduled_tasks/scheduled_tasks_config.php (revision 15940) +++ core/units/scheduled_tasks/scheduled_tasks_config.php (revision ) @@ -145,7 +145,12 @@ 'not_null' => 1, 'default' => '' ), 'Settings' => Array ('type' => 'string', 'default' => NULL), + 'Module' => Array ( + 'type' => 'string', + 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Modules WHERE (Loaded = 1) AND (Name <> "In-Portal") ORDER BY LoadOrder', 'option_key_field' => 'Name', 'option_title_field' => 'Name', + 'not_null' => 1, 'required' => 1, 'default' => 'Core' - ), + ), + ), 'Grids' => Array ( 'Default' => Array ( @@ -167,6 +172,7 @@ 'Timeout' => Array ('filter_block' => 'grid_range_filter', 'width' => 85), 'LastTimeoutOn' => Array ('filter_block' => 'grid_date_range_filter', 'width' => 145), 'SiteDomainLimitation' => Array ('data_block' => 'grid_picker_td', 'filter_block' => 'grid_multioptions_filter', 'separator' => ', ', 'width' => 145), + 'Module' => Array ('filter_block' => 'grid_options_filter', 'width' => 65), ), ), ), \ No newline at end of file Index: core/install/install_schema.sql IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/install/install_schema.sql (revision 15940) +++ core/install/install_schema.sql (revision ) @@ -780,6 +780,7 @@ LastTimeoutOn int(10) unsigned DEFAULT NULL, SiteDomainLimitation varchar(255) NOT NULL DEFAULT '', Settings text, + Module varchar(30) NOT NULL DEFAULT 'Core', PRIMARY KEY (ScheduledTaskId), KEY `Status` (`Status`), KEY LastRunOn (LastRunOn), \ No newline at end of file