From 44f832c2a64a838a3e640faab440755e30eeedd8 Mon Sep 17 00:00:00 2001 From: alikon Date: Sun, 18 Jun 2023 12:18:02 +0200 Subject: [PATCH 01/63] updnft2task --- administrator/components/com_admin/script.php | 40 +++ .../sql/updates/mysql/5.0.0-2023-06-18.sql | 4 + .../updates/postgresql/5.0.0-2023-06-18.sql | 4 + .../en-GB/plg_task_updatenotification.ini | 19 ++ .../en-GB/plg_task_updatenotification.sys.ini | 7 + installation/sql/mysql/base.sql | 2 +- installation/sql/postgresql/base.sql | 2 +- libraries/src/Extension/ExtensionHelper.php | 2 +- .../updatenotification/forms/sendForm.xml | 24 ++ .../updatenotification/services/provider.php | 50 +++ .../src/Extension/UpdateNotification.php | 312 ++++++++++++++++++ .../updatenotification/updatenotification.xml | 22 ++ 12 files changed, 485 insertions(+), 3 deletions(-) create mode 100644 administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql create mode 100644 administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql create mode 100644 administrator/language/en-GB/plg_task_updatenotification.ini create mode 100644 administrator/language/en-GB/plg_task_updatenotification.sys.ini create mode 100644 plugins/task/updatenotification/forms/sendForm.xml create mode 100644 plugins/task/updatenotification/services/provider.php create mode 100644 plugins/task/updatenotification/src/Extension/UpdateNotification.php create mode 100644 plugins/task/updatenotification/updatenotification.xml diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index b10c24775b739..5e584c7f3d7c8 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -19,6 +19,7 @@ use Joomla\CMS\Log\Log; use Joomla\CMS\Table\Table; use Joomla\Database\ParameterType; +use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -229,6 +230,7 @@ protected function uninstallExtensions() * 'pre_function' => Name of an optional migration function to be called before * uninstalling, `null` if not used. */ + ['type' => 'plugin', 'element' => 'updatenotification', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'migrate'], ]; $db = Factory::getDbo(); @@ -281,6 +283,44 @@ protected function uninstallExtensions() } } + /** + * This method is just for testing. + * + * @param \stdClass $data Object with `extension_id` and `params` of the extension + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + private function migrate($data) + { + if (!$data->enabled) { + return; + } + + $params = new Registry($data->params); + /** @var SchedulerComponent $component */ + $component = Factory::getApplication()->bootComponent('com_scheduler'); + + /** @var TaskModel $model */ + $model = $component->getMVCFactory()->createModel('Task', 'Administrator', ['ignore_request' => true]); + $task = [ + 'title' => 'UpdateNotification', + 'type' => 'update.notification', + 'execution_rules' => [ + 'rule-type' => 'interval-hours', + 'interval-hours' => '24', + 'exec-time' => '08:26', + ], + 'state' => 1, + 'params' => [ + 'email' => $params->get('email',''), + 'language_override' => $params->get('language_override',''), + ] + ]; + $model->save($task); + } + /** * Update the manifest caches * diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql new file mode 100644 index 0000000000000..95045452c9831 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql @@ -0,0 +1,4 @@ +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_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"]}'); \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql new file mode 100644 index 0000000000000..bb60c85990d44 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql @@ -0,0 +1,4 @@ +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_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"]}'); \ No newline at end of file diff --git a/administrator/language/en-GB/plg_task_updatenotification.ini b/administrator/language/en-GB/plg_task_updatenotification.ini new file mode 100644 index 0000000000000..91cfdef13d331 --- /dev/null +++ b/administrator/language/en-GB/plg_task_updatenotification.ini @@ -0,0 +1,19 @@ +PLG_TASK_UPDATENOTIFICATION="Task - Joomla! Update Notification" +PLG_TASK_UPDATENOTIFICATION_EMAIL_DESC="A comma separated list of the email addresses which will receive the update notification emails. The addresses in the list MUST belong to existing users of your site who have the Super User privilege. If none of the listed emails belongs to Super Users, or if it's left blank, all Super Users of this site will receive the update notification email." +PLG_TASK_UPDATENOTIFICATION_EMAIL_LBL="Super User Emails" +PLG_TASK_UPDATENOTIFICATION_SEND_TITLE="Joomla! Update Notification" +PLG_TASK_UPDATENOTIFICATION_SEND_DESC="This task periodically checks for the availability of new Joomla! versions. When one is found it will send you an email, reminding you to update. You can customise the email at System → Mail Templates." +PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_DESC="Select a language for the update notification emails. Set to Auto to send them in the site language at the time." +PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_LBL="Email Language" +PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_NONE="Auto" +PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! project. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available for download.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}" +; You can use the following merge codes: +; {NEWVERSION} New Joomla! version, e.g. 1.2.3 +; {CURVERSION} Currently installed Joomla! version, e.g. 1.2.0 +; {SITENAME} Site name, as set in Global Configuration. +; {URL} URL of the site's frontend page. +; {LINK} Update URL (link to com_joomlaupdate, will request login if the Super User isn't already logged in). +; {RELEASENEWS} URL to the release news on joomla.org +; \n Newline character. Use it to start a new line in the email. +PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT="Joomla! Update available for {SITENAME} – {URL}" +PLG_TASK_UPDATENOTIFICATION_XML_DESCRIPTION="This task periodically checks for the availability of new Joomla! versions. When one is found it will send you an email, reminding you to update. You can customise the email at System → Mail Templates." \ No newline at end of file diff --git a/administrator/language/en-GB/plg_task_updatenotification.sys.ini b/administrator/language/en-GB/plg_task_updatenotification.sys.ini new file mode 100644 index 0000000000000..f954af8812658 --- /dev/null +++ b/administrator/language/en-GB/plg_task_updatenotification.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; (C) 2023 Open Source Matters, Inc. +; License GNU General Public License version 2 or later; see LICENSE.txt +; Note : All ini files need to be saved as UTF-8 + +PLG_TASK_UPDATENOTIFICATION="Task - Joomla! Update Notification" +PLG_TASK_UPDATENOTIFICATION_XML_DESCRIPTION="This task periodically checks for the availability of new Joomla! versions. When one is found it will send you an email, reminding you to update. You can customise the email at System → Mail Templates." diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index d181db1fbcfe4..a8f086bff7463 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -354,12 +354,12 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 20, 0), (0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 21, 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, '', '', '', 23, 0), (0, 'plg_system_webauthn', 'plugin', 'webauthn', 'system', 0, 1, 1, 0, 1, '', '{}', '', 24, 0), (0, 'plg_task_checkfiles', 'plugin', 'checkfiles', 'task', 0, 1, 1, 0, 1, '', '{}', '', 1, 0), (0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 1, '', '{}', '', 2, 0), (0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 1, '', '{}', '', 3, 0), (0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 1, '', '{}', '', 4, 0), +(0, 'plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', , 0), (0, 'plg_multifactorauth_totp', 'plugin', 'totp', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 1, 0), (0, 'plg_multifactorauth_yubikey', 'plugin', 'yubikey', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 2, 0), (0, 'plg_multifactorauth_webauthn', 'plugin', 'webauthn', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 3, 0), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 9bf300f290b23..9b0cf22fe3133 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -360,12 +360,12 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_system_skipto', 'plugin', 'skipto', 'system', 0, 1, 1, 0, 1, '', '{}', '', 20, 0), (0, 'plg_system_stats', 'plugin', 'stats', 'system', 0, 1, 1, 0, 1, '', '', '', 21, 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, '', '', '', 23, 0), (0, 'plg_system_webauthn', 'plugin', 'webauthn', 'system', 0, 1, 1, 0, 1, '', '{}', '', 24, 0), (0, 'plg_task_checkfiles', 'plugin', 'checkfiles', 'task', 0, 1, 1, 0, 1, '', '{}', '', 1, 0), (0, 'plg_task_demotasks', 'plugin', 'demotasks', 'task', 0, 1, 1, 0, 1, '', '{}', '', 2, 0), (0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 1, '', '{}', '', 3, 0), (0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 1, '', '{}', '', 4, 0), +(0, 'plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', , 0), (0, 'plg_multifactorauth_totp', 'plugin', 'totp', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 1, 0), (0, 'plg_multifactorauth_yubikey', 'plugin', 'yubikey', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 2, 0), (0, 'plg_multifactorauth_webauthn', 'plugin', 'webauthn', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 3, 0), diff --git a/libraries/src/Extension/ExtensionHelper.php b/libraries/src/Extension/ExtensionHelper.php index 9677624181e2c..b808c28b2e0c8 100644 --- a/libraries/src/Extension/ExtensionHelper.php +++ b/libraries/src/Extension/ExtensionHelper.php @@ -304,7 +304,6 @@ class ExtensionHelper ['plugin', 'skipto', 'system', 0], ['plugin', 'stats', 'system', 0], ['plugin', 'tasknotification', 'system', 0], - ['plugin', 'updatenotification', 'system', 0], ['plugin', 'webauthn', 'system', 0], // Core plugin extensions - task scheduler @@ -312,6 +311,7 @@ class ExtensionHelper ['plugin', 'demotasks', 'task', 0], ['plugin', 'requests', 'task', 0], ['plugin', 'sitestatus', 'task', 0], + ['plugin', 'updatenotification', 'task', 0], // Core plugin extensions - user ['plugin', 'contactcreator', 'user', 0], diff --git a/plugins/task/updatenotification/forms/sendForm.xml b/plugins/task/updatenotification/forms/sendForm.xml new file mode 100644 index 0000000000000..440a8fb3cb62b --- /dev/null +++ b/plugins/task/updatenotification/forms/sendForm.xml @@ -0,0 +1,24 @@ + +
+ +
+ + + + +
+
+
diff --git a/plugins/task/updatenotification/services/provider.php b/plugins/task/updatenotification/services/provider.php new file mode 100644 index 0000000000000..ef8693aa27514 --- /dev/null +++ b/plugins/task/updatenotification/services/provider.php @@ -0,0 +1,50 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +defined('_JEXEC') or die; + +use Joomla\CMS\Extension\PluginInterface; +use Joomla\CMS\Factory; +use Joomla\CMS\Plugin\PluginHelper; +use Joomla\Database\DatabaseInterface; +use Joomla\DI\Container; +use Joomla\DI\ServiceProviderInterface; +use Joomla\Event\DispatcherInterface; +use Joomla\Plugin\Task\UpdateNotification\Extension\UpdateNotification; + +return new class () implements ServiceProviderInterface { + /** + * Registers the service provider with a DI container. + * + * @param Container $container The DI container. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function register(Container $container) + { + $container->set( + PluginInterface::class, + function (Container $container) { + $dispatcher = $container->get(DispatcherInterface::class); + + $plugin = new UpdateNotification( + $dispatcher, + (array) PluginHelper::getPlugin('task', 'updatenotification') + ); + $plugin->setApplication(Factory::getApplication()); + $plugin->setDatabase($container->get(DatabaseInterface::class)); + + return $plugin; + } + ); + } +}; diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php new file mode 100644 index 0000000000000..0c4a1abd4dd09 --- /dev/null +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -0,0 +1,312 @@ + + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +namespace Joomla\Plugin\Task\UpdateNotification\Extension; + +use Joomla\CMS\Access\Access; +use Joomla\CMS\Extension\ExtensionHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Mail\Exception\MailDisabledException; +use Joomla\CMS\Mail\MailTemplate; +use Joomla\CMS\Plugin\CMSPlugin; +use Joomla\CMS\Updater\Updater; +use Joomla\CMS\Uri\Uri; +use Joomla\CMS\Table\Table; +use Joomla\CMS\Version; +use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; +use Joomla\Component\Scheduler\Administrator\Task\Status; +use Joomla\Component\Scheduler\Administrator\Traits\TaskPluginTrait; +use Joomla\Database\DatabaseAwareTrait; +use Joomla\Database\ParameterType; +use Joomla\Event\SubscriberInterface; +use PHPMailer\PHPMailer\Exception as phpmailerException; + + +// phpcs:disable PSR1.Files.SideEffects +\defined('_JEXEC') or die; +// phpcs:enable PSR1.Files.SideEffects + +/** + * A task plugin. Offers 2 task routines Invalidate Expired Consents and Remind Expired Consents + * {@see ExecuteTaskEvent}. + * + * @since __DEPLOY_VERSION__ + */ +final class UpdateNotification extends CMSPlugin implements SubscriberInterface +{ + use DatabaseAwareTrait; + use TaskPluginTrait; + + /** + * @var string[] + * @since __DEPLOY_VERSION__ + */ + private const TASKS_MAP = [ + 'update.notification' => [ + 'langConstPrefix' => 'PLG_TASK_UPDATENOTIFICATION_SEND', + 'method' => 'sendNotification', + 'form' => 'sendForm', + ], + ]; + + /** + * @var boolean + * @since __DEPLOY_VERSION__ + */ + protected $autoloadLanguage = true; + + /** + * @inheritDoc + * + * @return string[] + * + * @since __DEPLOY_VERSION__ + */ + public static function getSubscribedEvents(): array + { + return [ + 'onTaskOptionsList' => 'advertiseRoutines', + 'onExecuteTask' => 'standardRoutineHandler', + 'onContentPrepareForm' => 'enhanceTaskItemForm', + ]; + } + + /** + * Method to send the update notification. + * + * @param ExecuteTaskEvent $event The `onExecuteTask` event. + * + * @return integer The routine exit code. + * + * @since __DEPLOY_VERSION__ + * @throws \Exception + */ + private function sendNotification(ExecuteTaskEvent $event): int + { + // Load the parameters. + $specificEmail = $event->getArgument('params')->email ?? ''; + $forcedLanguage = $event->getArgument('params')->language_override ?? ''; + + // This is the extension ID for Joomla! itself + $eid = ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id; + + // Get any available updates + $updater = Updater::getInstance(); + $results = $updater->findUpdates([$eid], 0); + + // If there are no updates our job is done. We need BOTH this check AND the one below. + if (!$results) { + return Status::OK; + } + + // Get the update model and retrieve the Joomla! core updates + $model = $this->getApplication()->bootComponent('com_installer') + ->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]); + + $model->setState('filter.extension_id', $eid); + $updates = $model->getItems(); + + // If there are no updates we don't have to notify anyone about anything. This is NOT a duplicate check. + if (empty($updates)) { + return Status::OK; + } + + // Get the available update + $update = array_pop($updates); + + // Check the available version. If it's the same or less than the installed version we have no updates to notify about. + if (version_compare($update->version, JVERSION, 'le')) { + return Status::OK; + } + + // If we're here, we have updates. First, get a link to the Joomla! Update component. + $baseURL = Uri::base(); + $baseURL = rtrim($baseURL, '/'); + $baseURL .= (substr($baseURL, -13) !== 'administrator') ? '/administrator/' : '/'; + $baseURL .= 'index.php?option=com_joomlaupdate'; + $uri = new Uri($baseURL); + + /** + * Some third party security solutions require a secret query parameter to allow log in to the administrator + * backend of the site. The link generated above will be invalid and could probably block the user out of their + * site, confusing them (they can't understand the third party security solution is not part of Joomla! proper). + * So, we're calling the onBuildAdministratorLoginURL system plugin event to let these third party solutions + * add any necessary secret query parameters to the URL. The plugins are supposed to have a method with the + * signature: + * + * public function onBuildAdministratorLoginURL(Uri &$uri); + * + * The plugins should modify the $uri object directly and return null. + */ + $this->getApplication()->triggerEvent('onBuildAdministratorLoginURL', [&$uri]); + + // Let's find out the email addresses to notify + $superUsers = []; + + if (!empty($specificEmail)) { + $superUsers = $this->getSuperUsers($specificEmail); + } + + if (empty($superUsers)) { + $superUsers = $this->getSuperUsers(); + } + + if (empty($superUsers)) { + return Status::KNOCKOUT; + } + + /* + * Load the appropriate language. We try to load English (UK), the current user's language and the forced + * language preference, in this order. This ensures that we'll never end up with untranslated strings in the + * update email which would make Joomla! seem bad. So, please, if you don't fully understand what the + * following code does DO NOT TOUCH IT. It makes the difference between a hobbyist CMS and a professional + * solution! + */ + $jLanguage = $this->getApplication()->getLanguage(); + $jLanguage->load('plg_task_updatenotification', JPATH_ADMINISTRATOR, 'en-GB', true, true); + $jLanguage->load('plg_task_updatenotification', JPATH_ADMINISTRATOR, null, true, false); + + // Then try loading the preferred (forced) language + if (!empty($forcedLanguage)) { + $jLanguage->load('plg_task_updatenotification', JPATH_ADMINISTRATOR, $forcedLanguage, true, false); + } + + // Replace merge codes with their values + $newVersion = $update->version; + + $jVersion = new Version(); + $currentVersion = $jVersion->getShortVersion(); + + $sitename = $this->getApplication()->get('sitename'); + + $substitutions = [ + 'newversion' => $newVersion, + 'curversion' => $currentVersion, + 'sitename' => $sitename, + 'url' => Uri::base(), + 'link' => $uri->toString(), + 'releasenews' => 'https://www.joomla.org/announcements/release-news/', + ]; + + // Send the emails to the Super Users + foreach ($superUsers as $superUser) { + try { + $mailer = new MailTemplate('plg_task_updatenotification.mail', $jLanguage->getTag()); + $mailer->addRecipient($superUser->email); + $mailer->addTemplateData($substitutions); + $mailer->send(); + } catch (MailDisabledException | phpMailerException $exception) { + try { + $this->logTask(Text::_($exception->getMessage())); + } catch (\RuntimeException $exception) { + return Status::KNOCKOUT; + } + } + } + + $this->logTask('UpdateNotification end'); + + return Status::OK; + } + + /** + * Returns the Super Users email information. If you provide a comma separated $email list + * we will check that these emails do belong to Super Users and that they have not blocked + * system emails. + * + * @param null|string $email A list of Super Users to email + * + * @return array The list of Super User emails + * + * @since 3.5 + */ + private function getSuperUsers($email = null) + { + $db = $this->getDatabase(); + $emails = []; + + // Convert the email list to an array + if (!empty($email)) { + $temp = explode(',', $email); + + foreach ($temp as $entry) { + $emails[] = trim($entry); + } + + $emails = array_unique($emails); + } + + // Get a list of groups which have Super User privileges + $ret = []; + + try { + $rootId = Table::getInstance('Asset')->getRootId(); + $rules = Access::getAssetRules($rootId)->getData(); + $rawGroups = $rules['core.admin']->getData(); + $groups = []; + + if (empty($rawGroups)) { + return $ret; + } + + foreach ($rawGroups as $g => $enabled) { + if ($enabled) { + $groups[] = $g; + } + } + + if (empty($groups)) { + return $ret; + } + } catch (\Exception $exc) { + return $ret; + } + + // Get the user IDs of users belonging to the SA groups + try { + $query = $db->getQuery(true) + ->select($db->quoteName('user_id')) + ->from($db->quoteName('#__user_usergroup_map')) + ->whereIn($db->quoteName('group_id'), $groups); + + $db->setQuery($query); + $userIDs = $db->loadColumn(0); + + if (empty($userIDs)) { + return $ret; + } + } catch (\Exception $exc) { + return $ret; + } + + // Get the user information for the Super Administrator users + try { + $query = $db->getQuery(true) + ->select($db->quoteName(['id', 'username', 'email'])) + ->from($db->quoteName('#__users')) + ->whereIn($db->quoteName('id'), $userIDs) + ->where($db->quoteName('block') . ' = 0') + ->where($db->quoteName('sendEmail') . ' = 1'); + + if (!empty($emails)) { + $lowerCaseEmails = array_map('strtolower', $emails); + $query->whereIn('LOWER(' . $db->quoteName('email') . ')', $lowerCaseEmails, ParameterType::STRING); + } + + $db->setQuery($query); + $ret = $db->loadObjectList(); + } catch (\Exception $exc) { + return $ret; + } + + return $ret; + } + +} diff --git a/plugins/task/updatenotification/updatenotification.xml b/plugins/task/updatenotification/updatenotification.xml new file mode 100644 index 0000000000000..125144ab7a8e9 --- /dev/null +++ b/plugins/task/updatenotification/updatenotification.xml @@ -0,0 +1,22 @@ + + + plg_task_updatenotification + Joomla! Project + 2023-07 + (C) 2023 Open Source Matters, Inc. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + 5.0.0 + PLG_TASK_UPDATENOTIFICATION_XML_DESCRIPTION + Joomla\Plugin\Task\UpdateNotification + + forms + services + src + + + language/en-GB/plg_task_updatenotification.ini + language/en-GB/plg_task_updatenotification.sys.ini + + From 2ff3e4fe81a262bb63b91d69cd387ecf773de28a Mon Sep 17 00:00:00 2001 From: alikon Date: Sun, 18 Jun 2023 12:51:20 +0200 Subject: [PATCH 02/63] better name --- administrator/components/com_admin/script.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 5e584c7f3d7c8..85e787fd08cb5 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -230,7 +230,7 @@ protected function uninstallExtensions() * 'pre_function' => Name of an optional migration function to be called before * uninstalling, `null` if not used. */ - ['type' => 'plugin', 'element' => 'updatenotification', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'migrate'], + ['type' => 'plugin', 'element' => 'updatenotification', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'updatenotification_plugin_migration'], ]; $db = Factory::getDbo(); @@ -284,7 +284,7 @@ protected function uninstallExtensions() } /** - * This method is just for testing. + * This method is for migration for old updatenotification system plugin migration to task. * * @param \stdClass $data Object with `extension_id` and `params` of the extension * @@ -292,7 +292,7 @@ protected function uninstallExtensions() * * @since __DEPLOY_VERSION__ */ - private function migrate($data) + private function updatenotification_plugin_migration($data) { if (!$data->enabled) { return; From 88fe7c423666b66463b957e3d47b2cfd1c39f31b Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 18 Jun 2023 13:01:23 +0200 Subject: [PATCH 03/63] Update administrator/components/com_admin/script.php Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 85e787fd08cb5..de815263a4777 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -230,7 +230,7 @@ protected function uninstallExtensions() * 'pre_function' => Name of an optional migration function to be called before * uninstalling, `null` if not used. */ - ['type' => 'plugin', 'element' => 'updatenotification', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'updatenotification_plugin_migration'], + ['type' => 'plugin', 'element' => 'updatenotification', 'folder' => 'system', 'client_id' => 0, 'pre_function' => 'migrateUpdatenotificationPlugin'], ]; $db = Factory::getDbo(); From 8f4fcdadfcffe199ccecca9e5357164c9ecf144a Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 18 Jun 2023 13:01:43 +0200 Subject: [PATCH 04/63] Update administrator/components/com_admin/script.php Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index de815263a4777..4ada941498189 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -292,7 +292,7 @@ protected function uninstallExtensions() * * @since __DEPLOY_VERSION__ */ - private function updatenotification_plugin_migration($data) + private function migrateUpdatenotificationPlugin($data) { if (!$data->enabled) { return; From 73da95ad68bfcb74fa6928c5f1fcc575e3ae7e19 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 19 Jun 2023 21:10:55 +0200 Subject: [PATCH 05/63] cache_timeout --- administrator/components/com_admin/script.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 4ada941498189..6a87e5b729d69 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -10,6 +10,7 @@ * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace */ +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Extension\ExtensionHelper; use Joomla\CMS\Factory; use Joomla\CMS\Filesystem\File; @@ -296,7 +297,12 @@ private function migrateUpdatenotificationPlugin($data) { if (!$data->enabled) { return; - } + } + + // Get the timeout for Joomla! updates, as configured in com_installer's component parameters + $component = ComponentHelper::getComponent('com_installer'); + $paramsc = $component->getParams(); + $cache_timeout = (int) $paramsc->get('cachetimeout', 6); $params = new Registry($data->params); /** @var SchedulerComponent $component */ @@ -309,7 +315,7 @@ private function migrateUpdatenotificationPlugin($data) 'type' => 'update.notification', 'execution_rules' => [ 'rule-type' => 'interval-hours', - 'interval-hours' => '24', + 'interval-hours' => $cache_timeout, 'exec-time' => '08:26', ], 'state' => 1, From fcb1192f7487efa2737601d34b025beca7c13944 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Wed, 21 Jun 2023 20:01:05 +0200 Subject: [PATCH 06/63] lastrun --- administrator/components/com_admin/script.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 6a87e5b729d69..aa63f8074501d 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -300,11 +300,12 @@ private function migrateUpdatenotificationPlugin($data) } // Get the timeout for Joomla! updates, as configured in com_installer's component parameters - $component = ComponentHelper::getComponent('com_installer'); - $paramsc = $component->getParams(); - $cache_timeout = (int) $paramsc->get('cachetimeout', 6); + $component = ComponentHelper::getComponent('com_installer'); + $paramsc = $component->getParams(); + $cachetimeout = (int) $paramsc->get('cachetimeout', 6); + $params = new Registry($data->params); + $lastrun = (int) $pluginParams->get('lastrun', 0); - $params = new Registry($data->params); /** @var SchedulerComponent $component */ $component = Factory::getApplication()->bootComponent('com_scheduler'); @@ -315,8 +316,8 @@ private function migrateUpdatenotificationPlugin($data) 'type' => 'update.notification', 'execution_rules' => [ 'rule-type' => 'interval-hours', - 'interval-hours' => $cache_timeout, - 'exec-time' => '08:26', + 'interval-hours' => $cachetimeout, + 'exec-time' => gmdate("H:i", $lastrun), ], 'state' => 1, 'params' => [ From 19421663721dcf63e3f304be5a5cef16ea43f0a5 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Wed, 21 Jun 2023 20:02:41 +0200 Subject: [PATCH 07/63] cs --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index aa63f8074501d..51430a8d1c195 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -297,7 +297,7 @@ private function migrateUpdatenotificationPlugin($data) { if (!$data->enabled) { return; - } + } // Get the timeout for Joomla! updates, as configured in com_installer's component parameters $component = ComponentHelper::getComponent('com_installer'); From 7b7c0471f8a0602e69351bb5677419e23b327ae2 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 12:31:54 +0200 Subject: [PATCH 08/63] Update administrator/components/com_admin/script.php Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 7d17ca07ef8e2..1c37c829978d6 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -313,18 +313,18 @@ private function migrateUpdatenotificationPlugin($data) /** @var TaskModel $model */ $model = $component->getMVCFactory()->createModel('Task', 'Administrator', ['ignore_request' => true]); $task = [ - 'title' => 'UpdateNotification', - 'type' => 'update.notification', + 'title' => 'UpdateNotification', + 'type' => 'update.notification', 'execution_rules' => [ - 'rule-type' => 'interval-hours', + 'rule-type' => 'interval-hours', 'interval-hours' => $cachetimeout, - 'exec-time' => gmdate("H:i", $lastrun), + 'exec-time' => gmdate("H:i", $lastrun), ], - 'state' => 1, + 'state' => 1, 'params' => [ - 'email' => $params->get('email',''), - 'language_override' => $params->get('language_override',''), - ] + 'email' => $params->get('email', ''), + 'language_override' => $params->get('language_override', ''), + ], ]; $model->save($task); } From 196808dbcb7f8e74ab251334603addef1012a2a0 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 12:32:25 +0200 Subject: [PATCH 09/63] Update installation/sql/mysql/base.sql Co-authored-by: Richard Fath --- installation/sql/mysql/base.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 9e4f4af0e769f..1894ece31daf2 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -358,7 +358,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_task_checkfiles', 'plugin', 'checkfiles', 'task', 0, 1, 1, 0, 1, '', '{}', '', 1, 0), (0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 1, '', '{}', '', 3, 0), (0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 1, '', '{}', '', 4, 0), -(0, 'plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', , 0), +(0, 'plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', 5, 0), (0, 'plg_multifactorauth_totp', 'plugin', 'totp', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 1, 0), (0, 'plg_multifactorauth_yubikey', 'plugin', 'yubikey', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 2, 0), (0, 'plg_multifactorauth_webauthn', 'plugin', 'webauthn', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 3, 0), From 083e8d5fc66e78301293c1b5f4f368ea9c939498 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 12:32:39 +0200 Subject: [PATCH 10/63] Update installation/sql/postgresql/base.sql Co-authored-by: Richard Fath --- installation/sql/postgresql/base.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 9286d063b95c2..10a808f23d6bf 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -364,7 +364,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_task_checkfiles', 'plugin', 'checkfiles', 'task', 0, 1, 1, 0, 1, '', '{}', '', 1, 0), (0, 'plg_task_requests', 'plugin', 'requests', 'task', 0, 1, 1, 0, 1, '', '{}', '', 3, 0), (0, 'plg_task_sitestatus', 'plugin', 'sitestatus', 'task', 0, 1, 1, 0, 1, '', '{}', '', 4, 0), -(0, 'plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', , 0), +(0, 'plg_task_updatenotification', 'plugin', 'updatenotification', 'task', 0, 1, 1, 0, 1, '', '{}', '', 5, 0), (0, 'plg_multifactorauth_totp', 'plugin', 'totp', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 1, 0), (0, 'plg_multifactorauth_yubikey', 'plugin', 'yubikey', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 2, 0), (0, 'plg_multifactorauth_webauthn', 'plugin', 'webauthn', 'multifactorauth', 0, 1, 1, 0, 1, '', '', '', 3, 0), From 3fe4435f020760f4528164fb754f04bc8c22d8db Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 14:44:52 +0200 Subject: [PATCH 11/63] Update administrator/components/com_admin/script.php Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 1c37c829978d6..5f85180076494 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -299,7 +299,7 @@ private function migrateUpdatenotificationPlugin($data) if (!$data->enabled) { return; } - + // Get the timeout for Joomla! updates, as configured in com_installer's component parameters $component = ComponentHelper::getComponent('com_installer'); $paramsc = $component->getParams(); From 17a733e5199810d860f5bb6d0361f67aeaab4dab Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 14:45:09 +0200 Subject: [PATCH 12/63] Update administrator/components/com_admin/script.php Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 5f85180076494..72e7703086427 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -312,7 +312,7 @@ private function migrateUpdatenotificationPlugin($data) /** @var TaskModel $model */ $model = $component->getMVCFactory()->createModel('Task', 'Administrator', ['ignore_request' => true]); - $task = [ + $task = [ 'title' => 'UpdateNotification', 'type' => 'update.notification', 'execution_rules' => [ From 9e8fe792031c473b2d909cdd21cc81c57e138fd5 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 14:45:17 +0200 Subject: [PATCH 13/63] Update plugins/task/updatenotification/src/Extension/UpdateNotification.php Co-authored-by: Richard Fath --- .../task/updatenotification/src/Extension/UpdateNotification.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 0c4a1abd4dd09..55015d366f249 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -28,7 +28,6 @@ use Joomla\Event\SubscriberInterface; use PHPMailer\PHPMailer\Exception as phpmailerException; - // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects From 632354a96f2131ec7aff7d5389f3725dbc390e4a Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 14:45:27 +0200 Subject: [PATCH 14/63] Update plugins/task/updatenotification/src/Extension/UpdateNotification.php Co-authored-by: Richard Fath --- .../updatenotification/src/Extension/UpdateNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 55015d366f249..f36965791bb98 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -79,7 +79,7 @@ public static function getSubscribedEvents(): array /** * Method to send the update notification. - * + * * @param ExecuteTaskEvent $event The `onExecuteTask` event. * * @return integer The routine exit code. From 63ff70f25f59a97b17de8c70a8316bf32a15bac7 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 25 Jun 2023 14:45:35 +0200 Subject: [PATCH 15/63] Update plugins/task/updatenotification/src/Extension/UpdateNotification.php Co-authored-by: Richard Fath --- .../task/updatenotification/src/Extension/UpdateNotification.php | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index f36965791bb98..5aeaf561877a3 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -307,5 +307,4 @@ private function getSuperUsers($email = null) return $ret; } - } From a6a88d81ae66191141d4b4076dffb67e8dff84bc Mon Sep 17 00:00:00 2001 From: alikon Date: Mon, 26 Jun 2023 17:40:19 +0200 Subject: [PATCH 16/63] delete system plugin --- .../postinstall/updatecachetime.php | 63 --- .../updatenotification/services/provider.php | 48 --- .../src/Extension/UpdateNotification.php | 373 ------------------ .../updatenotification/updatenotification.xml | 52 --- 4 files changed, 536 deletions(-) delete mode 100644 plugins/system/updatenotification/postinstall/updatecachetime.php delete mode 100644 plugins/system/updatenotification/services/provider.php delete mode 100644 plugins/system/updatenotification/src/Extension/UpdateNotification.php delete mode 100644 plugins/system/updatenotification/updatenotification.xml diff --git a/plugins/system/updatenotification/postinstall/updatecachetime.php b/plugins/system/updatenotification/postinstall/updatecachetime.php deleted file mode 100644 index b020125158fdd..0000000000000 --- a/plugins/system/updatenotification/postinstall/updatecachetime.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\Factory; -use Joomla\CMS\Plugin\PluginHelper; -use Joomla\CMS\Table\Table; - -// phpcs:disable PSR1.Files.SideEffects -\defined('_JEXEC') or die; -// phpcs:enable PSR1.Files.SideEffects - -/** - * Checks if the com_installer config for the cache Hours are eq 0 and the updatenotification Plugin is enabled - * - * @return boolean - * - * @since 3.6.3 - */ -function updatecachetime_postinstall_condition() -{ - $cacheTimeout = (int) ComponentHelper::getComponent('com_installer')->params->get('cachetimeout', 6); - - // Check if cachetimeout is eq zero - if ($cacheTimeout === 0 && PluginHelper::isEnabled('system', 'updatenotification')) { - return true; - } - - return false; -} - -/** - * Sets the cachetimeout back to the default (6 hours) - * - * @return void - * - * @since 3.6.3 - */ -function updatecachetime_postinstall_action() -{ - $installer = ComponentHelper::getComponent('com_installer'); - - // Sets the cachetimeout back to the default (6 hours) - $installer->params->set('cachetimeout', 6); - - // Save the new parameters back to com_installer - $table = Table::getInstance('extension'); - $table->load($installer->id); - $table->bind(['params' => $installer->params->toString()]); - - // Store the changes - if (!$table->store()) { - // If there is an error show it to the admin - Factory::getApplication()->enqueueMessage($table->getError(), 'error'); - } -} diff --git a/plugins/system/updatenotification/services/provider.php b/plugins/system/updatenotification/services/provider.php deleted file mode 100644 index 7ce2a0ebf0062..0000000000000 --- a/plugins/system/updatenotification/services/provider.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -defined('_JEXEC') or die; - -use Joomla\CMS\Extension\PluginInterface; -use Joomla\CMS\Factory; -use Joomla\CMS\Plugin\PluginHelper; -use Joomla\Database\DatabaseInterface; -use Joomla\DI\Container; -use Joomla\DI\ServiceProviderInterface; -use Joomla\Event\DispatcherInterface; -use Joomla\Plugin\System\UpdateNotification\Extension\UpdateNotification; - -return new class () implements ServiceProviderInterface { - /** - * Registers the service provider with a DI container. - * - * @param Container $container The DI container. - * - * @return void - * - * @since 4.4.0 - */ - public function register(Container $container): void - { - $container->set( - PluginInterface::class, - function (Container $container) { - $plugin = new UpdateNotification( - $container->get(DispatcherInterface::class), - (array) PluginHelper::getPlugin('system', 'updatenotification') - ); - $plugin->setApplication(Factory::getApplication()); - $plugin->setDatabase($container->get(DatabaseInterface::class)); - - return $plugin; - } - ); - } -}; diff --git a/plugins/system/updatenotification/src/Extension/UpdateNotification.php b/plugins/system/updatenotification/src/Extension/UpdateNotification.php deleted file mode 100644 index eb7db6e3f9fa3..0000000000000 --- a/plugins/system/updatenotification/src/Extension/UpdateNotification.php +++ /dev/null @@ -1,373 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -namespace Joomla\Plugin\System\UpdateNotification\Extension; - -use Exception; -use Joomla\CMS\Access\Access; -use Joomla\CMS\Cache\Cache; -use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\Extension\ExtensionHelper; -use Joomla\CMS\Language\Text; -use Joomla\CMS\Log\Log; -use Joomla\CMS\Mail\Exception\MailDisabledException; -use Joomla\CMS\Mail\MailTemplate; -use Joomla\CMS\Plugin\CMSPlugin; -use Joomla\CMS\Table\Table; -use Joomla\CMS\Updater\Updater; -use Joomla\CMS\Uri\Uri; -use Joomla\CMS\Version; -use Joomla\Database\DatabaseAwareTrait; -use Joomla\Database\ParameterType; -use PHPMailer\PHPMailer\Exception as phpMailerException; - -// phpcs:disable PSR1.Files.SideEffects -\defined('_JEXEC') or die; -// phpcs:enable PSR1.Files.SideEffects - -// Uncomment the following line to enable debug mode (update notification email sent every single time) -// define('PLG_SYSTEM_UPDATENOTIFICATION_DEBUG', 1); - -/** - * Joomla! Update Notification plugin - * - * Sends out an email to all Super Users or a predefined list of email addresses of Super Users when a new - * Joomla! version is available. - * - * This plugin is a direct adaptation of the corresponding plugin in Akeeba Ltd's Admin Tools. The author has - * consented to relicensing their plugin's code under GPLv2 or later (the original version was licensed under - * GPLv3 or later) to allow its inclusion in the Joomla! CMS. - * - * @since 3.5 - */ -final class UpdateNotification extends CMSPlugin -{ - use DatabaseAwareTrait; - - /** - * Load plugin language files automatically - * - * @var boolean - * @since 3.6.3 - */ - protected $autoloadLanguage = true; - - /** - * The update check and notification email code is triggered after the page has fully rendered. - * - * @return void - * - * @since 3.5 - */ - public function onAfterRender() - { - // Get the timeout for Joomla! updates, as configured in com_installer's component parameters - $component = ComponentHelper::getComponent('com_installer'); - - /** @var \Joomla\Registry\Registry $params */ - $params = $component->getParams(); - $cache_timeout = (int) $params->get('cachetimeout', 6); - $cache_timeout = 3600 * $cache_timeout; - - // Do we need to run? Compare the last run timestamp stored in the plugin's options with the current - // timestamp. If the difference is greater than the cache timeout we shall not execute again. - $now = time(); - $last = (int) $this->params->get('lastrun', 0); - - if (!defined('PLG_SYSTEM_UPDATENOTIFICATION_DEBUG') && (abs($now - $last) < $cache_timeout)) { - return; - } - - // Update last run status - // If I have the time of the last run, I can update, otherwise insert - $this->params->set('lastrun', $now); - - $db = $this->getDatabase(); - $paramsJson = $this->params->toString('JSON'); - - $query = $db->getQuery(true) - ->update($db->quoteName('#__extensions')) - ->set($db->quoteName('params') . ' = :params') - ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) - ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) - ->where($db->quoteName('element') . ' = ' . $db->quote('updatenotification')) - ->bind(':params', $paramsJson); - - try { - // Lock the tables to prevent multiple plugin executions causing a race condition - $db->lockTable('#__extensions'); - } catch (Exception $e) { - // If we can't lock the tables it's too risky to continue execution - return; - } - - try { - // Update the plugin parameters - $result = $db->setQuery($query)->execute(); - - $this->clearCacheGroups(['com_plugins']); - } catch (Exception $exc) { - // If we failed to execute - $db->unlockTables(); - $result = false; - } - - try { - // Unlock the tables after writing - $db->unlockTables(); - } catch (Exception $e) { - // If we can't lock the tables assume we have somehow failed - $result = false; - } - - // Stop on failure - if (!$result) { - return; - } - - // This is the extension ID for Joomla! itself - $eid = ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id; - - // Get any available updates - $updater = Updater::getInstance(); - $results = $updater->findUpdates([$eid], $cache_timeout); - - // If there are no updates our job is done. We need BOTH this check AND the one below. - if (!$results) { - return; - } - - // Get the update model and retrieve the Joomla! core updates - $model = $this->getApplication()->bootComponent('com_installer') - ->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]); - $model->setState('filter.extension_id', $eid); - $updates = $model->getItems(); - - // If there are no updates we don't have to notify anyone about anything. This is NOT a duplicate check. - if (empty($updates)) { - return; - } - - // Get the available update - $update = array_pop($updates); - - // Check the available version. If it's the same or less than the installed version we have no updates to notify about. - if (version_compare($update->version, JVERSION, 'le')) { - return; - } - - // If we're here, we have updates. First, get a link to the Joomla! Update component. - $baseURL = Uri::base(); - $baseURL = rtrim($baseURL, '/'); - $baseURL .= (substr($baseURL, -13) !== 'administrator') ? '/administrator/' : '/'; - $baseURL .= 'index.php?option=com_joomlaupdate'; - $uri = new Uri($baseURL); - - /** - * Some third party security solutions require a secret query parameter to allow log in to the administrator - * backend of the site. The link generated above will be invalid and could probably block the user out of their - * site, confusing them (they can't understand the third party security solution is not part of Joomla! proper). - * So, we're calling the onBuildAdministratorLoginURL system plugin event to let these third party solutions - * add any necessary secret query parameters to the URL. The plugins are supposed to have a method with the - * signature: - * - * public function onBuildAdministratorLoginURL(Uri &$uri); - * - * The plugins should modify the $uri object directly and return null. - */ - $this->getApplication()->triggerEvent('onBuildAdministratorLoginURL', [&$uri]); - - // Let's find out the email addresses to notify - $superUsers = []; - $specificEmail = $this->params->get('email', ''); - - if (!empty($specificEmail)) { - $superUsers = $this->getSuperUsers($specificEmail); - } - - if (empty($superUsers)) { - $superUsers = $this->getSuperUsers(); - } - - if (empty($superUsers)) { - return; - } - - /* - * Load the appropriate language. We try to load English (UK), the current user's language and the forced - * language preference, in this order. This ensures that we'll never end up with untranslated strings in the - * update email which would make Joomla! seem bad. So, please, if you don't fully understand what the - * following code does DO NOT TOUCH IT. It makes the difference between a hobbyist CMS and a professional - * solution! - */ - $jLanguage = $this->getApplication()->getLanguage(); - $jLanguage->load('plg_system_updatenotification', JPATH_ADMINISTRATOR, 'en-GB', true, true); - $jLanguage->load('plg_system_updatenotification', JPATH_ADMINISTRATOR, null, true, false); - - // Then try loading the preferred (forced) language - $forcedLanguage = $this->params->get('language_override', ''); - - if (!empty($forcedLanguage)) { - $jLanguage->load('plg_system_updatenotification', JPATH_ADMINISTRATOR, $forcedLanguage, true, false); - } - - // Replace merge codes with their values - $newVersion = $update->version; - - $jVersion = new Version(); - $currentVersion = $jVersion->getShortVersion(); - - $sitename = $this->getApplication()->get('sitename'); - - $substitutions = [ - 'newversion' => $newVersion, - 'curversion' => $currentVersion, - 'sitename' => $sitename, - 'url' => Uri::base(), - 'link' => $uri->toString(), - 'releasenews' => 'https://www.joomla.org/announcements/release-news/', - ]; - - // Send the emails to the Super Users - foreach ($superUsers as $superUser) { - try { - $mailer = new MailTemplate('plg_system_updatenotification.mail', $jLanguage->getTag()); - $mailer->addRecipient($superUser->email); - $mailer->addTemplateData($substitutions); - $mailer->send(); - } catch (MailDisabledException | phpMailerException $exception) { - try { - Log::add($this->getApplication()->getLanguage()->_($exception->getMessage()), Log::WARNING, 'jerror'); - } catch (\RuntimeException $exception) { - $this->getApplication()->enqueueMessage($this->getApplication()->getLanguage()->_($exception->errorMessage()), 'warning'); - } - } - } - } - - /** - * Returns the Super Users email information. If you provide a comma separated $email list - * we will check that these emails do belong to Super Users and that they have not blocked - * system emails. - * - * @param null|string $email A list of Super Users to email - * - * @return array The list of Super User emails - * - * @since 3.5 - */ - private function getSuperUsers($email = null) - { - $db = $this->getDatabase(); - $emails = []; - - // Convert the email list to an array - if (!empty($email)) { - $temp = explode(',', $email); - - foreach ($temp as $entry) { - $emails[] = trim($entry); - } - - $emails = array_unique($emails); - } - - // Get a list of groups which have Super User privileges - $ret = []; - - try { - $rootId = Table::getInstance('Asset')->getRootId(); - $rules = Access::getAssetRules($rootId)->getData(); - $rawGroups = $rules['core.admin']->getData(); - $groups = []; - - if (empty($rawGroups)) { - return $ret; - } - - foreach ($rawGroups as $g => $enabled) { - if ($enabled) { - $groups[] = $g; - } - } - - if (empty($groups)) { - return $ret; - } - } catch (Exception $exc) { - return $ret; - } - - // Get the user IDs of users belonging to the SA groups - try { - $query = $db->getQuery(true) - ->select($db->quoteName('user_id')) - ->from($db->quoteName('#__user_usergroup_map')) - ->whereIn($db->quoteName('group_id'), $groups); - - $db->setQuery($query); - $userIDs = $db->loadColumn(0); - - if (empty($userIDs)) { - return $ret; - } - } catch (Exception $exc) { - return $ret; - } - - // Get the user information for the Super Administrator users - try { - $query = $db->getQuery(true) - ->select($db->quoteName(['id', 'username', 'email'])) - ->from($db->quoteName('#__users')) - ->whereIn($db->quoteName('id'), $userIDs) - ->where($db->quoteName('block') . ' = 0') - ->where($db->quoteName('sendEmail') . ' = 1'); - - if (!empty($emails)) { - $lowerCaseEmails = array_map('strtolower', $emails); - $query->whereIn('LOWER(' . $db->quoteName('email') . ')', $lowerCaseEmails, ParameterType::STRING); - } - - $db->setQuery($query); - $ret = $db->loadObjectList(); - } catch (Exception $exc) { - return $ret; - } - - return $ret; - } - - /** - * Clears cache groups. We use it to clear the plugins cache after we update the last run timestamp. - * - * @param array $clearGroups The cache groups to clean - * - * @return void - * - * @since 3.5 - */ - private function clearCacheGroups(array $clearGroups) - { - foreach ($clearGroups as $group) { - try { - $options = [ - 'defaultgroup' => $group, - 'cachebase' => $this->getApplication()->get('cache_path', JPATH_CACHE), - ]; - - $cache = Cache::getInstance('callback', $options); - $cache->clean(); - } catch (Exception $e) { - // Ignore it - } - } - } -} diff --git a/plugins/system/updatenotification/updatenotification.xml b/plugins/system/updatenotification/updatenotification.xml deleted file mode 100644 index b293ea5505a5e..0000000000000 --- a/plugins/system/updatenotification/updatenotification.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - plg_system_updatenotification - Joomla! Project - 2015-05 - (C) 2015 Open Source Matters, Inc. - GNU General Public License version 2 or later; see LICENSE.txt - admin@joomla.org - www.joomla.org - 3.5.0 - PLG_SYSTEM_UPDATENOTIFICATION_XML_DESCRIPTION - Joomla\Plugin\System\UpdateNotification - - postinstall - services - src - - - language/en-GB/plg_system_updatenotification.ini - language/en-GB/plg_system_updatenotification.sys.ini - - - -
- - - - - - - -
-
-
-
From db3e4e83067ac0b64855c9b197c95562301f970f Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Fri, 30 Jun 2023 11:32:52 +0200 Subject: [PATCH 17/63] settingson install --- installation/sql/mysql/extensions.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index bd13932b11059..4aa68349794ea 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,6 +925,15 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; +SELECT @myLeft := lft FROM `#__assets` WHERE id = 1; +UPDATE `#__assets` SET rgt = rgt + 2 WHERE rgt > @myLeft; +UPDATE `#__assets` SET lft = lft + 2 WHERE lft > @myLeft; +INSERT INTO `#__assets`(`parent_id`, `name`, `title`, `lft`, `rgt`, `level`, `rules`) VALUES(1, 'com_scheduler.task.22', 'com_scheduler.task.22', @myLeft + 1, @myLeft + 2, 1, '{}'); +SET @last_id_in_assets = LAST_INSERT_ID(); +INSERT INTO `#__scheduler_tasks`(`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) +VALUES (1, @last_id_in_assets,'UpdateNotification','update.notification','{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"08:00"}', '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); + + -- -------------------------------------------------------- -- From 526f839f784633f055abf76d2fe36f5fca1aa45d Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sat, 1 Jul 2023 09:41:32 +0200 Subject: [PATCH 18/63] bettersyntax --- installation/sql/mysql/extensions.sql | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index 4aa68349794ea..eef54eeb088d4 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,14 +925,13 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -SELECT @myLeft := lft FROM `#__assets` WHERE id = 1; +SET @myLeft = (SELECT lft FROM `#__assets` WHERE id = 1); UPDATE `#__assets` SET rgt = rgt + 2 WHERE rgt > @myLeft; UPDATE `#__assets` SET lft = lft + 2 WHERE lft > @myLeft; -INSERT INTO `#__assets`(`parent_id`, `name`, `title`, `lft`, `rgt`, `level`, `rules`) VALUES(1, 'com_scheduler.task.22', 'com_scheduler.task.22', @myLeft + 1, @myLeft + 2, 1, '{}'); +INSERT INTO `#__assets`(`parent_id`, `name`, `title`, `lft`, `rgt`, `level`, `rules`) VALUES(1, 'com_scheduler.task.1', 'com_scheduler.task.1', @myLeft + 1, @myLeft + 2, 1, '{}'); SET @last_id_in_assets = LAST_INSERT_ID(); -INSERT INTO `#__scheduler_tasks`(`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) -VALUES (1, @last_id_in_assets,'UpdateNotification','update.notification','{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"08:00"}', '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); - +INSERT INTO `#__scheduler_tasks`(`asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) +VALUES (@last_id_in_assets,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); -- -------------------------------------------------------- From eafd89a69044baaefe91b4d2e6f9524ca8e7bcb0 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 3 Jul 2023 19:36:39 +0200 Subject: [PATCH 19/63] hardcode-nestedset --- installation/sql/mysql/extensions.sql | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index eef54eeb088d4..60969d320a4d4 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,13 +925,8 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -SET @myLeft = (SELECT lft FROM `#__assets` WHERE id = 1); -UPDATE `#__assets` SET rgt = rgt + 2 WHERE rgt > @myLeft; -UPDATE `#__assets` SET lft = lft + 2 WHERE lft > @myLeft; -INSERT INTO `#__assets`(`parent_id`, `name`, `title`, `lft`, `rgt`, `level`, `rules`) VALUES(1, 'com_scheduler.task.1', 'com_scheduler.task.1', @myLeft + 1, @myLeft + 2, 1, '{}'); -SET @last_id_in_assets = LAST_INSERT_ID(); INSERT INTO `#__scheduler_tasks`(`asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) -VALUES (@last_id_in_assets,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); +VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); -- -------------------------------------------------------- From 8bfc52772c5955090bc8b7b66237855022ddc5f8 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 3 Jul 2023 19:40:45 +0200 Subject: [PATCH 20/63] hardcode-nestedset --- installation/sql/mysql/base.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 1894ece31daf2..776bd78824bab 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS `#__assets` ( -- INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `title`, `rules`) VALUES -(1, 0, 0, 177, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.api":{"8":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), +(1, 0, 0, 179, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.api":{"8":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), (3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), @@ -114,6 +114,7 @@ INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `titl (94, 1, 173, 174, 1, 'com_workflow', 'com_workflow', '{}'), (95, 1, 175, 176, 1, 'com_guidedtours', 'com_guidedtours', '{}'), (96, 18, 130, 131, 2, 'com_modules.module.109', 'Guided Tours', '{}'); +(97, 1, 177, 178, 1, 'com_scheduler.task.1', 'com_scheduler.task.1', '{}'); -- -------------------------------------------------------- From 21305b9aa723c6097813ff26d4be2042efa7ed13 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 3 Jul 2023 19:41:48 +0200 Subject: [PATCH 21/63] grr --- installation/sql/mysql/base.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index 776bd78824bab..3f3c107f2ab66 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -113,7 +113,7 @@ INSERT INTO `#__assets` (`id`, `parent_id`, `lft`, `rgt`, `level`, `name`, `titl (93, 1, 171, 172, 1, 'com_fields', 'com_fields', '{}'), (94, 1, 173, 174, 1, 'com_workflow', 'com_workflow', '{}'), (95, 1, 175, 176, 1, 'com_guidedtours', 'com_guidedtours', '{}'), -(96, 18, 130, 131, 2, 'com_modules.module.109', 'Guided Tours', '{}'); +(96, 18, 130, 131, 2, 'com_modules.module.109', 'Guided Tours', '{}'), (97, 1, 177, 178, 1, 'com_scheduler.task.1', 'com_scheduler.task.1', '{}'); -- -------------------------------------------------------- From 11c31362d35fabcd776818521dbda9fae966c9f6 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 3 Jul 2023 19:43:59 +0200 Subject: [PATCH 22/63] hardcode-nestedset --- installation/sql/postgresql/base.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index 10a808f23d6bf..5fc3205384b44 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -31,7 +31,7 @@ COMMENT ON COLUMN "#__assets"."rules" IS 'JSON encoded access control.'; -- INSERT INTO "#__assets" ("id", "parent_id", "lft", "rgt", "level", "name", "title", "rules") VALUES -(1, 0, 0, 177, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.api":{"8":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), +(1, 0, 0, 179, 0, 'root.1', 'Root Asset', '{"core.login.site":{"6":1,"2":1},"core.login.admin":{"6":1},"core.login.api":{"8":1},"core.login.offline":{"6":1},"core.admin":{"8":1},"core.manage":{"7":1},"core.create":{"6":1,"3":1},"core.delete":{"6":1},"core.edit":{"6":1,"4":1},"core.edit.state":{"6":1,"5":1},"core.edit.own":{"6":1,"3":1}}'), (2, 1, 1, 2, 1, 'com_admin', 'com_admin', '{}'), (3, 1, 3, 6, 1, 'com_banners', 'com_banners', '{"core.admin":{"7":1},"core.manage":{"6":1}}'), (4, 1, 7, 8, 1, 'com_cache', 'com_cache', '{"core.admin":{"7":1},"core.manage":{"7":1}}'), @@ -119,9 +119,10 @@ INSERT INTO "#__assets" ("id", "parent_id", "lft", "rgt", "level", "name", "titl (93, 1, 171, 172, 1, 'com_fields', 'com_fields', '{}'), (94, 1, 173, 174, 1, 'com_workflow', 'com_workflow', '{}'), (95, 1, 175, 176, 1, 'com_guidedtours', 'com_guidedtours', '{}'), -(96, 18, 130, 131, 2, 'com_modules.module.109', 'Guided Tours', '{}'); +(96, 18, 130, 131, 2, 'com_modules.module.109', 'Guided Tours', '{}'), +(97, 1, 177, 178, 1, 'com_scheduler.task.1', 'com_scheduler.task.1', '{}'); -SELECT setval('#__assets_id_seq', 97, false); +SELECT setval('#__assets_id_seq', 98, false); -- -- Table structure for table `#__extensions` From c3ff33add2eb919a07e9e23d30290716e7c2c12a Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 3 Jul 2023 19:52:23 +0200 Subject: [PATCH 23/63] hardcode-nestedset --- installation/sql/postgresql/extensions.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 0c91b45d1fd2f..6a35285dae415 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,6 +889,9 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); +INSERT INTO "test_scheduler_tasks"("asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") +VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); + -- -------------------------------------------------------- -- From 4a1ca8deb617ca51028367a64f1feb52f87b9ba6 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 3 Jul 2023 20:55:53 +0200 Subject: [PATCH 24/63] prefix --- installation/sql/postgresql/extensions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 6a35285dae415..208d383db7615 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,7 +889,7 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); -INSERT INTO "test_scheduler_tasks"("asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") +INSERT INTO "#__scheduler_tasks"("asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); -- -------------------------------------------------------- From a5c710d0727c8f4763d44b316c5d1f5d8e177c09 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Tue, 4 Jul 2023 09:06:18 +0200 Subject: [PATCH 25/63] fix pgsql --- installation/sql/postgresql/extensions.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 208d383db7615..a961e38a7b3d0 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -890,7 +890,8 @@ CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cl CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); INSERT INTO "#__scheduler_tasks"("asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") -VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); +VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); +SELECT setval('#__scheduler_tasks_id_seq', 2, false); -- -------------------------------------------------------- From be5bbe4513d173c926ed39a7c93bd445664a50e1 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Tue, 1 Aug 2023 19:26:51 +0200 Subject: [PATCH 26/63] Rename 5.0.0-2023-06-18.sql to 5.0.0-2023-08-04.sql shift --- .../mysql/{5.0.0-2023-06-18.sql => 5.0.0-2023-08-04.sql} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename administrator/components/com_admin/sql/updates/mysql/{5.0.0-2023-06-18.sql => 5.0.0-2023-08-04.sql} (92%) diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql similarity index 92% rename from administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql rename to administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql index 95045452c9831..23c8a089e1ae0 100644 --- a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-06-18.sql +++ b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql @@ -1,4 +1,4 @@ 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_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"]}'); \ No newline at end of file +('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'); From f6a8a28661d6c892b5c3f50169008723b2de2571 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Tue, 1 Aug 2023 19:27:25 +0200 Subject: [PATCH 27/63] Rename 5.0.0-2023-06-18.sql to 5.0.0-2023-08-04.sql shift --- .../postgresql/{5.0.0-2023-06-18.sql => 5.0.0-2023-08-04.sql} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename administrator/components/com_admin/sql/updates/postgresql/{5.0.0-2023-06-18.sql => 5.0.0-2023-08-04.sql} (92%) diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql similarity index 92% rename from administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql rename to administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql index bb60c85990d44..d82f0a80c86e7 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-06-18.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql @@ -1,4 +1,4 @@ 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_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"]}'); \ No newline at end of file +('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'); From c9b795b46db74512080de552f04c8c614ac606a3 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 6 Aug 2023 16:02:10 +0200 Subject: [PATCH 28/63] Update administrator/language/en-GB/plg_task_updatenotification.ini Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- administrator/language/en-GB/plg_task_updatenotification.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/administrator/language/en-GB/plg_task_updatenotification.ini b/administrator/language/en-GB/plg_task_updatenotification.ini index 91cfdef13d331..88d46b46aa34d 100644 --- a/administrator/language/en-GB/plg_task_updatenotification.ini +++ b/administrator/language/en-GB/plg_task_updatenotification.ini @@ -1,3 +1,8 @@ +; Joomla! Project +; (C) 2023 Open Source Matters, Inc. +; License GNU General Public License version 2 or later; see LICENSE.txt +; Note : All ini files need to be saved as UTF-8 + PLG_TASK_UPDATENOTIFICATION="Task - Joomla! Update Notification" PLG_TASK_UPDATENOTIFICATION_EMAIL_DESC="A comma separated list of the email addresses which will receive the update notification emails. The addresses in the list MUST belong to existing users of your site who have the Super User privilege. If none of the listed emails belongs to Super Users, or if it's left blank, all Super Users of this site will receive the update notification email." PLG_TASK_UPDATENOTIFICATION_EMAIL_LBL="Super User Emails" From c5740a463083d235c3750d3785b6ff7e41dc444b Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 7 Aug 2023 08:33:13 +0200 Subject: [PATCH 29/63] Update administrator/components/com_admin/script.php Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index ad891df693996..193ff8d510425 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -305,7 +305,7 @@ private function migrateUpdatenotificationPlugin($data) $paramsc = $component->getParams(); $cachetimeout = (int) $paramsc->get('cachetimeout', 6); $params = new Registry($data->params); - $lastrun = (int) $pluginParams->get('lastrun', 0); + $lastrun = (int) $params->get('lastrun', 0); /** @var SchedulerComponent $component */ $component = Factory::getApplication()->bootComponent('com_scheduler'); From cb76cc49dca7d65ee52987980858fa0a4ff14408 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 7 Aug 2023 08:33:32 +0200 Subject: [PATCH 30/63] Update administrator/language/en-GB/plg_task_updatenotification.ini Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- administrator/language/en-GB/plg_task_updatenotification.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/administrator/language/en-GB/plg_task_updatenotification.ini b/administrator/language/en-GB/plg_task_updatenotification.ini index 88d46b46aa34d..542f0dec25063 100644 --- a/administrator/language/en-GB/plg_task_updatenotification.ini +++ b/administrator/language/en-GB/plg_task_updatenotification.ini @@ -21,4 +21,6 @@ PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! pr ; {RELEASENEWS} URL to the release news on joomla.org ; \n Newline character. Use it to start a new line in the email. PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT="Joomla! Update available for {SITENAME} – {URL}" +PLG_TASK_UPDATENOTIFICATION_MAIL_MAIL_DESC="Sent to the site administrators when the "Joomla! Update Notification" task plugin detects an update." +PLG_TASK_UPDATENOTIFICATION_MAIL_MAIL_TITLE="Joomla: Update Notification" PLG_TASK_UPDATENOTIFICATION_XML_DESCRIPTION="This task periodically checks for the availability of new Joomla! versions. When one is found it will send you an email, reminding you to update. You can customise the email at System → Mail Templates." \ No newline at end of file From 8ad5ac31f30a90f7cac69a610ea9ad137c12096a Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 7 Aug 2023 08:33:46 +0200 Subject: [PATCH 31/63] Update plugins/task/updatenotification/services/provider.php Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- plugins/task/updatenotification/services/provider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task/updatenotification/services/provider.php b/plugins/task/updatenotification/services/provider.php index ef8693aa27514..a504d21c01d04 100644 --- a/plugins/task/updatenotification/services/provider.php +++ b/plugins/task/updatenotification/services/provider.php @@ -29,7 +29,7 @@ * * @since __DEPLOY_VERSION__ */ - public function register(Container $container) + public function register(Container $container): void { $container->set( PluginInterface::class, From 5269e509b4b7fba187819f10fb021b55599ebb1b Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 7 Aug 2023 08:34:32 +0200 Subject: [PATCH 32/63] Update plugins/task/updatenotification/forms/sendForm.xml Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- .../updatenotification/forms/sendForm.xml | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/task/updatenotification/forms/sendForm.xml b/plugins/task/updatenotification/forms/sendForm.xml index 440a8fb3cb62b..47fe0c72d808c 100644 --- a/plugins/task/updatenotification/forms/sendForm.xml +++ b/plugins/task/updatenotification/forms/sendForm.xml @@ -2,23 +2,23 @@
- - - - + + + +
From 737e8b9aef9f57c19ffef29720003cbc40fc455b Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 7 Aug 2023 08:34:52 +0200 Subject: [PATCH 33/63] Update administrator/language/en-GB/plg_task_updatenotification.ini Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- administrator/language/en-GB/plg_task_updatenotification.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/language/en-GB/plg_task_updatenotification.ini b/administrator/language/en-GB/plg_task_updatenotification.ini index 542f0dec25063..fdbff11059838 100644 --- a/administrator/language/en-GB/plg_task_updatenotification.ini +++ b/administrator/language/en-GB/plg_task_updatenotification.ini @@ -11,7 +11,7 @@ PLG_TASK_UPDATENOTIFICATION_SEND_DESC="This task periodically checks for the ava PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_DESC="Select a language for the update notification emails. Set to Auto to send them in the site language at the time." PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_LBL="Email Language" PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_NONE="Auto" -PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! project. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available for download.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}" +PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! project. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}" ; You can use the following merge codes: ; {NEWVERSION} New Joomla! version, e.g. 1.2.3 ; {CURVERSION} Currently installed Joomla! version, e.g. 1.2.0 From 2500b2eea6319acf7562ad87fa30f2ab7273ae49 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:13:33 +0200 Subject: [PATCH 34/63] remove old language files --- .../en-GB/plg_system_updatenotification.ini | 27 ------------------- .../plg_system_updatenotification.sys.ini | 7 ----- 2 files changed, 34 deletions(-) delete mode 100644 administrator/language/en-GB/plg_system_updatenotification.ini delete mode 100644 administrator/language/en-GB/plg_system_updatenotification.sys.ini diff --git a/administrator/language/en-GB/plg_system_updatenotification.ini b/administrator/language/en-GB/plg_system_updatenotification.ini deleted file mode 100644 index cb889bdb5f931..0000000000000 --- a/administrator/language/en-GB/plg_system_updatenotification.ini +++ /dev/null @@ -1,27 +0,0 @@ -; Joomla! Project -; (C) 2015 Open Source Matters, Inc. -; License GNU General Public License version 2 or later; see LICENSE.txt -; Note : All ini files need to be saved as UTF-8 - -PLG_SYSTEM_UPDATENOTIFICATION="System - Joomla! Update Notification" -PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! project. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}" -PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_DESC="A comma separated list of the email addresses which will receive the update notification emails. The addresses in the list MUST belong to existing users of your site who have the Super User privilege. If none of the listed emails belongs to Super Users, or if it's left blank, all Super Users of this site will receive the update notification email." -PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_LBL="Super User Emails" -; You can use the following merge codes: -; {NEWVERSION} New Joomla! version, e.g. 1.2.3 -; {CURVERSION} Currently installed Joomla! version, e.g. 1.2.0 -; {SITENAME} Site name, as set in Global Configuration. -; {URL} URL of the site's frontend page. -; {LINK} Update URL (link to com_joomlaupdate, will request login if the Super User isn't already logged in). -; {RELEASENEWS} URL to the release news on joomla.org -; \n Newline character. Use it to start a new line in the email. -PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT="Joomla! Update available for {SITENAME} – {URL}" -PLG_SYSTEM_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_DESC="Select a language for the update notification emails. Set to Auto to send them in the site language at the time." -PLG_SYSTEM_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_LBL="Email Language" -PLG_SYSTEM_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_NONE="Auto" -PLG_SYSTEM_UPDATENOTIFICATION_MAIL_MAIL_DESC="Sent to the site administrators when the "Joomla! Update Notification" system plugin detects an update." -PLG_SYSTEM_UPDATENOTIFICATION_MAIL_MAIL_TITLE="Joomla: Update Notification" -PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME="The Joomla! Update Notification will not run in this configuration" -PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION="Set it back to the default setting (6 Hours)" -PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY="

In your Installer Configuration you have set the Option Update Cache (in Hours) to 0 this means that Joomla is not caching the Update. This means an email should be sent on every page visit but this is not possible. Please increase the value (6 is default) or confirm that the Joomla! Update Notification will never send you mails.

" -PLG_SYSTEM_UPDATENOTIFICATION_XML_DESCRIPTION="This plugin periodically checks for the availability of new Joomla! versions. When one is found it will send you an email, reminding you to update. You can customise the email at System → Mail Templates." diff --git a/administrator/language/en-GB/plg_system_updatenotification.sys.ini b/administrator/language/en-GB/plg_system_updatenotification.sys.ini deleted file mode 100644 index 705dcc576acc3..0000000000000 --- a/administrator/language/en-GB/plg_system_updatenotification.sys.ini +++ /dev/null @@ -1,7 +0,0 @@ -; Joomla! Project -; (C) 2015 Open Source Matters, Inc. -; License GNU General Public License version 2 or later; see LICENSE.txt -; Note : All ini files need to be saved as UTF-8 - -PLG_SYSTEM_UPDATENOTIFICATION="System - Joomla! Update Notification" -PLG_SYSTEM_UPDATENOTIFICATION_XML_DESCRIPTION="This plugin periodically checks for the availability of new Joomla! versions. When one is found it will send you an email, reminding you to update. You can customise the email at System → Mail Templates." From 4ba9f45dd9c182099a45d5d61a39e90f8b8a0984 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:13:59 +0200 Subject: [PATCH 35/63] add mail template for new installations --- installation/sql/mysql/supports.sql | 2 +- installation/sql/postgresql/supports.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installation/sql/mysql/supports.sql b/installation/sql/mysql/supports.sql index 034682c5a2bfc..c6c49b02a6d7e 100644 --- a/installation/sql/mysql/supports.sql +++ b/installation/sql/mysql/supports.sql @@ -416,7 +416,7 @@ INSERT INTO `#__mail_templates` (`template_id`, `extension`, `language`, `subjec ('com_users.massmail.mail', 'com_users', '', 'COM_USERS_MASSMAIL_MAIL_SUBJECT', 'COM_USERS_MASSMAIL_MAIL_BODY', '', '', '{"tags":["subject","body","subjectprefix","bodysuffix"]}'), ('com_users.password_reset', 'com_users', '', 'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', 'COM_USERS_EMAIL_PASSWORD_RESET_BODY', '', '', '{"tags":["name","email","sitename","link_text","link_html","token"]}'), ('com_users.reminder', 'com_users','', 'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', 'COM_USERS_EMAIL_USERNAME_REMINDER_BODY', '', '', '{"tags":["name","username","sitename","email","link_text","link_html"]}'), -('plg_system_updatenotification.mail', 'plg_system_updatenotification', '', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'), +('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'), ('plg_user_joomla.mail', 'plg_user_joomla', '', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', '', '', '{"tags":["name","sitename","url","username","password","email"]}'), ('com_actionlogs.notification', 'com_actionlogs', '', 'COM_ACTIONLOGS_EMAIL_SUBJECT', 'COM_ACTIONLOGS_EMAIL_BODY', 'COM_ACTIONLOGS_EMAIL_HTMLBODY', '', '{"tags":["message","date","extension","username"]}'), ('com_privacy.userdataexport', 'com_privacy', '', 'COM_PRIVACY_EMAIL_DATA_EXPORT_COMPLETED_SUBJECT', 'COM_PRIVACY_EMAIL_DATA_EXPORT_COMPLETED_BODY', '', '', '{"tags":["sitename","url"]}'), diff --git a/installation/sql/postgresql/supports.sql b/installation/sql/postgresql/supports.sql index 8a00c79fff6c7..468e1eec8ce4b 100644 --- a/installation/sql/postgresql/supports.sql +++ b/installation/sql/postgresql/supports.sql @@ -427,7 +427,7 @@ INSERT INTO "#__mail_templates" ("template_id", "extension", "language", "subjec ('com_users.massmail.mail', 'com_users', '', 'COM_USERS_MASSMAIL_MAIL_SUBJECT', 'COM_USERS_MASSMAIL_MAIL_BODY', '', '', '{"tags":["subject","body","subjectprefix","bodysuffix"]}'), ('com_users.password_reset', 'com_users', '', 'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', 'COM_USERS_EMAIL_PASSWORD_RESET_BODY', '', '', '{"tags":["name","email","sitename","link_text","link_html","token"]}'), ('com_users.reminder', 'com_users', '', 'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', 'COM_USERS_EMAIL_USERNAME_REMINDER_BODY', '', '', '{"tags":["name","username","sitename","email","link_text","link_html"]}'), -('plg_system_updatenotification.mail', 'plg_system_updatenotification', '', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_SYSTEM_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'), +('plg_task_updatenotification.mail', 'plg_task_updatenotification', '', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_SUBJECT', 'PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY', '', '', '{"tags":["newversion","curversion","sitename","url","link","releasenews"]}'), ('plg_user_joomla.mail', 'plg_user_joomla', '', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_SUBJECT', 'PLG_USER_JOOMLA_NEW_USER_EMAIL_BODY', '', '', '{"tags":["name","sitename","url","username","password","email"]}'), ('com_actionlogs.notification', 'com_actionlogs', '', 'COM_ACTIONLOGS_EMAIL_SUBJECT', 'COM_ACTIONLOGS_EMAIL_BODY', 'COM_ACTIONLOGS_EMAIL_HTMLBODY', '', '{"tags":["message","date","extension","username"]}'), ('com_privacy.userdataexport', 'com_privacy', '', 'COM_PRIVACY_EMAIL_DATA_EXPORT_COMPLETED_SUBJECT', 'COM_PRIVACY_EMAIL_DATA_EXPORT_COMPLETED_BODY', '', '', '{"tags":["sitename","url"]}'), From c67b05a79c585e45b4da82432a24be16e207d293 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:14:54 +0200 Subject: [PATCH 36/63] remove postinstall message --- .../components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql | 1 + .../com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql | 1 + installation/sql/mysql/supports.sql | 2 -- installation/sql/postgresql/supports.sql | 2 -- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql index 23c8a089e1ae0..3a57815d9addd 100644 --- a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql +++ b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql @@ -2,3 +2,4 @@ INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, ` ('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 `#__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-08-04.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql index d82f0a80c86e7..f79dedf831b6c 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql @@ -2,3 +2,4 @@ INSERT INTO "#__extensions" ("name", "type", "element", "folder", "client_id", " ('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 "#__postinstall_messages" WHERE "condition_file" = 'site://plugins/system/updatenotification/postinstall/updatecachetime.php'; diff --git a/installation/sql/mysql/supports.sql b/installation/sql/mysql/supports.sql index c6c49b02a6d7e..f7252db7465a9 100644 --- a/installation/sql/mysql/supports.sql +++ b/installation/sql/mysql/supports.sql @@ -275,8 +275,6 @@ SELECT `extension_id`, 'COM_CPANEL_WELCOME_BEGINNERS_TITLE', 'COM_CPANEL_WELCOME INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) SELECT `extension_id`, 'COM_CPANEL_MSG_STATS_COLLECTION_TITLE', 'COM_CPANEL_MSG_STATS_COLLECTION_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/statscollection.php', 'admin_postinstall_statscollection_condition', '3.5.0', 1 FROM `#__extensions` WHERE `name` = 'files_joomla'; INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) -SELECT `extension_id`, 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1 FROM `#__extensions` WHERE `name` = 'files_joomla'; -INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) SELECT `extension_id`, 'PLG_SYSTEM_HTTPHEADERS_POSTINSTALL_INTRODUCTION_TITLE', 'PLG_SYSTEM_HTTPHEADERS_POSTINSTALL_INTRODUCTION_BODY', 'PLG_SYSTEM_HTTPHEADERS_POSTINSTALL_INTRODUCTION_ACTION', 'plg_system_httpheaders', 1, 'action', 'site://plugins/system/httpheaders/postinstall/introduction.php', 'httpheaders_postinstall_action', 'site://plugins/system/httpheaders/postinstall/introduction.php', 'httpheaders_postinstall_condition', '4.0.0', 1 FROM `#__extensions` WHERE `name` = 'files_joomla'; INSERT INTO `#__postinstall_messages` (`extension_id`, `title_key`, `description_key`, `action_key`, `language_extension`, `language_client_id`, `type`, `action_file`, `action`, `condition_file`, `condition_method`, `version_introduced`, `enabled`) SELECT `extension_id`, 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_TITLE', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_BODY', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_ACTION', 'com_users', 1, 'action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_condition', '4.2.0', 1 FROM `#__extensions` WHERE `name` = 'files_joomla'; diff --git a/installation/sql/postgresql/supports.sql b/installation/sql/postgresql/supports.sql index 468e1eec8ce4b..1ad64316c3c23 100644 --- a/installation/sql/postgresql/supports.sql +++ b/installation/sql/postgresql/supports.sql @@ -286,8 +286,6 @@ SELECT "extension_id", 'COM_CPANEL_WELCOME_BEGINNERS_TITLE', 'COM_CPANEL_WELCOME INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") SELECT "extension_id", 'COM_CPANEL_MSG_STATS_COLLECTION_TITLE', 'COM_CPANEL_MSG_STATS_COLLECTION_BODY', '', 'com_cpanel', 1, 'message', '', '', 'admin://components/com_admin/postinstall/statscollection.php', 'admin_postinstall_statscollection_condition', '3.5.0', 1 FROM "#__extensions" WHERE "name" = 'files_joomla'; INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") -SELECT "extension_id", 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_BODY', 'PLG_SYSTEM_UPDATENOTIFICATION_POSTINSTALL_UPDATECACHETIME_ACTION', 'plg_system_updatenotification', 1, 'action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_action', 'site://plugins/system/updatenotification/postinstall/updatecachetime.php', 'updatecachetime_postinstall_condition', '3.6.3', 1 FROM "#__extensions" WHERE "name" = 'files_joomla'; -INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") SELECT "extension_id", 'PLG_SYSTEM_HTTPHEADERS_POSTINSTALL_INTRODUCTION_TITLE', 'PLG_SYSTEM_HTTPHEADERS_POSTINSTALL_INTRODUCTION_BODY', 'PLG_SYSTEM_HTTPHEADERS_POSTINSTALL_INTRODUCTION_ACTION', 'plg_system_httpheaders', 1, 'action', 'site://plugins/system/httpheaders/postinstall/introduction.php', 'httpheaders_postinstall_action', 'site://plugins/system/httpheaders/postinstall/introduction.php', 'httpheaders_postinstall_condition', '4.0.0', 1 FROM "#__extensions" WHERE "name" = 'files_joomla'; INSERT INTO "#__postinstall_messages" ("extension_id", "title_key", "description_key", "action_key", "language_extension", "language_client_id", "type", "action_file", "action", "condition_file", "condition_method", "version_introduced", "enabled") SELECT "extension_id", 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_TITLE', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_BODY', 'COM_USERS_POSTINSTALL_MULTIFACTORAUTH_ACTION', 'com_users', 1, 'action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_action', 'admin://components/com_users/postinstall/multifactorauth.php', 'com_users_postinstall_mfa_condition', '4.2.0', 1 FROM "#__extensions" WHERE "name" = 'files_joomla'; From 43dfb68a894b84ea844bd87e5f9fb068ba7adc80 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:43:58 +0200 Subject: [PATCH 37/63] alphasort --- .../updatenotification/src/Extension/UpdateNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 120a40bf5a399..19f7a1d1fb64b 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -15,9 +15,9 @@ use Joomla\CMS\Mail\Exception\MailDisabledException; use Joomla\CMS\Mail\MailTemplate; use Joomla\CMS\Plugin\CMSPlugin; +use Joomla\CMS\Table\Table; use Joomla\CMS\Updater\Updater; use Joomla\CMS\Uri\Uri; -use Joomla\CMS\Table\Table; use Joomla\CMS\Version; use Joomla\Component\Scheduler\Administrator\Event\ExecuteTaskEvent; use Joomla\Component\Scheduler\Administrator\Task\Status; From 35e486b17c5a7a790e1a46bcee05034e1953e999 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:44:21 +0200 Subject: [PATCH 38/63] upper case see line 203 --- .../updatenotification/src/Extension/UpdateNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 19f7a1d1fb64b..fc8b0dce26be3 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -25,7 +25,7 @@ use Joomla\Database\DatabaseAwareTrait; use Joomla\Database\ParameterType; use Joomla\Event\SubscriberInterface; -use PHPMailer\PHPMailer\Exception as phpmailerException; +use PHPMailer\PHPMailer\Exception as phpMailerException; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; From 485cd0e5a3978972477122a3bc0c636bbd9f1317 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:44:35 +0200 Subject: [PATCH 39/63] class Text not imported --- .../updatenotification/src/Extension/UpdateNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index fc8b0dce26be3..5f064f73706ac 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -202,7 +202,7 @@ private function sendNotification(ExecuteTaskEvent $event): int $mailer->send(); } catch (MailDisabledException | phpMailerException $exception) { try { - $this->logTask(Text::_($exception->getMessage())); + $this->logTask($this->text($exception->getMessage())); } catch (\RuntimeException $exception) { return Status::KNOCKOUT; } From ed00600e9eda8bdf399749d214a726ad10fc20a9 Mon Sep 17 00:00:00 2001 From: alikon Date: Thu, 10 Aug 2023 17:24:43 +0200 Subject: [PATCH 40/63] feedback from session gc --- installation/sql/mysql/extensions.sql | 4 ++-- installation/sql/postgresql/extensions.sql | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index d642d01ced2e3..2f03a79e56e4c 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,8 +925,8 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -INSERT INTO `#__scheduler_tasks`(`asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) -VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); +INSERT INTO `#__scheduler_tasks`(`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) +VALUES (1, 97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); -- -------------------------------------------------------- diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 383019cdbe8c2..e206c5ecd64cd 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,8 +889,9 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); -INSERT INTO "#__scheduler_tasks"("asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") -VALUES (97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); +INSERT INTO "#__scheduler_tasks"("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") +VALUES (1, 97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); + SELECT setval('#__scheduler_tasks_id_seq', 2, false); -- -------------------------------------------------------- From a5f9c11b82be8a3967a56d0190f075a2016d7856 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:27:18 +0200 Subject: [PATCH 41/63] remove old mail template on update --- .../components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql | 1 + .../com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql index 3a57815d9addd..fedce0a7dfaf3 100644 --- a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql +++ b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql @@ -2,4 +2,5 @@ INSERT INTO `#__extensions` (`name`, `type`, `element`, `folder`, `client_id`, ` ('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-08-04.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql index f79dedf831b6c..276d7d87668d6 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql @@ -2,4 +2,5 @@ INSERT INTO "#__extensions" ("name", "type", "element", "folder", "client_id", " ('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'; From 354a74bdb0c9273fc5e2c5d36955e8861b46caaa Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:32:30 +0200 Subject: [PATCH 42/63] set created_by for new task --- installation/sql/mysql/extensions.sql | 4 ++-- installation/sql/postgresql/extensions.sql | 4 ++-- installation/src/Model/ConfigurationModel.php | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index 2f03a79e56e4c..aea8b1258e67f 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,8 +925,8 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -INSERT INTO `#__scheduler_tasks`(`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`) -VALUES (1, 97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now()); +INSERT INTO `#__scheduler_tasks`(`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`, `created_by`) +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now(), 42); -- -------------------------------------------------------- diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index e206c5ecd64cd..76a4adc61505d 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,8 +889,8 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); -INSERT INTO "#__scheduler_tasks"("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created") -VALUES (1, 97,'UpdateNotification','update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP); +INSERT INTO "#__scheduler_tasks"("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created", "created_by") +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP, 42); SELECT setval('#__scheduler_tasks_id_seq', 2, false); diff --git a/installation/src/Model/ConfigurationModel.php b/installation/src/Model/ConfigurationModel.php index dd89d93970271..257eab32816ee 100644 --- a/installation/src/Model/ConfigurationModel.php +++ b/installation/src/Model/ConfigurationModel.php @@ -277,9 +277,10 @@ protected function updateUserIds($db) // Update all core tables created_by fields of the tables with the random user id. $updatesArray = [ - '#__categories' => ['created_user_id', 'modified_user_id'], - '#__tags' => ['created_user_id', 'modified_user_id'], - '#__workflows' => ['created_by', 'modified_by'], + '#__categories' => ['created_user_id', 'modified_user_id'], + '#__scheduler_tasks' => ['created_by'], + '#__tags' => ['created_user_id', 'modified_user_id'], + '#__workflows' => ['created_by', 'modified_by'], ]; foreach ($updatesArray as $table => $fields) { From 9a51eca283127f19ebf56b29e97cff2203159dc7 Mon Sep 17 00:00:00 2001 From: Christian Heel <66922325+heelc29@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:32:35 +0200 Subject: [PATCH 43/63] cs --- .../updatenotification/src/Extension/UpdateNotification.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 5f064f73706ac..95cd147a8baba 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -89,7 +89,7 @@ public static function getSubscribedEvents(): array private function sendNotification(ExecuteTaskEvent $event): int { // Load the parameters. - $specificEmail = $event->getArgument('params')->email ?? ''; + $specificEmail = $event->getArgument('params')->email ?? ''; $forcedLanguage = $event->getArgument('params')->language_override ?? ''; // This is the extension ID for Joomla! itself @@ -146,7 +146,7 @@ private function sendNotification(ExecuteTaskEvent $event): int $this->getApplication()->triggerEvent('onBuildAdministratorLoginURL', [&$uri]); // Let's find out the email addresses to notify - $superUsers = []; + $superUsers = []; if (!empty($specificEmail)) { $superUsers = $this->getSuperUsers($specificEmail); From 58dd800aefb401a4d43eae2a72b8c5d193fa96aa Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sat, 12 Aug 2023 10:49:29 +0200 Subject: [PATCH 44/63] exec-day --- administrator/components/com_admin/script.php | 1 + 1 file changed, 1 insertion(+) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 193ff8d510425..f2afda7ed8fc0 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -319,6 +319,7 @@ private function migrateUpdatenotificationPlugin($data) 'rule-type' => 'interval-hours', 'interval-hours' => $cachetimeout, 'exec-time' => gmdate("H:i", $lastrun), + 'exec-day' => gmdate('d'), ], 'state' => 1, 'params' => [ From 682e7e2fd13f040a68aa17a4a452d113de86ab76 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sun, 13 Aug 2023 10:22:38 +0200 Subject: [PATCH 45/63] Update administrator/components/com_admin/script.php Co-authored-by: Richard Fath --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index f2afda7ed8fc0..461f29f50d01d 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -288,7 +288,7 @@ protected function uninstallExtensions() /** * This method is for migration for old updatenotification system plugin migration to task. * - * @param \stdClass $data Object with `extension_id` and `params` of the extension + * @param \stdClass $data Object with the extension's record in the `#__extensions` table * * @return void * From 6f4a33361755dcb180528c8cb18e5e6c8aca13fa Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sat, 26 Aug 2023 07:40:51 +0200 Subject: [PATCH 46/63] Rename 5.0.0-2023-08-04.sql to 5.0.0-2023-08-24.sql --- .../updates/mysql/{5.0.0-2023-08-04.sql => 5.0.0-2023-08-24.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename administrator/components/com_admin/sql/updates/mysql/{5.0.0-2023-08-04.sql => 5.0.0-2023-08-24.sql} (100%) diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-24.sql similarity index 100% rename from administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-04.sql rename to administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-24.sql From 553b06b290131fe1743a99dc3e37a6fd5cca4737 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Sat, 26 Aug 2023 07:41:15 +0200 Subject: [PATCH 47/63] Rename 5.0.0-2023-08-04.sql to 5.0.0-2023-08-24.sql --- .../postgresql/{5.0.0-2023-08-04.sql => 5.0.0-2023-08-24.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename administrator/components/com_admin/sql/updates/postgresql/{5.0.0-2023-08-04.sql => 5.0.0-2023-08-24.sql} (100%) diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-24.sql similarity index 100% rename from administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-04.sql rename to administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-24.sql From 0313d90f83d03d342f29d6bb36d1f39bb6a0da41 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Fri, 1 Sep 2023 13:54:50 +0200 Subject: [PATCH 48/63] Rename 5.0.0-2023-08-24.sql to 5.0.0-2023-08-30.sql --- .../updates/mysql/{5.0.0-2023-08-24.sql => 5.0.0-2023-08-30.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename administrator/components/com_admin/sql/updates/mysql/{5.0.0-2023-08-24.sql => 5.0.0-2023-08-30.sql} (100%) diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-24.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-30.sql similarity index 100% rename from administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-24.sql rename to administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-30.sql From 45d8cbe5e4db3e465520eb44f8b6c75972af2576 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Fri, 1 Sep 2023 13:55:34 +0200 Subject: [PATCH 49/63] Rename 5.0.0-2023-08-24.sql to 5.0.0-2023-08-30.sql --- .../postgresql/{5.0.0-2023-08-24.sql => 5.0.0-2023-08-30.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename administrator/components/com_admin/sql/updates/postgresql/{5.0.0-2023-08-24.sql => 5.0.0-2023-08-30.sql} (100%) diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-24.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-30.sql similarity index 100% rename from administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-24.sql rename to administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-30.sql From 7ab7fcfe709c758de511defb0134308a6a124c9f Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Fri, 1 Sep 2023 14:05:10 +0200 Subject: [PATCH 50/63] SQL CS --- installation/sql/mysql/extensions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index aea8b1258e67f..03475f563ce24 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,7 +925,7 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -INSERT INTO `#__scheduler_tasks`(`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`, `created_by`) +INSERT INTO `#__scheduler_tasks` (`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`, `created_by`) VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now(), 42); -- -------------------------------------------------------- From ee9c042eaa390bd570adca55353f8ad2b235e071 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Fri, 1 Sep 2023 14:05:30 +0200 Subject: [PATCH 51/63] SQL CS --- installation/sql/postgresql/extensions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 76a4adc61505d..d25d4523972a2 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,7 +889,7 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); -INSERT INTO "#__scheduler_tasks"("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created", "created_by") +INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created", "created_by") VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP, 42); SELECT setval('#__scheduler_tasks_id_seq', 2, false); From 6458a2ee0375105a7ed413c227fcbe529445e1c9 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Fri, 1 Sep 2023 15:44:18 +0200 Subject: [PATCH 52/63] Fix plugin name in email body --- administrator/language/en-GB/plg_task_updatenotification.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/language/en-GB/plg_task_updatenotification.ini b/administrator/language/en-GB/plg_task_updatenotification.ini index fdbff11059838..49a91ff4e443b 100644 --- a/administrator/language/en-GB/plg_task_updatenotification.ini +++ b/administrator/language/en-GB/plg_task_updatenotification.ini @@ -11,7 +11,7 @@ PLG_TASK_UPDATENOTIFICATION_SEND_DESC="This task periodically checks for the ava PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_DESC="Select a language for the update notification emails. Set to Auto to send them in the site language at the time." PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_LBL="Email Language" PLG_TASK_UPDATENOTIFICATION_LANGUAGE_OVERRIDE_NONE="Auto" -PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! project. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'System - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}" +PLG_TASK_UPDATENOTIFICATION_EMAIL_BODY="This email IS NOT sent by the Joomla! project. It is sent automatically by your own site,\n{SITENAME} - {URL} \n\n================================================================================\nUPDATE INFORMATION\n================================================================================\n\nYour site has discovered that there is an updated version of Joomla! available.\n\nJoomla! version currently installed: {CURVERSION}\nJoomla! version available for installation: {NEWVERSION}\n\nThis email is sent to you by your site to remind you of this fact.\nThe Joomla! project will never contact you directly about available updates of Joomla! on your site.\n\n================================================================================\nUPDATE INSTRUCTIONS\n================================================================================\n\nTo install the update on {SITENAME} please select the following link. (If the URL is not a link, copy & paste it to your browser).\n\nUpdate link: {LINK}\n\nRelease News can be found here: {RELEASENEWS}\n\n================================================================================\nWHY AM I RECEIVING THIS EMAIL?\n================================================================================\n\nThis email has been automatically sent by a plugin provided by Joomla!, the software which powers your site.\nThis plugin looks for updated versions of Joomla! and sends an email notification to its administrators.\nYou will receive several similar emails from your site until you either update the software or disable these emails.\n\nTo disable these emails, please unpublish the 'Task - Joomla! Update Notification' plugin in the Plugin Manager on your site.\n\nIf you do not understand what Joomla! is and what you need to do please do not contact the Joomla! project.\nThey are NOT sending you this email and they cannot help you. Instead, please contact the person who built or manages your site.\n\nIf you are the person who built or manages your website, please note that this plugin may have been activated automatically when you installed or updated Joomla! on your site.\n\n================================================================================\nWHO SENT ME THIS EMAIL?\n================================================================================\n\nThis email is sent to you by your own site, {SITENAME}" ; You can use the following merge codes: ; {NEWVERSION} New Joomla! version, e.g. 1.2.3 ; {CURVERSION} Currently installed Joomla! version, e.g. 1.2.0 From c6f1cd8a052007d3db72f307a02f3293380ea868 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 11:28:17 +0200 Subject: [PATCH 53/63] Single quotes Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 52d2b48505bf3..49f147902b7e0 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -346,7 +346,7 @@ private function migrateUpdatenotificationPlugin($data) 'execution_rules' => [ 'rule-type' => 'interval-hours', 'interval-hours' => $cachetimeout, - 'exec-time' => gmdate("H:i", $lastrun), + 'exec-time' => gmdate('H:i', $lastrun), 'exec-day' => gmdate('d'), ], 'state' => 1, From 825bd907d2418eab825a71da5216bbc05cbac97b Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 11:56:04 +0200 Subject: [PATCH 54/63] Revert text function for plugins --- .../updatenotification/src/Extension/UpdateNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 95cd147a8baba..3817abead9b8b 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -202,7 +202,7 @@ private function sendNotification(ExecuteTaskEvent $event): int $mailer->send(); } catch (MailDisabledException | phpMailerException $exception) { try { - $this->logTask($this->text($exception->getMessage())); + $this->logTask($jLanguage->_($exception->getMessage())); } catch (\RuntimeException $exception) { return Status::KNOCKOUT; } From 06c11a72b1c6e064453d81fb92faf069d0be08e5 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 12:44:48 +0200 Subject: [PATCH 55/63] Remove extra reference assignment for dispatcher argument Co-authored-by: heelc29 <66922325+heelc29@users.noreply.github.com> --- plugins/task/updatenotification/services/provider.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/task/updatenotification/services/provider.php b/plugins/task/updatenotification/services/provider.php index a504d21c01d04..ee30840167ba3 100644 --- a/plugins/task/updatenotification/services/provider.php +++ b/plugins/task/updatenotification/services/provider.php @@ -34,10 +34,8 @@ public function register(Container $container): void $container->set( PluginInterface::class, function (Container $container) { - $dispatcher = $container->get(DispatcherInterface::class); - $plugin = new UpdateNotification( - $dispatcher, + $container->get(DispatcherInterface::class), (array) PluginHelper::getPlugin('task', 'updatenotification') ); $plugin->setApplication(Factory::getApplication()); From 122813e002c26421da7d3c6d2545662302721dd3 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 14:16:42 +0200 Subject: [PATCH 56/63] Set last and next execution and locked of task on new installation --- installation/sql/mysql/extensions.sql | 4 ++-- installation/sql/postgresql/extensions.sql | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index 03475f563ce24..0c9a3883064e9 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,8 +925,8 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -INSERT INTO `#__scheduler_tasks` (`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_exit_code`, `params`, `created`, `created_by`) -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', now(), 42); +INSERT INTO `#__scheduler_tasks` (`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `last_execution`, `next_execution`, `locked`, `params`, `created`) +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', NULL, DATE_FORMAT(NOW() + INTERVAL 24 HOUR, '%Y-%m-%d %H:00:00'), NULL, '{}', NOW()); -- -------------------------------------------------------- diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index d25d4523972a2..daba2cda89d5a 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,8 +889,9 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); -INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_exit_code", "params", "created", "created_by") -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, 0, '{}', CURRENT_TIMESTAMP, 42); +INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "last_execution", "next_execution", "locked", "params", "created") +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP); + SELECT setval('#__scheduler_tasks_id_seq', 2, false); From 27ba35c5a81e81e13bccf18aafd92d544f433d3f Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 14:29:23 +0200 Subject: [PATCH 57/63] SQL CS --- installation/sql/postgresql/extensions.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index daba2cda89d5a..5f16a1339ee59 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -892,7 +892,6 @@ CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("chec INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "last_execution", "next_execution", "locked", "params", "created") VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP); - SELECT setval('#__scheduler_tasks_id_seq', 2, false); -- -------------------------------------------------------- From e8d34765b79cecab41dc825ddd672e008624678b Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 15:52:55 +0200 Subject: [PATCH 58/63] Task should be enabled on a new installation --- installation/sql/mysql/extensions.sql | 4 ++-- installation/sql/postgresql/extensions.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index 0c9a3883064e9..495c9bfb0c1a5 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -925,8 +925,8 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( KEY `idx_checked_out` (`checked_out`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; -INSERT INTO `#__scheduler_tasks` (`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `last_execution`, `next_execution`, `locked`, `params`, `created`) -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', NULL, DATE_FORMAT(NOW() + INTERVAL 24 HOUR, '%Y-%m-%d %H:00:00'), NULL, '{}', NOW()); +INSERT INTO `#__scheduler_tasks` (`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_execution`, `next_execution`, `locked`, `params`, `created`) +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, DATE_FORMAT(NOW() + INTERVAL 24 HOUR, '%Y-%m-%d %H:00:00'), NULL, '{}', NOW()); -- -------------------------------------------------------- diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 5f16a1339ee59..33d9aebf4ff2d 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -889,8 +889,8 @@ CREATE INDEX "#__scheduler_tasks_idx_priority" ON "#__scheduler_tasks" ("priorit CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cli_exclusive"); CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); -INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "last_execution", "next_execution", "locked", "params", "created") -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP); +INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_execution", "next_execution", "locked", "params", "created") +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP); SELECT setval('#__scheduler_tasks_id_seq', 2, false); From dd8d54ce2ab016c4668b35a6281d4b2f149fbe79 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 16:27:49 +0200 Subject: [PATCH 59/63] Make sure to have UTC timestamps on PostgreSQL --- installation/sql/postgresql/extensions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index 33d9aebf4ff2d..c5dda4d5462b1 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -890,7 +890,7 @@ CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cl CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_execution", "next_execution", "locked", "params", "created") -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP, 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP); +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP AT TIME ZONE 'UTC', 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP AT TIME ZONE 'UTC' + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP AT TIME ZONE 'UTC'); SELECT setval('#__scheduler_tasks_id_seq', 2, false); From 94fde83b7bc5846bf137f069ee2a1ae4cd4fd5ca Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 16:45:40 +0200 Subject: [PATCH 60/63] Rename 5.0.0-2023-08-30.sql to 5.0.0-2023-09-02.sql --- .../updates/mysql/{5.0.0-2023-08-30.sql => 5.0.0-2023-09-02.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename administrator/components/com_admin/sql/updates/mysql/{5.0.0-2023-08-30.sql => 5.0.0-2023-09-02.sql} (100%) diff --git a/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-30.sql b/administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-09-02.sql similarity index 100% rename from administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-08-30.sql rename to administrator/components/com_admin/sql/updates/mysql/5.0.0-2023-09-02.sql From b9d179430f12ce34e46e51cad1ac8efc96c16c44 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 2 Sep 2023 16:45:59 +0200 Subject: [PATCH 61/63] Rename 5.0.0-2023-08-30.sql to 5.0.0-2023-09-02.sql --- .../postgresql/{5.0.0-2023-08-30.sql => 5.0.0-2023-09-02.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename administrator/components/com_admin/sql/updates/postgresql/{5.0.0-2023-08-30.sql => 5.0.0-2023-09-02.sql} (100%) diff --git a/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-30.sql b/administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-09-02.sql similarity index 100% rename from administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-08-30.sql rename to administrator/components/com_admin/sql/updates/postgresql/5.0.0-2023-09-02.sql From 858f4d35796ff9f0ce2775a767eabf202e423a22 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sun, 3 Sep 2023 12:20:45 +0200 Subject: [PATCH 62/63] Fix lastrun default on update --- administrator/components/com_admin/script.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 2a7e14821e7c5..fd7b8c35a357a 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -336,7 +336,7 @@ private function migrateUpdatenotificationPlugin($data) $paramsc = $component->getParams(); $cachetimeout = (int) $paramsc->get('cachetimeout', 6); $params = new Registry($data->params); - $lastrun = (int) $params->get('lastrun', 0); + $lastrun = (int) $params->get('lastrun', time()); /** @var SchedulerComponent $component */ $component = Factory::getApplication()->bootComponent('com_scheduler'); From 9a0d63fca00670555691b4ec3b6eb7b908d02dc9 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sun, 3 Sep 2023 12:46:21 +0200 Subject: [PATCH 63/63] Add parameters to SQL insert of task --- installation/sql/mysql/extensions.sql | 2 +- installation/sql/postgresql/extensions.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/installation/sql/mysql/extensions.sql b/installation/sql/mysql/extensions.sql index ac19a7fee822a..0a34765852460 100644 --- a/installation/sql/mysql/extensions.sql +++ b/installation/sql/mysql/extensions.sql @@ -926,7 +926,7 @@ CREATE TABLE IF NOT EXISTS `#__scheduler_tasks` ( ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 DEFAULT COLLATE = utf8mb4_unicode_ci; INSERT INTO `#__scheduler_tasks` (`id`, `asset_id`, `title`, `type`, `execution_rules`, `cron_rules`, `state`, `last_execution`, `next_execution`, `locked`, `params`, `created`) -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, DATE_FORMAT(NOW() + INTERVAL 24 HOUR, '%Y-%m-%d %H:00:00'), NULL, '{}', NOW()); +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TIME_FORMAT(NOW(), '%H:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, DATE_FORMAT(NOW() + INTERVAL 24 HOUR, '%Y-%m-%d %H:00:00'), NULL, '{"individual_log":false,"log_file":"","notifications":{"success_mail":"0","failure_mail":"1","fatal_failure_mail":"1","orphan_mail":"1"},"email":"","language_override":""}', NOW()); -- -------------------------------------------------------- diff --git a/installation/sql/postgresql/extensions.sql b/installation/sql/postgresql/extensions.sql index ffc9556ccdfd4..acc3ccbbdc12f 100644 --- a/installation/sql/postgresql/extensions.sql +++ b/installation/sql/postgresql/extensions.sql @@ -890,7 +890,7 @@ CREATE INDEX "#__scheduler_tasks_idx_cli_exclusive" ON "#__scheduler_tasks" ("cl CREATE INDEX "#__scheduler_tasks_idx_checked_out" ON "#__scheduler_tasks" ("checked_out"); INSERT INTO "#__scheduler_tasks" ("id", "asset_id", "title", "type", "execution_rules", "cron_rules", "state", "last_execution", "next_execution", "locked", "params", "created") -VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP AT TIME ZONE 'UTC', 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP AT TIME ZONE 'UTC' + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{}', CURRENT_TIMESTAMP AT TIME ZONE 'UTC'); +VALUES (1, 97, 'UpdateNotification', 'update.notification', CONCAT('{"rule-type":"interval-hours","interval-hours":"24","exec-day":"01","exec-time":"', TO_CHAR(CURRENT_TIMESTAMP AT TIME ZONE 'UTC', 'HH24:00'), '"}'), '{"type":"interval","exp":"PT24H"}', 1, NULL, TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP AT TIME ZONE 'UTC' + INTERVAL '24 hours', 'YYYY-MM-DD HH24:00:00'), 'YYYY-MM-DD HH24:MI:SS'), NULL, '{"individual_log":false,"log_file":"","notifications":{"success_mail":"0","failure_mail":"1","fatal_failure_mail":"1","orphan_mail":"1"},"email":"","language_override":""}', CURRENT_TIMESTAMP AT TIME ZONE 'UTC'); SELECT setval('#__scheduler_tasks_id_seq', 2, false);