From: Roland Häder Date: Fri, 19 Dec 2008 22:22:23 +0000 (+0000) Subject: Minor rewrites, cache destroyed on mailexchange auto-activation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1dddfaaf4153c2df63288c2d1e4b39f9196afb59;p=mailer.git Minor rewrites, cache destroyed on mailexchange auto-activation --- diff --git a/inc/databases.php b/inc/databases.php index 75bf0cdad3..60ec3e84e0 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -115,7 +115,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "686"); +define('CURR_SVN_REVISION', "687"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 0e2b0ce593..02d70573b5 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -675,20 +675,15 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) $ADD = ""; if ((!IS_ADMIN()) && ($MODE != "admin")) $ADD = " AND locked='N'"; //* DEBUG: */ echo __LINE__.":".$MODE."/".$act."/".$wht."*
\n"; - if (($MODE != "admin") && ($UPDATE)) - { + if (($MODE != "admin") && ($UPDATE)) { // Update guest or member menu - SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_%s_menu SET counter=counter+1 WHERE action='%s' AND what='%s'".$ADD." LIMIT 1", + $SQL = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_%s_menu SET counter=counter+1 WHERE action='%s' AND what='%s'".$ADD." LIMIT 1", array($MODE, $act, $wht), __FILE__, __LINE__, false); - } - elseif ($wht != "overview") - { + } elseif ($wht != "overview") { // Other actions $SQL = SQL_QUERY_ESC("SELECT id, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s'".$ADD." ORDER BY action DESC LIMIT 1", array($MODE, $act), __FILE__, __LINE__, false); - } - else - { + } else { // Admin login overview $SQL = SQL_QUERY_ESC("SELECT id, what FROM "._MYSQL_PREFIX."_%s_menu WHERE action='%s' AND (what='' OR what IS NULL)".$ADD." ORDER BY action DESC LIMIT 1", array($MODE, $act), __FILE__, __LINE__, false); @@ -696,15 +691,11 @@ function VALIDATE_MENU_ACTION ($MODE, $act, $wht, $UPDATE=false) // Run SQL command $result = SQL_QUERY($SQL, __FILE__, __LINE__); - if ($UPDATE) - { + if ($UPDATE) { if (SQL_AFFECTEDROWS() == 1) $ret = true; //* DEBUG: */ debug_print_backtrace(); - } - else - { + } else { if (SQL_NUMROWS($result) == 1) { - list($id, $wht2) = SQL_FETCHROW($result); //* DEBUG: */ echo __LINE__."+".$SQL."+
\n"; //* DEBUG: */ echo __LINE__."*".$id."/".$wht."/".$wht2."*
\n"; $ret = true; @@ -1508,13 +1499,10 @@ function ADD_OPTION_LINES($table, $id, $name, $default="",$special="",$where="") } // Activate exchange (DEPERECATED???) function activateExchange() { - global $_CONFIG; - $result = SQL_QUERY("SELECT userid FROM `"._MYSQL_PREFIX."_user_data` WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__); - if (SQL_NUMROWS($result) >= getConfig('activate_xchange')) - { - // Free memory - SQL_FREERESULT($result); + // Check total amount of users + $totalUsers = GET_TOTAL_DATA("CONFIRMED", "use_data", "userid", "status", true, " AND max_mails > 0"); + if ($totalUsers >= getConfig('activate_xchange')) { // Activate System $SQLs = array( "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', mem_only='Y' WHERE module='order' LIMIT 1", @@ -1523,12 +1511,11 @@ function activateExchange() { ); // Run SQLs - foreach ($SQLs as $sql) { - $result = SQL_QUERY($sql, __FILE__, __LINE__); - } + RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs)); - // @TODO Destroy cache - } + // Rebuild cache + REBUILD_CACHE("config", "config"); + } // END - if } // function DELETE_USER_ACCOUNT($uid, $reason)