-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.php
90 lines (84 loc) · 2.15 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
81
82
83
84
85
86
87
88
89
90
<?php
/**
* @package Wettermodul
* @author Thomas Hunziker <[email protected]>
* @copyright (C) 2022 - Thomas Hunziker
* @license http://www.gnu.org/licenses/gpl.html
**/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
use Joomla\CMS\Installer\InstallerScript;
class Mod_Dwd_wettermodulInstallerScript extends InstallerScript
{
/**
* The extension name. This should be set in the installer script.
*
* @var string
* @since 5.0.0
*/
protected $extension = 'mod_dwd_wettermodul';
/**
* Minimum PHP version required to install the extension
*
* @var string
* @since 5.0.0
*/
protected $minimumPhp = '5.6.0';
/**
* Minimum Joomla! version required to install the extension
*
* @var string
* @since 5.0.0
*/
protected $minimumJoomla = '4.0.0';
/**
* Old version before updating
*
* @var string
* @since 5.0.2
*/
private $oldRelease;
/**
* method to run before an install/update/uninstall method
*
* @param string $type 'install', 'update' or 'discover_install'
* @param ComponentAdapter $parent Installerobject
*
* @return boolean false will terminate the installation
*
* @since ?
*/
public function preflight($type, $parent)
{
// Storing old release number for process in postflight
if (strtolower($type) == 'update')
{
$manifest = $this->getItemArray('manifest_cache', '#__extensions', 'element', Factory::getDbo()->quote($this->extension));
$this->oldRelease = $manifest['version'];
}
return parent::preflight($type, $parent);
}
/**
* method to update the component
*
* @param Joomla\CMS\Installer\Adapter\ComponentAdapter $parent Installerobject
*
* @return void
*
* @since 5.0.0
*/
public function update($parent)
{
if (version_compare($this->oldRelease, '5.0.2', '<'))
{
$this->deleteFiles = array(
'/language/en-GB/en-GB.mod_dwd_wettermodul.ini',
'/language/en-GB/en-GB.mod_dwd_wettermodul.sys.ini',
'/language/de-DE/de-DE.mod_dwd_wettermodul.ini',
'/language/de-DE/de-DE.mod_dwd_wettermodul.sys.ini',
);
$this->removeFiles();
}
}
}