Closed joomlapl-bot closed 5 months ago
PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/40519 Poniżej zmiany w oryginale:
PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/40519 Poniżej zmiany w oryginale:
Click to expand the diff!
```diff diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index fd7b8c35a357a..1eefc688d1621 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -235,6 +235,7 @@ protected function uninstallExtensions() */ ['type' => 'plugin', 'element' => 'demotasks', 'folder' => 'task', 'client_id' => 0, 'pre_function' => null], ['type' => 'plugin', 'element' => 'compat', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'migrateCompatPlugin'], + ['type' => 'plugin', 'element' => 'logrotation', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'migrateLogRotationPlugin'], ['type' => 'plugin', 'element' => 'recaptcha', 'folder' => 'captcha', 'client_id' => 0, 'pre_function' => null], ['type' => 'plugin', 'element' => 'updatenotification', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'migrateUpdatenotificationPlugin'], ]; @@ -316,6 +317,49 @@ private function migrateCompatPlugin($rowOld) )->execute(); } + /** + * This method is for migration for old logrotation system plugin migration to task. + * + * @param \stdClass $data Object with the extension's record in the `#__extensions` table + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + private function migrateLogRotationPlugin($data) + { + if (!$data->enabled) { + return; + } + + /** @var SchedulerComponent $component */ + $component = Factory::getApplication()->bootComponent('com_scheduler'); + + /** @var TaskModel $model */ + $model = $component->getMVCFactory()->createModel('Task', 'Administrator', ['ignore_request' => true]); + + // Get the timeout, as configured in plg_system_logrotation + $params = new Registry($data->params); + $cachetimeout = (int) $params->get('cachetimeout', 30); + $lastrun = (int) $params->get('lastrun', time()); + + $task = [ + 'title' => 'RotateLogs', + 'type' => 'rotation.logs', + 'execution_rules' => [ + 'rule-type' => 'interval-days', + 'interval-days' => $cachetimeout, + 'exec-time' => gmdate('H:i', $lastrun), + 'exec-day' => gmdate('d'), + ], + 'state' => 1, + 'params' => [ + 'logstokeep' => $params->get('logstokeep', 1), + ], + ]; + $model->save($task); + } + /** * This method is for migration for old updatenotification system plugin migration to task. * diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-09-02.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-09-02.sql index fedce0a7dfaf3..5552693d22c2e 100644 --- a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-09-02.sql +++ b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-09-02.sql @@ -1,6 +1,9 @@ INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +('plg_task_rotatelogs', 'plugin', 'rotatelogs', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0), ('plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0); + INSERT INTO `#__mail_templates` (`template_id`, `extension`, `language`, `subject`, `body`, `htmlbody`, `attachments`, `params`) VALUES ('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'); + DELETE FROM `#__mail_templates` WHERE `template_id` = 'plg_system_updatenotification.mail'; DELETE FROM `#__postinstall_messages` WHERE `condition_file` = 'site://plugins/system/updatenotification/postinstall/updatecachetime.php'; diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-09-02.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-09-02.sql index 276d7d87668d6..fc99290a3d629 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-09-02.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-09-02.sql @@ -1,6 +1,9 @@ INSERT INTO "#__extensions" ("name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +('plg_task_rotatelogs', 'plugin', 'rotatelogs', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0), ('plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', NULL, NULL, 0, 0); + INSERT INTO "#__mail_templates" ("template_id", "extension", "language", "subject", "body", "htmlbody", "attachments", "params") VALUES ('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'); + DELETE FROM "#__mail_templates" WHERE "template_id" = 'plg_system_updatenotification.mail'; DELETE FROM "#__postinstall_messages" WHERE "condition_file" = 'site://plugins/system/updatenotification/postinstall/updatecachetime.php'; diff --git a/administrator/language/en-GB/plg_system_logrotation.ini b/administrator/language/en-GB/plg_system_logrotation.ini deleted file mode 100644 index c55fc9fa19758..0000000000000 --- a/administrator/language/en-GB/plg_system_logrotation.ini +++ /dev/null @@ -1,9 +0,0 @@ -; Joomla! Project -; (C) 2018 Open Source Matters, Inc.