Index: branches/5.3.x/core/kernel/event_manager.php
===================================================================
diff -u -r15698 -r15945
--- branches/5.3.x/core/kernel/event_manager.php (.../event_manager.php) (revision 15698)
+++ branches/5.3.x/core/kernel/event_manager.php (.../event_manager.php) (revision 15945)
@@ -1,6 +1,6 @@
ScheduledTasks->add($short_name, $event_string, $run_schedule, $status);
+ $this->ScheduledTasks->add($short_name, $event_string, $run_schedule, $module, $status);
}
/**
Index: branches/5.3.x/core/units/scheduled_tasks/scheduled_tasks_config.php
===================================================================
diff -u -r15677 -r15945
--- branches/5.3.x/core/units/scheduled_tasks/scheduled_tasks_config.php (.../scheduled_tasks_config.php) (revision 15677)
+++ branches/5.3.x/core/units/scheduled_tasks/scheduled_tasks_config.php (.../scheduled_tasks_config.php) (revision 15945)
@@ -1,6 +1,6 @@
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 (
@@ -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),
),
),
),
Index: branches/5.3.x/core/units/scheduled_tasks/scheduled_task_eh.php
===================================================================
diff -u -r15810 -r15945
--- branches/5.3.x/core/units/scheduled_tasks/scheduled_task_eh.php (.../scheduled_task_eh.php) (revision 15810)
+++ branches/5.3.x/core/units/scheduled_tasks/scheduled_task_eh.php (.../scheduled_task_eh.php) (revision 15945)
@@ -1,6 +1,6 @@
$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'],
);
@@ -288,6 +289,14 @@
{
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 */
Index: branches/5.3.x/core/kernel/utility/unit_config.php
===================================================================
diff -u -r15919 -r15945
--- branches/5.3.x/core/kernel/utility/unit_config.php (.../unit_config.php) (revision 15919)
+++ branches/5.3.x/core/kernel/utility/unit_config.php (.../unit_config.php) (revision 15945)
@@ -1141,10 +1141,32 @@
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));
}
}
+ /**
+ * Detects module by unit location.
+ *
+ * @return string
+ */
+ public function getModule()
+ {
+ $module_path = $this->getModuleFolder() . '/';
+
+ foreach ( $this->Application->ModuleInfo as $module_name => $module_data ) {
+ if ( $module_name == 'In-Portal' ) {
+ continue;
+ }
+
+ if ( $module_data['Path'] == $module_path ) {
+ return $module_name;
+ }
+ }
+
+ return '';
+ }
+
protected function _parseHooks()
{
$hooks = $this->getHooks();
Index: branches/5.3.x/core/install/upgrades.php
===================================================================
diff -u -r15928 -r15945
--- branches/5.3.x/core/install/upgrades.php (.../upgrades.php) (revision 15928)
+++ branches/5.3.x/core/install/upgrades.php (.../upgrades.php) (revision 15945)
@@ -1,6 +1,6 @@
Application->recallObject('kMultiLanguageHelper');
+ /* @var $ml_helper kMultiLanguageHelper */
+
+ // add new ml columns to phrases/e-mail events
+ $ml_helper->createFields('phrases');
+ $ml_helper->createFields('emailevents');
}
+ elseif ( $mode == 'after' ) {
+ $sql = 'SELECT Event, ScheduledTaskId
+ FROM ' . TABLE_PREFIX . 'ScheduledTasks';
+ $scheduled_tasks = $this->Conn->GetCol($sql, 'ScheduledTaskId');
- $ml_helper = $this->Application->recallObject('kMultiLanguageHelper');
- /* @var $ml_helper kMultiLanguageHelper */
+ foreach ( $scheduled_tasks as $id => $event_string ) {
+ $event = new kEvent($event_string);
+ $module = $event->getUnitConfig()->getModule();
- // add new ml columns to phrases/e-mail events
- $ml_helper->createFields('phrases');
- $ml_helper->createFields('emailevents');
+ $this->Conn->doUpdate(
+ array('Module' => $module),
+ TABLE_PREFIX . 'ScheduledTasks',
+ 'ScheduledTaskId = ' . $id
+ );
+ }
+ }
}
}
\ No newline at end of file
Index: branches/5.3.x/core/kernel/managers/scheduled_task_manager.php
===================================================================
diff -u -r15928 -r15945
--- branches/5.3.x/core/kernel/managers/scheduled_task_manager.php (.../scheduled_task_manager.php) (revision 15928)
+++ branches/5.3.x/core/kernel/managers/scheduled_task_manager.php (.../scheduled_task_manager.php) (revision 15945)
@@ -1,6 +1,6 @@
tasks[$short_name] = Array (
- 'Event' => $event_string, 'RunSchedule' => $run_schedule, 'Status' => $status
+ 'Event' => $event_string, 'RunSchedule' => $run_schedule, 'Module' => $module, 'Status' => $status
);
}
Index: branches/5.3.x/core/kernel/application.php
===================================================================
diff -u -r15928 -r15945
--- branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15928)
+++ branches/5.3.x/core/kernel/application.php (.../application.php) (revision 15945)
@@ -1,6 +1,6 @@
EventManager->registerScheduledTask($short_name, $event_string, $run_schedule, $status);
+ $this->EventManager->registerScheduledTask($short_name, $event_string, $run_schedule, $module, $status);
}
/**
Index: branches/5.3.x/core/install/install_schema.sql
===================================================================
diff -u -r15944 -r15945
--- branches/5.3.x/core/install/install_schema.sql (.../install_schema.sql) (revision 15944)
+++ branches/5.3.x/core/install/install_schema.sql (.../install_schema.sql) (revision 15945)
@@ -782,6 +782,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),
Index: branches/5.3.x/core/install/upgrades.sql
===================================================================
diff -u -r15944 -r15945
--- branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15944)
+++ branches/5.3.x/core/install/upgrades.sql (.../upgrades.sql) (revision 15945)
@@ -2959,3 +2959,5 @@
ALTER TABLE EmailLog
ADD Status TINYINT NOT NULL DEFAULT '1' AFTER TextBody,
ADD ErrorMessage VARCHAR(255) NOT NULL DEFAULT '' AFTER Status;
+
+ALTER TABLE ScheduledTasks ADD Module varchar(30) NOT NULL DEFAULT 'Core';
Index: branches/5.3.x/core/admin_templates/scheduled_tasks/scheduled_task_edit.tpl
===================================================================
diff -u -r15690 -r15945
--- branches/5.3.x/core/admin_templates/scheduled_tasks/scheduled_task_edit.tpl (.../scheduled_task_edit.tpl) (revision 15690)
+++ branches/5.3.x/core/admin_templates/scheduled_tasks/scheduled_task_edit.tpl (.../scheduled_task_edit.tpl) (revision 15945)
@@ -69,11 +69,13 @@
+
+