From d835272786b97431fd569050e92360ecaf91fc20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 4 Oct 2008 13:01:32 +0000 Subject: [PATCH] Array name fixed, unique index will be dropped and re-added while gen_refback.php has been executed --- inc/databases.php | 2 +- inc/extensions/ext-refback.php | 2 +- inc/gen_refback.php | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index a8a6a86fc1..8151bbf3ad 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "441"); +define('CURR_SVN_REVISION', "443"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions/ext-refback.php b/inc/extensions/ext-refback.php index 446d0d6a52..3945f2ec56 100644 --- a/inc/extensions/ext-refback.php +++ b/inc/extensions/ext-refback.php @@ -69,7 +69,7 @@ KEY (`refid`) case "remove": // Do stuff when removing extension // SQL commands to run $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_user_refs"; - $SQLS[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='refback' LIMIT 1"; + $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='refback' LIMIT 1"; break; case "activate": // Do stuff when admin activates this extension diff --git a/inc/gen_refback.php b/inc/gen_refback.php index be1a3a7689..7c29ede371 100644 --- a/inc/gen_refback.php +++ b/inc/gen_refback.php @@ -43,8 +43,14 @@ require_once(PATH."inc/libs/refback_functions.php"); // Sanity-check: Do we have ref level 0? $result = SQL_QUERY("SELECT id FROM "._MYSQL_PREFIX."_refsystem WHERE level=0", __FILE__, __LINE__); if (SQL_NUMROWS($result) > 0) { + // Remove index temporaly + SQL_QUERY("ALTER TABLE `"._MYSQL_PREFIX."_refsystem` DROP INDEX `userid_level`", __FILE__, __LINE__); + // Upgrade refsystem, ref-level 0 is silly here SQL_QUERY("UPDATE "._MYSQL_PREFIX."_refsystem SET level=level+1", __FILE__, __LINE__); + + // Add it again + SQL_QUERY("ALTER TABLE `"._MYSQL_PREFIX."_refsystem` ADD UNIQUE `userid_level` ( `userid` , `level` )", __FILE__, __LINE__); } // END - if // Free result -- 2.39.5