-
Notifications
You must be signed in to change notification settings - Fork 20
/
updatescript.php
39 lines (36 loc) · 1.04 KB
/
updatescript.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
<?php
/*
* @package BFStop Plugin (bfstop) for Joomla!
* @author Bernhard Froehler
* @copyright (C) Bernhard Froehler
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
class PlgsystembfstopInstallerScript
{
function install($parent) {}
function uninstall($parent) {}
function preflight($type, $parent) {}
function postflight($type, $parent) {}
function update($parent)
{
// for version 1.4.2, whitelist was renamed to allowlist, but only for updates;
// for new installs, the old name remained, so let's fix this for all installations:
$db = Factory::getDbo();
try
{
$sql = "SELECT COUNT(*) FROM `#__bfstop_whitelist`";
$db->setQuery($sql);
$numEntries = ((int)$db->loadResult());
$sql = "RENAME TABLE `#__bfstop_whitelist` TO `#__bfstop_allowlist`";
$db->setQuery($sql);
$db->execute();
}
catch (Exception $e)
{
// if table doesn't exist, there's nothing we need to do
// Log::add("Update ERROR: ".$e->getMessage(), Log::ERROR, 'Update');
}
}
}