Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End of Support Plugin for Joomla 4.4 #40565

Merged
merged 37 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
69d37d5
End of Support Plugin for Joomla 4.4
mfleeson May 9, 2023
0619e90
Update mysql/base.sql - missing ,
mfleeson May 9, 2023
4d68d19
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 9, 2023
bd188b2
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 9, 2023
5942fbf
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 9, 2023
911dc51
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 9, 2023
c3b0267
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 9, 2023
b8cc075
Merge branch 'joomla:4.3-dev' into End-of-Support-Plugin-for-Joomla-4.4
mfleeson May 10, 2023
b18a482
Update plugins/quickicon/eos/services/provider.php
mfleeson May 10, 2023
d1596b3
Update plugins/quickicon/eos/services/provider.php
mfleeson May 10, 2023
6bc2695
All requested changes made. Lets see what happens!
mfleeson May 10, 2023
ed32c90
Merge branch '4.4-dev' into End-of-Support-Plugin-for-Joomla-4.4
laoneo May 10, 2023
c07625a
Merge branch 'End-of-Support-Plugin-for-Joomla-4.4' of https://github…
mfleeson May 10, 2023
cef9935
Removed __construct, followed Dimitris and JSanders suggestions
mfleeson May 10, 2023
5781472
PHPCs fix again
mfleeson May 10, 2023
9235085
Update Eos.php
dgrammatiko May 10, 2023
5e0633d
Update provider.php
dgrammatiko May 10, 2023
22052e8
Merge pull request #2 from mfleeson/dgrammatiko-patch-2
mfleeson May 10, 2023
a6109b2
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 10, 2023
0483e7b
Update plugins/quickicon/eos/services/provider.php
mfleeson May 11, 2023
9a25f99
Update provider.php
mfleeson May 11, 2023
fba1e20
Update plugins/quickicon/eos/src/Extension/Eos.php
mfleeson May 11, 2023
fe52b52
Merge branch '4.4-dev' into End-of-Support-Plugin-for-Joomla-4.4
mfleeson May 11, 2023
762db84
Merge branch '4.4-dev' into End-of-Support-Plugin-for-Joomla-4.4
mfleeson May 12, 2023
5f894ca
Update to all files to get almost clean PR. Do not Review this one, w…
mfleeson May 13, 2023
08b09d3
Ready for checking.
mfleeson May 13, 2023
290db0a
Updating GetMessageInfo in Eos to correctly just return an array
mfleeson May 13, 2023
cc73198
Changing Const from Public to Private
mfleeson May 13, 2023
4e9e778
Merge branch '4.4-dev' into End-of-Support-Plugin-for-Joomla-4.4
richard67 May 14, 2023
03036f2
Updates to set language to only load when needed. Fix to allow building
mfleeson May 14, 2023
db3e28f
Merge branch 'End-of-Support-Plugin-for-Joomla-4.4' of https://github…
mfleeson May 14, 2023
99aa6f2
Update stats-message.es6.js
mfleeson May 14, 2023
9068371
Update stats-message.es6.js
mfleeson May 14, 2023
42131ee
Merge branch '4.4-dev' into End-of-Support-Plugin-for-Joomla-4.4
laoneo May 15, 2023
78f1be7
Update Eos.php - set hardcoded date to 2025-10-25
MacJoom May 24, 2023
f4605b1
Merge branch '4.4-dev' into End-of-Support-Plugin-for-Joomla-4.4
MacJoom May 24, 2023
e06900b
Update stats-message.es6.js - revert changes
MacJoom May 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
(0, 'plg_quickicon_eos', 'plugin', 'eos', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 7, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
(0, 'plg_quickicon_eos', 'plugin', 'eos', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 7, 0);
39 changes: 39 additions & 0 deletions administrator/language/en-GB/plg_quickicon_eos.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
; Joomla! Project
; (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_QUICKICON_EOS="Quick Icon - Joomla! End Of Support Notification"
PLG_QUICKICON_EOS_GROUPNAME_EOS="End Of Support"
PLG_QUICKICON_EOS_GROUPNAME_INFO="Upgrade Information"
PLG_QUICKICON_EOS_GROUPNAME_WARNING="Support Status"
PLG_QUICKICON_EOS_MESSAGE_ERROR_SUPPORT_ENDED="<p>Support has ended for your version of Joomla. <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Migrate to the next version</a> as soon as possible.</p>"
PLG_QUICKICON_EOS_MESSAGE_ERROR_SUPPORT_ENDED_SHORT="Support has ended for your version of Joomla <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS_MESSAGE_INFO_01="<p>The latest version of Joomla has arrived! Find out all that it has to offer you. Check the landing page for <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">its features</a> and improvements.</p>"
PLG_QUICKICON_EOS_MESSAGE_INFO_01_SHORT="The latest version of Joomla has arrived! <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS_MESSAGE_INFO_02="<p>When is the time to migrate to the next version? Once the extensions your site needs are compatible. Learn <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">how to use the Pre-Update Checker</a>. </p>"
PLG_QUICKICON_EOS_MESSAGE_INFO_02_SHORT="Use Pre-Update Check for extension compatibility <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS_MESSAGE_WARNING_SECURITY_ONLY="<p>This version of Joomla has entered security only mode. Support ends %1$s. Start <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">planning to migrate</a> to the next version of Joomla today.</p>"
PLG_QUICKICON_EOS_MESSAGE_WARNING_SECURITY_ONLY_SHORT="This version of Joomla ends support on %1$s. <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS_MESSAGE_WARNING_SUPPORT_ENDING="<p>Support ends on %1$s for this version of Joomla. <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Migrate to the latest version of Joomla</a> as soon as possible.</p>"
PLG_QUICKICON_EOS_MESSAGE_WARNING_SUPPORT_ENDING_SHORT="End of support for this version of Joomla on %1$s. <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS_SNOOZE_BUTTON="Snooze this message for all users"
PLG_QUICKICON_EOS_XML_DESCRIPTION="Checks for the end of support status of Joomla and notifies you when visiting the Control Panel page."
; Below is a copy of the 3.10 text definitions for reference.
PLG_QUICKICON_EOS310="Quick Icon - Joomla 3.10 End Of Support Notification"
PLG_QUICKICON_EOS310_GROUPNAME_EOS="End Of Support"
PLG_QUICKICON_EOS310_GROUPNAME_INFO="Upgrade Information"
PLG_QUICKICON_EOS310_GROUPNAME_WARNING="Support Status"
PLG_QUICKICON_EOS310_MESSAGE_ERROR_SUPPORT_ENDED="<p>Support has ended for your version of Joomla 3.10. <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Migrate to Joomla 4</a> <span class=\"icon-new-tab\"></span>as soon as possible.</p>"
PLG_QUICKICON_EOS310_MESSAGE_ERROR_SUPPORT_ENDED_SHORT="Support has ended for Joomla 3.10 <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS310_MESSAGE_INFO_01="<p>Joomla 4 has arrived! Find out all that Joomla 4 has to offer you. Check the landing page for <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Joomla 4 features</a> <span class=\"icon-new-tab\"></span>and improvements.</p>"
PLG_QUICKICON_EOS310_MESSAGE_INFO_01_SHORT="Joomla 4 has arrived! <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS310_MESSAGE_INFO_02="<p>When is the time to migrate to Joomla 4? Once the extensions your site needs are compatible. Learn <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">how to use the Pre-Update Checker</a>. <span class=\"icon-new-tab\"></span></p>"
PLG_QUICKICON_EOS310_MESSAGE_INFO_02_SHORT="Use Pre-Update Check for extension compatibility <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS310_MESSAGE_WARNING_SECURITY_ONLY="<p>Joomla 3.10 has entered security only mode. Support ends %1$s. Start <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">planning to migrate</a> <span class=\"icon-new-tab\"></span>to Joomla 4 today.</p>"
PLG_QUICKICON_EOS310_MESSAGE_WARNING_SECURITY_ONLY_SHORT="Joomla 3.10 to end support on %1$s. <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS310_MESSAGE_WARNING_SUPPORT_ENDING="<p>Support ends on %1$s for Joomla 3.10. <a href=\"%2$s\" target=\"_blank\" rel=\"noopener noreferrer\">Migrate to Joomla 4</a> <span class=\"icon-new-tab\"></span>as soon as possible.</p>"
PLG_QUICKICON_EOS310_MESSAGE_WARNING_SUPPORT_ENDING_SHORT="End of support for Joomla 3.10 on %1$s. <span class=\"icon-new-tab\"></span>"
PLG_QUICKICON_EOS310_SNOOZE_BUTTON="Snooze this message for all users"
PLG_QUICKICON_EOS310_XML_DESCRIPTION="Checks for the end of support status of Joomla 3.10 and notifies you when visiting the Control Panel page."
;All of this text is currently being written for Joomla 5 by Phil Watson and Jenn Gress. TODO
7 changes: 7 additions & 0 deletions administrator/language/en-GB/plg_quickicon_eos.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; Joomla! Project
; (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_QUICKICON_EOS="Quick Icon - Joomla! End Of Support Notification"
PLG_QUICKICON_EOS_XML_DESCRIPTION="Checks for the end of support status of Joomla and places a notification on the Control Panel page."
37 changes: 37 additions & 0 deletions build/media_source/plg_quickicon_eos/js/snooze.es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @package Joomla.Plugin
* @subpackage Quickicon.eos
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
if (!Joomla) {
throw new Error('Joomla API is not properly initialised');
}

const url = new URL(`${Joomla.getOptions('system.paths').baseFull}index.php?option=com_ajax&group=quickicon&plugin=eos&format=json`);

async function onMutatedMessagesContainer(mutationList, observer) {
// eslint-disable-next-line no-restricted-syntax
for (const mutation of mutationList) {
const nodes = Array.from(mutation.addedNodes);
if (!nodes.length) {
return;
}

const alerts = nodes.filter((node) => node.querySelector('.eosnotify-snooze-btn'));
if (!alerts.length) {
return;
}

observer.disconnect();
alerts[0].querySelector('.eosnotify-snooze-btn').addEventListener('click', () => fetch(url, { headers: { 'X-CSRF-Token': Joomla.getOptions('csrf.token') || '' } })
.then((response) => {
if (response.ok) {
alerts[0].closest('joomla-alert').close();
}
}));
}
}

const observer = new MutationObserver(onMutatedMessagesContainer);
observer.observe(document.querySelector('#system-message-container'), { attributes: false, childList: true, subtree: true });
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Joomla = window.Joomla || {};
try {
const json = JSON.parse(response);
if (json && json.html) {
messageContainer.insertAdjacentHTML('beforeend', Joomla.sanitizeHtml(json.html, allowed));
messageContainer.insertAdjacentHTML('afterbegin', Joomla.sanitizeHtml(json.html, allowed));
MacJoom marked this conversation as resolved.
Show resolved Hide resolved
messageContainer.querySelector('.js-pstats-alert').classList.remove('hidden');
initStatsEvents(getJson);
}
Expand Down
1 change: 1 addition & 0 deletions installation/sql/mysql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
(0, 'plg_quickicon_downloadkey', 'plugin', 'downloadkey', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 4, 0),
(0, 'plg_quickicon_privacycheck', 'plugin', 'privacycheck', 'quickicon', 0, 1, 1, 0, 1, '', '{}', '', 5, 0),
(0, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 6, 0),
(0, 'plg_quickicon_eos', 'plugin', 'eos', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 7, 0),
(0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, 1, '', '', '', 1, 0),
(0, 'plg_sampledata_multilang', 'plugin', 'multilang', 'sampledata', 0, 1, 1, 0, 1, '', '', '', 2, 0),
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
Expand Down
1 change: 1 addition & 0 deletions installation/sql/postgresql/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
(0, 'plg_quickicon_downloadkey', 'plugin', 'downloadkey', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 4, 0),
(0, 'plg_quickicon_privacycheck', 'plugin', 'privacycheck', 'quickicon', 0, 1, 1, 0, 1, '', '{}', '', 5, 0),
(0, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 6, 0),
(0, 'plg_quickicon_eos', 'plugin', 'eos', 'quickicon', 0, 1, 1, 0, 1, '', '', '', 7, 0),
(0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, 1, '', '', '', 1, 0),
(0, 'plg_sampledata_multilang', 'plugin', 'multilang', 'sampledata', 0, 1, 1, 0, 1, '', '', '', 2, 0),
(0, 'plg_system_accessibility', 'plugin', 'accessibility', 'system', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
Expand Down
1 change: 1 addition & 0 deletions libraries/src/Extension/ExtensionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class ExtensionHelper
['plugin', 'overridecheck', 'quickicon', 0],
['plugin', 'phpversioncheck', 'quickicon', 0],
['plugin', 'privacycheck', 'quickicon', 0],
['plugin', 'eos', 'quickicon', 0],

// Core plugin extensions - sample data
['plugin', 'blog', 'sampledata', 0],
Expand Down
31 changes: 31 additions & 0 deletions plugins/quickicon/eos/eos.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension type="plugin" group="quickicon" method="upgrade">
<name>plg_quickicon_eos</name>
<author>Joomla! Project</author>
<creationDate>2023-05</creationDate>
<copyright>(C) 2023 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>4.4.0</version>
<description>PLG_QUICKICON_EOS_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Quickicon\Eos</namespace>
<files>
<folder plugin="eos">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_quickicon_eos.ini</language>
<language tag="en-GB">language/en-GB/plg_quickicon_eos.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="last_snoozed_id"
type="hidden"
/>
</fieldset>
</fields>
</config>
</extension>
51 changes: 51 additions & 0 deletions plugins/quickicon/eos/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage Quickicon.eos
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @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\Quickicon\Eos\Extension\Eos;

return new class () implements ServiceProviderInterface {
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*
* @throws Exception
*/
public function register(Container $container): void
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Eos(
$dispatcher,
(array) PluginHelper::getPlugin('quickicon', 'eos')
);
$plugin->setApplication(Factory::getApplication());
$plugin->setDatabase($container->get(DatabaseInterface::class));

return $plugin;
}
);
}
};
Loading