Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Fix installation and update SQL scripts #49

Merged
merged 2 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,58 @@
--

CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`asset_id` int NOT NULL UNIQUE DEFAULT '0',
`title` varchar(255) NOT NULL DEFAULT '',
`type` varchar(128) NOT NULL COMMENT 'unique identifier for job defined by plugin',
`execution_rules` text COMMENT 'Execution Rules, Unprocessed',
`cron_rules` text COMMENT 'Processed execution rules, crontab-like JSON form',
`state` tinyint NOT NULL DEFAULT FALSE,
`last_exit_code` int NOT NULL DEFAULT '0' COMMENT 'Exit code when job was last run',
`last_execution` datetime COMMENT 'Timestamp of last run',
`next_execution` datetime COMMENT 'Timestamp of next (planned) run, referred for execution on trigger',
`times_executed` int DEFAULT '0' COMMENT 'Count of successful triggers',
`times_failed` int DEFAULT '0' COMMENT 'Count of failures',
`locked` datetime,
`priority` smallint NOT NULL DEFAULT '0',
`ordering` int NOT NULL DEFAULT 0 COMMENT 'Configurable list ordering',
`params` text NOT NULL,
`note` text,
`created` datetime NOT NULL,
`created_by` int UNSIGNED NOT NULL DEFAULT '0',
`checked_out` int unsigned,
`checked_out_time` datetime,
PRIMARY KEY (id),
KEY `idx_type` (`type`),
KEY `idx_state` (`state`),
KEY `idx_last_exit` (`last_exit_code`),
KEY `idx_next_exec` (`next_execution`),
KEY `idx_locked` (`locked`),
KEY `idx_priority` (`priority`),
KEY `idx_checked_out` (`checked_out`)
`id` int unsigned NOT NULL AUTO_INCREMENT,
`asset_id` int unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`title` varchar(255) NOT NULL DEFAULT '',
`type` varchar(128) NOT NULL COMMENT 'unique identifier for job defined by plugin',
`execution_rules` text COMMENT 'Execution Rules, Unprocessed',
`cron_rules` text COMMENT 'Processed execution rules, crontab-like JSON form',
`state` tinyint NOT NULL DEFAULT FALSE,
`last_exit_code` int NOT NULL DEFAULT 0 COMMENT 'Exit code when job was last run',
`last_execution` datetime COMMENT 'Timestamp of last run',
`next_execution` datetime COMMENT 'Timestamp of next (planned) run, referred for execution on trigger',
`times_executed` int DEFAULT 0 COMMENT 'Count of successful triggers',
`times_failed` int DEFAULT 0 COMMENT 'Count of failures',
`locked` datetime,
`priority` smallint NOT NULL DEFAULT 0,
`ordering` int NOT NULL DEFAULT 0 COMMENT 'Configurable list ordering',
`params` text NOT NULL,
`note` text,
`created` datetime NOT NULL,
`created_by` int UNSIGNED NOT NULL DEFAULT 0,
`checked_out` int unsigned,
`checked_out_time` datetime,
PRIMARY KEY (id),
KEY `idx_type` (`type`),
KEY `idx_state` (`state`),
KEY `idx_last_exit` (`last_exit_code`),
KEY `idx_next_exec` (`next_execution`),
KEY `idx_locked` (`locked`),
KEY `idx_priority` (`priority`),
KEY `idx_checked_out` (`checked_out`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci;

-- Add `com_scheduler` to `#__extensions`
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`) VALUES
(0, 'com_scheduler', 'component', 'com_scheduler', '', 1, 1, 1, 0, 1, '', '{}', '');

-- Add plugins to `#__extensions`
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_system_tasknotification', 'plugin', 'tasknotification', 'system', 0, 1, 1, 0, 1, '', '', '', 22, 0),
(0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0);

-- Add com_scheduler to action logs
INSERT INTO `#__action_logs_extensions` (`extension`) VALUES ('com_scheduler');

INSERT INTO `#__action_log_config` (`type_title`, `type_alias`, `id_holder`, `title_holder`, `table_name`, `text_prefix`) VALUES
('task', 'com_scheduler.task', 'id', 'title', '#__scheduler_tasks', 'PLG_ACTIONLOG_JOOMLA');

-- Add mail templates
INSERT INTO `#__mail_templates` (`template_id`, `extension`, `language`, `subject`, `body`, `htmlbody`, `attachments`, `params`) VALUES
('plg_system_tasknotification.failure_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_BODY', '', '', '{"tags": ["task_id", "task_title", "exit_code", "exec_data_time", "task_output"]}'),
('plg_system_tasknotification.fatal_recovery_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_BODY', '', '', '{"tags": ["task_id", "task_title"]}'),
('plg_system_tasknotification.orphan_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_ORPHAN_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_ORPHAN_MAIL_BODY', '', '', '{"tags": ["task_id", "task_title", ""]}'),
('plg_system_tasknotification.success_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_SUCCESS_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_SUCCESS_MAIL_BODY', '', '', '{"tags":["task_id", "task_title", "exec_data_time", "task_output"]}');

-- Add `com_scheduler` to `#__extensions`
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`,
`protected`, `locked`, `manifest_cache`, `params`, `custom_data`)
VALUES (0, 'com_scheduler', 'component', 'com_scheduler', '', 1, 1, 1, 0, 1, '', '', '');

-- Add `plg_task_demotasks` to `#__extensions`
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`,
`protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`)
VALUES (0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0);
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@
-- Table structure for table "#__scheduler_tasks"
--

CREATE TABLE IF NOT EXISTS "#__scheduler_tasks"
(
"id" serial NOT NULL,
"asset_id" bigint NOT NULL DEFAULT '0',
"title" varchar(255) NOT NULL,
"type" varchar(128) NOT NULL,
"execution_rules" text,
"cron_rules" text,
"state" smallint NOT NULL DEFAULT '0',
"last_exit_code" int NOT NULL DEFAULT '0',
"last_execution" timestamp without time zone,
"next_execution" timestamp without time zone,
"times_executed" int NOT NULL DEFAULT '0',
"times_failed" int DEFAULT '0',
"locked" timestamp without time zone,
"priority" smallint NOT NULL DEFAULT '0',
"ordering" bigint DEFAULT 0 NOT NULL,
"params" text NOT NULL,
"note" text DEFAULT '',
"created" timestamp without time zone NOT NULL,
"created_by" bigint NOT NULL DEFAULT '0',
"checked_out" integer,
"checked_out_time" timestamp without time zone,
PRIMARY KEY ("id")
CREATE TABLE IF NOT EXISTS "#__scheduler_tasks" (
"id" serial NOT NULL,
"asset_id" bigint DEFAULT 0 NOT NULL,
"title" varchar(255) NOT NULL,
"type" varchar(128) NOT NULL,
"execution_rules" text,
"cron_rules" text,
"state" smallint DEFAULT 0 NOT NULL,
"last_exit_code" integer DEFAULT 0 NOT NULL,
"last_execution" timestamp without time zone,
"next_execution" timestamp without time zone,
"times_executed" integer DEFAULT 0 NOT NULL,
"times_failed" integer DEFAULT 0,
"locked" timestamp without time zone,
"priority" smallint DEFAULT 0 NOT NULL,
"ordering" bigint DEFAULT 0 NOT NULL,
"params" text NOT NULL,
"note" text,
"created" timestamp without time zone NOT NULL,
"created_by" bigint DEFAULT 0 NOT NULL,
"checked_out" integer,
"checked_out_time" timestamp without time zone,
PRIMARY KEY ("id")
);

CREATE INDEX "#__scheduler_tasks_idx_type" ON "#__scheduler_tasks" ("type");
Expand All @@ -36,18 +35,27 @@ CREATE INDEX "#__scheduler_tasks_idx_locked" ON "#__scheduler_tasks" ("locked");
CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priority");
CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out");

-- Add "com_scheduler" to "#__extensions"
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'com_scheduler', 'component', 'com_scheduler', '', 1, 1, 1, 0, 1, '', '{}', '', 0, 0);

-- Add plugins to "#__extensions"
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_system_tasknotification', 'plugin', 'tasknotification', 'system', 0, 1, 1, 0, 1, '', '', '', 22, 0),
(0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0);

-- Add com_scheduler to action logs extensions
INSERT INTO "#__action_logs_extensions" ("extension") VALUES ('com_scheduler');

INSERT INTO "#__action_log_config" ("type_title", "type_alias", "id_holder", "title_holder", "table_name", "text_prefix") VALUES
('task', 'com_scheduler.task', 'id', 'title', '#__scheduler_tasks', 'PLG_ACTIONLOG_JOOMLA');

-- Add mail templates
INSERT INTO "#__mail_templates" ("template_id", "extension", "language", "subject", "body", "htmlbody", "attachments", "params") VALUES
('plg_system_tasknotification.failure_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_FAILURE_MAIL_BODY', '', '', '{"tags": ["task_id", "task_title", "exit_code", "exec_data_time", "task_output"]}'),
('plg_system_tasknotification.fatal_recovery_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_FATAL_MAIL_BODY', '', '', '{"tags": ["task_id", "task_title"]}'),
('plg_system_tasknotification.orphan_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_ORPHAN_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_ORPHAN_MAIL_BODY', '', '', '{"tags": ["task_id", "task_title", ""]}'),
('plg_system_tasknotification.success_mail', 'plg_system_tasknotification', '', 'PLG_SYSTEM_TASK_NOTIFICATION_SUCCESS_MAIL_SUBJECT', 'PLG_SYSTEM_TASK_NOTIFICATION_SUCCESS_MAIL_BODY', '', '', '{"tags":["task_id", "task_title", "exec_data_time", "task_output"]}');

-- Add "com_scheduler" to "#__extensions"
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access",
"protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state")
VALUES (0, 'com_scheduler', 'component', 'com_scheduler', '', 1, 1, 1, 0, 1, '', '{}', '', 0, 0);

-- Add "plg_task_demotasks" to "#__extensions"
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access",
"protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state")
VALUES (0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0);
14 changes: 7 additions & 7 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'com_actionlogs', 'component', 'com_actionlogs', '', 1, 1, 1, 0, 1, '', '{"ip_logging":0,"csv_delimiter":",","loggable_extensions":["com_banners","com_cache","com_categories","com_checkin","com_config","com_contact","com_content","com_installer","com_media","com_menus","com_messages","com_modules","com_newsfeeds","com_plugins","com_redirect","com_tags","com_templates","com_users"]}', ''),
(0, 'com_workflow', 'component', 'com_workflow', '', 1, 1, 0, 1, 1, '', '{}', ''),
(0, 'com_mails', 'component', 'com_mails', '', 1, 1, 1, 1, 1, '', '', ''),
(0, 'com_scheduler', 'component', 'com_scheduler', 1, 1, 1, 1, 0, 1, '', '', '');
(0, 'com_scheduler', 'component', 'com_scheduler', '', 1, 1, 1, 0, 1, '', '{}', '');

-- Libraries
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`) VALUES
Expand Down Expand Up @@ -336,13 +336,17 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_system_privacyconsent', 'plugin', 'privacyconsent', 'system', 0, 0, 1, 0, 1, '', '{}', '', 13, 0),
(0, 'plg_system_redirect', 'plugin', 'redirect', 'system', 0, 0, 1, 0, 1, '', '', '', 14, 0),
(0, 'plg_system_remember', 'plugin', 'remember', 'system', 0, 1, 1, 0, 1, '', '', '', 15, 0),
(0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_system_sef', 'plugin', 'sef', 'system', 0, 1, 1, 0, 1, '', '', '', 16, 0),
(0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, 1, '', '', '', 17, 0),
(0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 18, 0),
(0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 19, 0),
(0, 'plg_system_tasknotification', 'plugin', 'tasknotification', 'system', 0, 1, 1, 0, 1, '', '', '', 22, 0),
(0, 'plg_system_updatenotification', 'plugin', 'updatenotification', 'system', 0, 1, 1, 0, 1, '', '', '', 20, 0),
(0, 'plg_system_webauthn', 'plugin', 'webauthn', 'system', 0, 1, 1, 0, 1, '', '{}', '', 21, 0),
(0, 'plg_system_tasknotification', 'plugin', 'tasknotification', 'system', 0, 1, 1, 0, 1, '', '', '', 22, 0),
(0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_twofactorauth_totp', 'plugin', 'totp', 'twofactorauth', 0, 0, 1, 0, 1, '', '', '', 1, 0),
(0, 'plg_twofactorauth_yubikey', 'plugin', 'yubikey', 'twofactorauth', 0, 0, 1, 0, 1, '', '', '', 2, 0),
(0, 'plg_user_contactcreator', 'plugin', 'contactcreator', 'user', 0, 0, 1, 0, 1, '', '{"autowebpage":"","category":"4","autopublish":"0"}', '', 1, 0),
Expand All @@ -368,11 +372,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_webservices_users', 'plugin', 'users', 'webservices', 0, 1, 1, 0, 1, '', '{}', '', 16, 0),
(0, 'plg_workflow_featuring', 'plugin', 'featuring', 'workflow', 0, 1, 1, 0, 1, '', '{}', '', 1, 0),
(0, 'plg_workflow_notification', 'plugin', 'notification', 'workflow', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
(0, 'plg_workflow_publishing', 'plugin', 'publishing', 'workflow', 0, 1, 1, 0, 1, '', '{}', '', 3, 0),
(0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_system_schedulerunner', 'plugin', 'schedulerunner', 'system', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0),
(0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 0, '', '{}', '', 15, 0);
(0, 'plg_workflow_publishing', 'plugin', 'publishing', 'workflow', 0, 1, 1, 0, 1, '', '{}', '', 3, 0);

-- Templates
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
Expand Down
12 changes: 6 additions & 6 deletions installation/sql/mysql/extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -893,24 +893,24 @@ CREATE TABLE IF NOT EXISTS `#__action_logs_users` (

CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`asset_id` int NOT NULL UNIQUE DEFAULT '0',
`asset_id` int unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`title` varchar(255) NOT NULL DEFAULT '',
`type` varchar(128) NOT NULL COMMENT 'unique identifier for job defined by plugin',
`execution_rules` text COMMENT 'Execution Rules, Unprocessed',
`cron_rules` text COMMENT 'Processed execution rules, crontab-like JSON form',
`state` tinyint NOT NULL DEFAULT FALSE,
`last_exit_code` int NOT NULL DEFAULT '0' COMMENT 'Exit code when job was last run',
`last_exit_code` int NOT NULL DEFAULT 0 COMMENT 'Exit code when job was last run',
`last_execution` datetime COMMENT 'Timestamp of last run',
`next_execution` datetime COMMENT 'Timestamp of next (planned) run, referred for execution on trigger',
`times_executed` int DEFAULT '0' COMMENT 'Count of successful triggers',
`times_failed` int DEFAULT '0' COMMENT 'Count of failures',
`times_executed` int DEFAULT 0 COMMENT 'Count of successful triggers',
`times_failed` int DEFAULT 0 COMMENT 'Count of failures',
`locked` datetime,
`priority` smallint NOT NULL DEFAULT '0',
`priority` smallint NOT NULL DEFAULT 0,
`ordering` int NOT NULL DEFAULT 0 COMMENT 'Configurable list ordering',
`params` text NOT NULL,
`note` text,
`created` datetime NOT NULL,
`created_by` int UNSIGNED NOT NULL DEFAULT '0',
`created_by` int UNSIGNED NOT NULL DEFAULT 0,
`checked_out` int unsigned,
`checked_out_time` datetime,
PRIMARY KEY (id),
Expand Down
Loading