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

Add a simple check for existence of old version version of attachments plugin framework #97

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions pkg_attachments/install.attachments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php
/**
* Attachments component installation script
*
* @package Attachments
* @subpackage Attachments_Component
*
* @author Jonathan M. Cameron
* @copyright Copyright (C) 2007-2024 Jonathan M. Cameron
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
*/

use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Language\Text;

// No direct access
defined('_JEXEC') or die('Restricted access');

/**
* The main attachments installation class
*
* @package Attachments
*/
class pkg_AttachmentsInstallerScript implements InstallerScriptInterface
{
/**
* Attachments component install function
*
* @param InstallerAdapter $adapter The adapter calling this method
* @return boolean True on success
*/
public function install(InstallerAdapter $adapter): bool
{
return true;
}


/**
* Attachments component update function
*
* @param InstallerAdapter $adapter The adapter calling this method
* @return boolean True on success
*/
public function update(InstallerAdapter $adapter): bool
{
return true;
}


/**
* Attachments component uninstall function
*
* @param InstallerAdapter $adapter The adapter calling this method
* @return boolean True on success
*/
public function uninstall(InstallerAdapter $adapter): bool
{
return true;
}


/**
* Attachments component preflight function
*
* @param string $type The type of change (install or discover_install, update, uninstall)
* @param InstallerAdapter $adapter The adapter calling this method
* @return boolean True on success
*/
public function preflight(string $type, InstallerAdapter $adapter): bool
{
$app = Factory::getApplication();

// Load the installation language
$lang = $app->getLanguage();
$lang->load('pkg_attachments.sys', dirname(__FILE__), 'en-GB');

if (Folder::exists(JPATH_ROOT . '/plugins/attachments/attachments_plugin_framework')) {
$msg = Text::_('ATTACH_PACKAGE_REMOVE_OLD_ATTACHMENTS_FRAMEWORK');
$app->enqueueMessage($msg, 'error');
return false;
}

return true;
}


/**
* Attachments component postflight function
*
* @param string $type The type of change (install or discover_install, update, uninstall)
* @param InstallerAdapter $adapter The adapter calling this method
* @return boolean True on success
*/
public function postflight(string $type, InstallerAdapter $adapter): bool
{
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
ATTACH_PACKAGE_ATTACHMENTS_FOR_JOOMLA_40PLUS="Συνημμένα για Joomla 4.0+"
ATTACH_PACKAGE_NOTICE_UNINSTALL_PACKAGE_S="Για να αφαιρέσετε την επέκταση Συνημμένα, αφαιρέστε το Πακέτο '%s'!"
PKG_ATTACHMENTS="Πακέτο: Συνημμένα για Joomla 4.0+"
ATTACH_PACKAGE_REMOVE_OLD_ATTACHMENTS_FRAMEWORK="Παρακαλώ αφαιρέστε την παλιά έκδοση του πλαισίου πρόσθετων συνημμένων (framework) πριν την εγκατάσταση της έκδοσης v4.x του πακέτου Συνημμένα (μην αφαιρέσετε την εφαρμογή καθώς αυτό θα έχει σαν αποτέλεσμα να διαγραφούν και όλα σας τα συνημμένα)"
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

ATTACH_PACKAGE_ATTACHMENTS_FOR_JOOMLA_40PLUS="Attachments for Joomla 4.0+"
PKG_ATTACHMENTS="Package: Attachments for Joomla 4.0+"
ATTACH_PACKAGE_REMOVE_OLD_ATTACHMENTS_FRAMEWORK="Please remove old version of the attachments plugin framework before installing v4.x of the Attachments Package (don't uninstall the component as this will also remove all of your attachments)"
2 changes: 2 additions & 0 deletions pkg_attachments/pkg_attachments.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<packagerurl>http://joomlacode.org/gf/project/attachments/</packagerurl>
<description>ATTACH_PACKAGE_ATTACHMENTS_FOR_JOOMLA_40PLUS</description>

<scriptfile>install.attachments.php</scriptfile>

<files folder="packages">
<file type="component" id="com_attachments">attachments_component.zip</file>
<file type="plugin" id="attachments" group="content">attachments_plugin.zip</file>
Expand Down