-
Notifications
You must be signed in to change notification settings - Fork 4
/
script.php
80 lines (71 loc) · 2.2 KB
/
script.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* @version 3.0 stable $Id: default.php yannick berges
* @package Joomla
* @subpackage FLEXIcontent
* @copyright (C) 2022 Berges Yannick - www.com3elles.com
* @license GNU/GPL v2
*
* special thanks to ggppdk and emmanuel dannan for flexicontent
* special thanks to my master Marc Studer
*
* FLEXIadmin module is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
**/
//blocage des accès directs sur ce script
defined('_JEXEC') or die('Accès interdit');
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Language\Text;
class mod_flexiadminInstallerScript
{
/**
* Minimum Joomla version to check
*
* @var string
*/
private $minimumJoomlaVersion = '4.0';
/**
* Minimum PHP version to check
*
* @var string
*/
private $minimumPHPVersion = JOOMLA_MINIMUM_PHP;
/**
* Function called before extension installation/update/removal procedure commences
*
* @param string $type The type of change (install, update or discover_install, not uninstall)
* @param InstallerAdapter $parent The class calling this method
*
* @return boolean True on success
*
* @throws Exception
*/
public function preflight($type, $parent)
{
if ($type !== 'uninstall')
{
// Check for the minimum PHP version before continuing
if (!empty($this->minimumPHPVersion) && version_compare(PHP_VERSION, $this->minimumPHPVersion, '<'))
{
Factory::getApplication()->enqueueMessage(
Text::sprintf('JLIB_INSTALLER_MINIMUM_PHP', $this->minimumPHPVersion),
'error'
);
return false;
}
// Check for the minimum Joomla version before continuing
if (!empty($this->minimumJoomlaVersion) && version_compare(JVERSION, $this->minimumJoomlaVersion, '<'))
{
Factory::getApplication()->enqueueMessage(
Text::sprintf('JLIB_INSTALLER_MINIMUM_JOOMLA', $this->minimumJoomlaVersion),
'error'
);
return false;
}
}
return true;
}
}