Index: admin_templates/agents/agent_edit.tpl
===================================================================
--- admin_templates/agents/agent_edit.tpl (revision 13986)
+++ admin_templates/agents/agent_edit.tpl (working copy)
@@ -83,6 +83,8 @@
+
+
Index: install/install_schema.sql
===================================================================
--- install/install_schema.sql (revision 13986)
+++ install/install_schema.sql (working copy)
@@ -664,26 +664,28 @@
);
CREATE TABLE Agents (
- AgentId int(11) NOT NULL auto_increment,
- AgentName varchar(255) NOT NULL default '',
- AgentType tinyint(3) unsigned NOT NULL default '1',
- Status tinyint(3) unsigned NOT NULL default '1',
- Event varchar(255) NOT NULL default '',
- RunInterval int(10) unsigned NOT NULL default '0',
- RunMode tinyint(3) unsigned NOT NULL default '2',
- LastRunOn int(10) unsigned default NULL,
- LastRunStatus tinyint(3) unsigned NOT NULL default '1',
- NextRunOn int(11) default NULL,
- RunTime int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (AgentId),
- KEY Status (Status),
+ AgentId int(11) NOT NULL AUTO_INCREMENT,
+ AgentName varchar(255) NOT NULL DEFAULT '',
+ AgentType tinyint(3) unsigned NOT NULL DEFAULT '1',
+ `Status` tinyint(3) unsigned NOT NULL DEFAULT '1',
+ `Event` varchar(255) NOT NULL DEFAULT '',
+ RunInterval int(10) unsigned NOT NULL DEFAULT '0',
+ RunMode tinyint(3) unsigned NOT NULL DEFAULT '2',
+ LastRunOn int(10) unsigned DEFAULT NULL,
+ LastRunStatus tinyint(3) unsigned NOT NULL DEFAULT '1',
+ NextRunOn int(11) DEFAULT NULL,
+ RunTime int(10) unsigned NOT NULL DEFAULT '0',
+ SiteDomainLimitation varchar(255) NOT NULL,
+ PRIMARY KEY (AgentId),
+ KEY `Status` (`Status`),
KEY RunInterval (RunInterval),
KEY RunMode (RunMode),
KEY AgentType (AgentType),
KEY LastRunOn (LastRunOn),
KEY LastRunStatus (LastRunStatus),
KEY RunTime (RunTime),
- KEY NextRunOn (NextRunOn)
+ KEY NextRunOn (NextRunOn),
+ KEY SiteDomainLimitation (SiteDomainLimitation)
);
CREATE TABLE SpellingDictionary (
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 13986)
+++ install/upgrades.sql (working copy)
@@ -1976,4 +1976,9 @@
ALTER TABLE Drafts CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL;
UPDATE Drafts SET CreatedById = NULL WHERE CreatedById = 0;
-ALTER TABLE ItemReview CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL;
\ No newline at end of file
+ALTER TABLE ItemReview CHANGE CreatedById CreatedById INT(11) NULL DEFAULT NULL;
+
+# ===== v 5.1.1-B2 =====
+ALTER TABLE Agents
+ ADD SiteDomainLimitation VARCHAR(255) NOT NULL,
+ ADD INDEX (SiteDomainLimitation);
\ No newline at end of file
Index: kernel/event_manager.php
===================================================================
--- kernel/event_manager.php (revision 13986)
+++ kernel/event_manager.php (working copy)
@@ -130,6 +130,7 @@
'LastRunOn' => (int)$agent_data['LastRunOn'],
'NextRunOn' => (int)$agent_data['NextRunOn'],
'Status' => $agent_data['Status'],
+ 'SiteDomainLimitation' => $agent_data['SiteDomainLimitation'],
);
}
}
@@ -751,7 +752,21 @@
$user_id = $this->Application->RecallVar('user_id');
$this->Application->StoreVar('user_id', USER_ROOT, true); // to prevent permission checking inside events, true for optional storage
+ $site_helper =& $this->Application->recallObject('SiteHelper');
+ /* @var $site_helper SiteHelper */
+
+ $site_domain_id = $site_helper->getDomainByName('DomainName', DOMAIN);
+
foreach ($events_source as $short_name => $event_data) {
+ if ( $site_domain_id && $event_data['SiteDomainLimitation'] != '' ) {
+ $site_domains = explode('|', substr($event_data['SiteDomainLimitation'], 1, -1));
+
+ if ( !in_array($site_domain_id, $site_domains) ) {
+ // agent isn't allowed on this site domain
+ continue;
+ }
+ }
+
$next_run = $event_data['NextRunOn'];
if ($next_run && ($next_run > adodb_mktime())) {
Index: units/agents/agents_config.php
===================================================================
--- units/agents/agents_config.php (revision 13986)
+++ units/agents/agents_config.php (working copy)
@@ -133,6 +133,11 @@
'NextRunOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'required' => 1, 'default' => '#NOW#'),
'RunTime' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'SiteDomainLimitation' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'SiteDomains ORDER BY DomainName ASC', 'option_key_field' => 'DomainId', 'option_title_field' => 'DomainName', 'multiple' => 1,
+ 'not_null' => 1, 'default' => ''
+ ),
),
'Grids' => Array (
@@ -152,6 +157,7 @@
'LastRunOn' => Array ('title' => 'la_col_LastRunOn', 'filter_block' => 'grid_date_range_filter', 'width' => 145, ),
'LastRunStatus' => Array ('title' => 'la_col_LastRunStatus', 'filter_block' => 'grid_options_filter', 'width' => 120, ),
'NextRunOn' => Array ('title' => 'la_col_NextRunOn', 'filter_block' => 'grid_date_range_filter', 'width' => 145, ),
+ 'SiteDomainLimitation' => Array ('title' => 'la_col_SiteDomainLimitation', 'data_block' => 'grid_picker_td', 'filter_block' => 'grid_options_filter', 'separator' => ', ', 'width' => 145),
),
),
),