Skip to content

Commit 34ebbbe

Browse files
committed
update script to ensure correct allowlist table name, version -> 1.4.3 + changelog
1 parent 2b58e26 commit 34ebbbe

File tree

5 files changed

+39
-3
lines changed

5 files changed

+39
-3
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.4.3 (2021-04-28)
2+
- Fix allowlist name in SQL (un)install script + update to fix situation for everyone
3+
14
1.4.2 (2021-04-20)
25
- Joomla 4 Compatibility
36
- Language: Whitelist -> Allow list (en/de)

bfstop.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<homepage>https://github.com/codeling/bfstop</homepage>
1010
<authorEmail>bfstop@bfroehler.info</authorEmail>
1111
<authorUrl>https://github.com/codeling/bfstop</authorUrl>
12-
<version>1.4.2</version>
12+
<version>1.4.3</version>
1313
<files>
1414
<filename plugin="bfstop">bfstop.php</filename>
1515
<filename>index.html</filename>
@@ -220,4 +220,5 @@
220220
</fieldset>
221221
</fields>
222222
</config>
223+
<scriptfile>updatescript.php</scriptfile>
223224
</extension>

deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ dstdir=
1010
# internal variables to be updated when files are added:
1111
extname=bfstop
1212
sqlfiles="sql"
13-
srcfiles="$extname.php helpers $extname.xml $sqlfiles setupscripts.php index.html"
13+
srcfiles="$extname.php helpers $extname.xml $sqlfiles updatescript.php index.html"
1414
langfiles="language"
1515
docs="CHANGELOG LICENSE.txt README"
1616
plgtype="system"
1717
langs="de-DE en-GB"
18-
version=1.4.2
18+
version=1.4.3
1919

2020
if [ "$1" == "zip" ]
2121
then

sql/updates/1.4.3.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- Update DB schema to version 1.4.3

updatescript.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
defined('_JEXEC') or die;
3+
4+
class PlgsystembfstopInstallerScript
5+
{
6+
function install($parent) {}
7+
function uninstall($parent) {}
8+
function preflight($type, $parent) {}
9+
function postflight($type, $parent) {}
10+
11+
function update($parent)
12+
{
13+
// for version 1.4.2, whitelist was renamed to allowlist, but only for updates;
14+
// for new installs, the old name remained, so let's fix this for all installations:
15+
$db = JFactory::getDbo();
16+
try
17+
{
18+
$sql = "SELECT COUNT(*) FROM `#__bfstop_whitelist`";
19+
$db->setQuery($sql);
20+
$numEntries = ((int)$db->loadResult());
21+
$sql = "RENAME TABLE `#__bfstop_whitelist` TO `#__bfstop_allowlist`";
22+
$db->setQuery($sql);
23+
$db->execute();
24+
}
25+
catch (Exception $e)
26+
{
27+
// if table doesn't exist, there's nothing we need to do
28+
// Log::add("Update ERROR: ".$e->getMessage(), Log::ERROR, 'Update');
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)