* @copyright (C) 2024 KW4NZ, * @license GNU General Public License version 2 or later; see LICENSE.md * @since 0.9.21 */ \defined('_JEXEC') or die; /** * Script file of Depot component. * * The name of this class is dependent on the component being installed. * The class name should have the component's name, directly followed by * the text InstallerScript (ex:. com_depotInstallerScript). * * This class will be called by Joomla's installer, if specified in your component's * manifest file, and is used for custom automation actions in its installation process. * * In order to use this automation script, you should reference it in your component's * mainfest file as follows: * script.php */ use Joomla\CMS\Factory; use Joomla\CMS\Installer\InstallerAdapter; use Joomla\CMS\Installer\InstallerScriptInterface; use Joomla\CMS\Language\Text; return new class() implements InstallerScriptInterface { private string $minimumJoomla = '4.4.8'; // '5.1.4' private string $minimumPhp = '8.1.29'; public function install(InstallerAdapter $adapter): bool { echo "component install
"; return true; } public function update(InstallerAdapter $adapter): bool { echo "component update
"; return true; } public function uninstall(InstallerAdapter $adapter): bool { echo "component uninstall
"; return true; } public function preflight(string $type, InstallerAdapter $adapter): bool { echo "component preflight
"; if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) { Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_PHP'), $this->minimumPhp), 'error'); return false; } if (version_compare(JVERSION, $this->minimumJoomla, '<')) { Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_JOOMLA'), $this->minimumJoomla), 'error'); return false; } return true; } public function postflight(string $type, InstallerAdapter $adapter): bool { echo "component postflight
"; return true; } };