-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.php
More file actions
40 lines (32 loc) · 1.14 KB
/
Copy pathscript.php
File metadata and controls
40 lines (32 loc) · 1.14 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
<?php
/**
* @package JooTypesense
*
* @copyright Copyright (C) 2026 Weble. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\Database\DatabaseInterface;
class Pkg_JooTypesenseInstallerScript
{
public function postflight(string $type, $parent = null): void
{
if (!in_array($type, ['install', 'update'], true)) {
return;
}
$this->enablePlugins();
}
private function enablePlugins(): void
{
$db = Factory::getContainer()->get(DatabaseInterface::class);
$folders = implode(',', array_map([$db, 'quote'], ['system', 'console', 'task']));
$query = $db->createQuery()
->update($db->quoteName('#__extensions'))
->set($db->quoteName('enabled') . ' = 1')
->where($db->quoteName('type') . ' = ' . $db->quote('plugin'))
->where($db->quoteName('element') . ' = ' . $db->quote('jootypesense'))
->where($db->quoteName('folder') . ' IN (' . $folders . ')');
$db->setQuery($query)->execute();
}
}