better activation behavior

This commit is contained in:
joshp 2020-07-22 01:28:28 -04:00
parent 458ac8bd48
commit c06277a42a
No known key found for this signature in database
GPG Key ID: 59903022E9AC64FC

View File

@ -3,7 +3,7 @@
Plugin Name: Auth Manager Plus Plugin Name: Auth Manager Plus
Plugin URI: https://github.com/joshp23/YOURLS-AuthMgrPlus Plugin URI: https://github.com/joshp23/YOURLS-AuthMgrPlus
Description: Role Based Access Controlls with seperated user data for authenticated users Description: Role Based Access Controlls with seperated user data for authenticated users
Version: 2.2.0 Version: 2.2.1
Author: Josh Panter, nicwaller, Ian Barber <ian.barber@gmail.com> Author: Josh Panter, nicwaller, Ian Barber <ian.barber@gmail.com>
Author URI: https://unfettered.net Author URI: https://unfettered.net
*/ */
@ -462,7 +462,7 @@ function amp_activated() {
global $ydb; global $ydb;
$table = YOURLS_DB_TABLE_URL; $table = YOURLS_DB_TABLE_URL;
$sql = "DESCRIBE `$table`"; $sql = "DESCRIBE `".$table."`";
$results = $ydb->fetchObjects($sql); $results = $ydb->fetchObjects($sql);
$activated = false; $activated = false;
@ -473,10 +473,10 @@ function amp_activated() {
} }
if(!$activated) { if(!$activated) {
if ($version) { if ($version) {
$sql = "ALTER TABLE `$table` ADD `user` VARCHAR(255) NULL"; $sql = "ALTER TABLE `".$table."` ADD `user` VARCHAR(255) NULL";
$insert = $ydb->fetchAffected($sql); $insert = $ydb->fetchAffected($sql);
} else { } else {
$ydb->query("ALTER TABLE `$table` ADD `user` VARCHAR(255) NULL"); $ydb->query("ALTER TABLE `".$table."` ADD `user` VARCHAR(255) NULL");
} }
} }