-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.php
75 lines (62 loc) · 2.12 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
<?php
/**
* @since 2.0.0
* @package com_plugnmeet
* @author Jibon L. Costa <[email protected]>
* @copyright Copyright (C) MynaParrot SL. 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\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Language\Text;
use Joomla\Database\DatabaseDriver;
use Joomla\Database\DatabaseInterface;
return new class () implements InstallerScriptInterface {
private string $minimumJoomla = '5.2.0';
private string $minimumPhp = '8.0.0';
public function install(InstallerAdapter $adapter): bool
{
return true;
}
public function update(InstallerAdapter $adapter): bool
{
return true;
}
public function uninstall(InstallerAdapter $adapter): bool
{
return true;
}
public function preflight(string $type, InstallerAdapter $adapter): bool
{
if (version_compare(PHP_VERSION, $this->minimumPhp, '<'))
{
Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_PHP'), $this->minimumPhp), 'error');
return false;
}
if (version_compare(JVERSION, $this->minimumJoomla, '<'))
{
Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_JOOMLA'), $this->minimumJoomla), 'error');
return false;
}
return true;
}
public function postflight(string $type, InstallerAdapter $adapter): bool
{
if ($type === 'install')
{
/** @var DatabaseDriver $db */
$db = Factory::getContainer()->get(DatabaseInterface::class);
$query = $db->getQuery(true)
->update($db->qn('#__extensions'))
->set($db->qn('params') . ' = ' . $db->q('{"plugnmeet_server_url":"https:\/\/demo.plugnmeet.com","plugnmeet_api_key":"plugnmeet","plugnmeet_secret":"zumyyYWqv7KR2kUqvYdq4z4sXg7XTBD2ljT6","sef_ids":0}'))
->where($db->qn('name') . ' = ' . $db->q("com_plugnmeet"))
->where($db->qn('type') . ' = ' . $db->q("component"))
->where($db->qn('element') . ' = ' . $db->q("com_plugnmeet"));
$db->setQuery($query);
return $db->execute();
}
return true;
}
};