X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffix_refsystem.php;h=916795cd0fc3cb526672c55f331b0fd574a9df08;hb=66a6001915edd4794fc971421e02e24043959dcc;hp=8608d51d73f08ec42cbcff4e7618c4d74080a5bb;hpb=03e4bc225c635dafb42c5078d1b75cc7351c3443;p=mailer.git diff --git a/inc/fix_refsystem.php b/inc/fix_refsystem.php index 8608d51d73..916795cd0f 100644 --- a/inc/fix_refsystem.php +++ b/inc/fix_refsystem.php @@ -17,7 +17,7 @@ * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -40,17 +40,17 @@ if (!defined('__SECURITY')) { die(); } // END - if -// Sanity-check: Do we have ref level 0? -$result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0 OR `level` IS NULL', __FILE__, __LINE__); +// Sanity-check: Do we have ref level 0? If so, this must be fixed to NULL and `level` must be increased by one +$result = SQL_QUERY('SELECT `id` FROM `{?_MYSQL_PREFIX?}_refsystem` WHERE `level`=0', __FILE__, __LINE__); if (!SQL_HASZERONUMS($result)) { // Remove index temporaly SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`', __FILE__, __LINE__); - // Upgrade refsystem, ref-level 0 is silly here + // Upgrade refsystem SQL_QUERY('UPDATE `{?_MYSQL_PREFIX?}_refsystem` SET `level`=`level`+1', __FILE__, __LINE__); // Add it again - SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`, `level` )', __FILE__, __LINE__); + SQL_ALTER_TABLE('ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE INDEX `userid_level` (`userid`,`level`)', __FILE__, __LINE__); // Rebuild cache rebuildCache('refsystem', 'refsystem');