]> git.mxchange.org Git - mailer.git/blobdiff - inc/gen_refback.php
Cache will be rebuild after refback is installed
[mailer.git] / inc / gen_refback.php
index 3e79ad1d7d835d099121df8e63b70d948b9687c6..bfdf7a3fd21028026ef94a74b230edfe8b88cf44 100644 (file)
@@ -37,11 +37,23 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
+// Make sure our functions are there
+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__);
+
+       // Rebuild cache
+       REBUILD_CACHE("refsystem", "refsystem");
 } // END - if
 
 // Free result
@@ -66,7 +78,7 @@ if (SQL_NUMROWS($result_direct) > 0) {
                $cacheArray['back_level'] = 1;
 
                // Update refback table
-               /* DEBUG: */ echo "uid={$uid}<br />\n";
+               //* DEBUG: */ echo "uid={$uid}<br />\n";
                UPDATE_REFBACK_TABLE($uid);
        } // END - while
 } // END - if