-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.php
More file actions
74 lines (67 loc) · 1.69 KB
/
Copy pathscript.php
File metadata and controls
74 lines (67 loc) · 1.69 KB
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
<?php
/*
* package: System - Joomill Styling plugin
* copyright: Copyright (c) 2026. Jeroen Moolenschot | Joomill
* license: GNU General Public License version 3 or later
* link: https://www.joomill.nl
*/
// No direct access
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScript;
class plgSystemJoomillInstallerScript extends InstallerScript
{
/**
* Minimum Joomla version required to install the extension.
*
* @var string
*/
protected $minimumJoomla = '5.0';
/**
* Minimum PHP version required to install the extension.
*
* @var string
*/
protected $minimumPhp = '8.1';
/**
* Runs after install or update. Enables the plugin on a fresh install.
*
* @param string $type The action being performed (install, update, discover_install).
* @param InstallerAdapter $parent The installer adapter.
*
* @return boolean
*/
public function postflight($type, $parent)
{
if ($type === 'install')
{
$this->enablePlugin();
}
return true;
}
/**
* Enables the plugin in the #__extensions table.
*
* @return void
*/
private function enablePlugin()
{
try
{
$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true)
->update($db->quoteName('#__extensions'))
->set($db->quoteName('enabled') . ' = ' . $db->quote(1))
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('folder') . ' = ' . $db->quote('system'))
->where($db->quoteName('element') . ' = ' . $db->quote('joomill'));
$db->setQuery($query);
$db->execute();
}
catch (\Exception $e)
{
return;
}
}
}