-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscript.php
60 lines (56 loc) · 1.54 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
<?php
/**
* @package Obix Class Extender System Plugin
*
* @author Pieter-Jan de Vries/Obix webtechniek <[email protected]>
* @copyright Copyright © 2020 Obix webtechniek. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @link https://www.obix.nl
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Adapter\PluginAdapter;
use Joomla\CMS\Installer\InstallerScript;
/**
* ClassExtender script file.
*
* @package Obix Class Extender System Plugin
* @since 1.0.0
*/
class plgSystemClassExtenderInstallerScript extends InstallerScript
{
/**
* Extension script constructor.
*
* @since 1.2.0
*/
public function __construct()
{
$this->minimumJoomla = '3.9';
$this->minimumPhp = '7.4';
}
/**
* Called after any type of action.
*
* @param string $route Which action is happening (install|uninstall|discover_install|update)
* @param PluginAdapter $adapter The object responsible for running this script
*
* @return void
*/
public function postflight($route, PluginAdapter $adapter): void
{
// Enable plugin on first installation only.
if ($route === 'install')
{
$db = Factory::getDbo();
$query = sprintf('UPDATE %s SET %s = 1 WHERE %s = %s AND %s = %s',
$db->quoteName('#__extensions'),
$db->quoteName('enabled'),
$db->quoteName('type'), $db->quote('plugin'),
$db->quoteName('name'), $db->quote('PLG_SYSTEM_CLASS_EXTENDER')
);
$db->setQuery($query);
$db->execute();
}
}
}