]> git.mxchange.org Git - mailer.git/blobdiff - inc/gen_refback.php
More rewrites to make use of (cached) wrapper functions
[mailer.git] / inc / gen_refback.php
index fc21e4e775de87a26784d1208690ddea1e1b0c5f..0ffa66449a0c5dc706b2870e2a129de1ff5bc2cc 100644 (file)
@@ -18,6 +18,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 // Make sure our functions are there
 loadIncludeOnce('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) {
+if (!SQL_HASZERONUMS($result)) {
        // Remove index temporaly
        SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` DROP INDEX `userid_level`", __FILE__, __LINE__);
 
@@ -57,7 +58,7 @@ if (SQL_NUMROWS($result) > 0) {
        SQL_ALTER_TABLE("ALTER TABLE `{?_MYSQL_PREFIX?}_refsystem` ADD UNIQUE `userid_level` ( `userid`,`level` )", __FILE__, __LINE__);
 
        // Rebuild cache
-       rebuildCacheFile('refsystem', 'refsystem');
+       rebuildCache('refsystem', 'refsystem');
 } // END - if
 
 // Free result
@@ -67,20 +68,24 @@ SQL_FREERESULT($result);
 SQL_QUERY('TRUNCATE TABLE `{?_MYSQL_PREFIX?}_user_refs`', __FILE__, __LINE__);
 
 // Begin with all users in level one
-$result_direct = SQL_QUERY('SELECT u.userid
-FROM `{?_MYSQL_PREFIX?}_user_data` AS u
-WHERE u.refid=0
-ORDER BY u.userid ASC', __FILE__, __LINE__);
+$result_direct = SQL_QUERY('SELECT
+       u.userid
+FROM
+       `{?_MYSQL_PREFIX?}_user_data` AS u
+WHERE
+       u.refid=0
+ORDER BY
+       u.userid ASC', __FILE__, __LINE__);
 
 // Do we have entries?
-if (SQL_NUMROWS($result_direct) > 0) {
+if (!SQL_HASZERONUMS($result_direct) > 0) {
        // When 'walk' through all users
        while ($content = SQL_FETCHARRAY($result_direct)) {
                // Init level
                $GLOBALS['refback_level'] = 1;
 
                // Update refback table
-               //* DEBUG: */ outputHtml("userid={$content['userid']}<br />");
+               //* DEBUG: */ debugOutput('userid=' . $content['userid']);
                updateRefbackTable($content['userid']);
        } // END - while
 } // END - if
@@ -88,5 +93,5 @@ if (SQL_NUMROWS($result_direct) > 0) {
 // Free result
 SQL_FREERESULT($result_direct);
 
-//
+// [EOF]
 ?>