static function loadAndLazyInit() { wfDebug(__METHOD__ . ": reading site_stats from slave\n"); $row = self::doLoad(wfGetDB(DB_SLAVE)); if (!self::isSane($row)) { // Might have just been initialized during this request? Underflow? wfDebug(__METHOD__ . ": site_stats damaged or missing on slave\n"); $row = self::doLoad(wfGetDB(DB_MASTER)); } if (!self::isSane($row)) { // Normally the site_stats table is initialized at install time. // Some manual construction scenarios may leave the table empty or // broken, however, for instance when importing from a dump into a // clean schema with mwdumper. wfDebug(__METHOD__ . ": initializing damaged or missing site_stats\n"); global $IP; require_once "{$IP}/maintenance/initStats.inc"; ob_start(); wfInitStats(); ob_end_clean(); $row = self::doLoad(wfGetDB(DB_MASTER)); } if (!self::isSane($row)) { wfDebug(__METHOD__ . ": site_stats persistently nonsensical o_O\n"); } return $row; }
/** * Enter Admin, choose what to do in SWITCH * * URL command lines<br /> * Special:AWCforum/admin/threads_to_wiki<br /> * Special:AWCforum/admin/wfInitStats (runs wiki /maintenance/initStats.inc)<br /> * Special:AWCforum/admin/re_forum_stats<br /> * Special:AWCforum/admin/user_recount_all<br /> * @parameter string $action * @uses awc_admin_skin * @since Version 2.5.8 */ function enterAdmin($action) { global $wgRequest, $ADskin, $awc, $wgOut, $awc_admin_lang, $wgUser, $WhoWhere, $action_url, $awc_ver; $WhoWhere['type'] = 'forum'; $WhoWhere['where'] = 'admin||awc-split||admin'; require_once awc_dir . 'dBase.php'; require awc_dir . 'includes/admin/admin_funk.php'; require awc_dir . 'skins/admin_skin.php'; $ADskin = new awc_admin_skin(); if (version_compare(awcs_forum_ver_current, awcs_forum_ver, '=')) { Set_AWC_Forum_SubTitle(get_awcsforum_word('admin_setPagetitle'), get_awcsforum_word('admin_setSubtitle')); Set_AWC_Forum_BreadCrumbs('<a href="' . awc_url . 'admin' . '">' . get_awcsforum_word('admin_word') . '</a>'); } $spl = explode("/", $action); $todo = isset($spl[1]) ? str_replace("todo_", "", $spl[1]) : $wgRequest->getVal('todo'); $id = isset($spl[2]) ? str_replace("id", "", $spl[2]) : $wgRequest->getVal('id'); $move_id = $wgRequest->getVal('move_id'); define('what_page', $todo); switch ($todo) { // url commands case 'threads_to_wiki': if (!in_array('bureaucrat', $wgUser->getGroups())) { die("need to be a bureaucrat"); } if (!isset($spl[2]) or !is_numeric($spl[2])) { return $wgOut->addHTML("<br><br><center>Need a count-number<br><br>"); } self::threads_to_wiki($spl[2]); break; case 'wfInitStats': if (!in_array('bureaucrat', $wgUser->getGroups())) { die("need to be a bureaucrat"); } global $IP; require $IP . '/maintenance/initStats.inc'; wfInitStats(); break; case 'dev': if (!in_array('bureaucrat', $wgUser->getGroups())) { die("need to be a bureaucrat"); } require awc_dir . 'includes/admin/admin_dev.php'; return awcs_forum_dev_func(); break; case 're_forum_stats': if (!in_array('bureaucrat', $wgUser->getGroups())) { die("need to be a bureaucrat"); } return self::re_forum_stats(); break; case 'user_recount_all': if (!in_array('bureaucrat', $wgUser->getGroups())) { die("need to be a bureaucrat"); } self::user_recount_all(); break; // END url commands.. // END url commands.. case 'tplt': require awc_dir . 'includes/admin/admin_tplt.php'; awcs_forum_admin_tplt($action); break; case 'theme': require awc_dir . 'includes/admin/admin_theme.php'; awcsforum_admin_theme_func(); break; case 'awc_lang': require awc_dir . 'includes/admin/admin_lang_funk.php'; $awc_lang_class = new awc_admin_lang_cls($action); unset($awc_lang_class); #$awc_lang_class->awc_admin_lang_cls(); break; case 'css': require awc_dir . 'includes/admin/admin_css_funk.php'; awcs_forum_admin_css($action); break; case 'cat': require awc_dir . 'includes/admin/admin_cat.php'; awcsf_admin_categories_func(); break; case 'forum': require awc_dir . 'includes/admin/admin_forum.php'; awcsf_admin_forum_func(); break; case 'mem_title': require awc_dir . 'includes/admin/admin_memtitle.php'; awcsf_admin_membertitle_func(); break; case 'maintenance': self::get_maintenance(); break; case 'do_prune': if (in_array('bureaucrat', $wgUser->getGroups())) { $this->do_prune(); } break; case 'do_Trecount': self::do_Trecount(); break; case 'do_Precount': self::do_Precount(); break; case 'config_forum': self::do_config_forum(); break; case 'admin_get_config': self::do_get_config($id); break; case 'mem_lookup': awcsforum_funcs::get_page_lang(array('lang_txt_mem')); self::mem_lookup(); break; case 'save_sig': case 'CheckAvatraSize': case 'miscusersettings': self::save_userinfo($todo); break; case 'user_recount': self::user_recount(); break; case 'delete_file': self::delete_file($wgRequest->getVal('todo')); break; case 'get_updates': self::get_updates(); break; case 'forum_update': self::forum_update(); break; case 'forum_autoupdate': self::forum_autoupdate(); break; case 'get_autoupdate': self::get_autoupdate(); break; case 'autoupdate_unpack_and_update': self::autoupdate_unpack_and_update(); break; case 'get_emotions': self::emotions_get(); break; case 'edit_emotions': self::emotions_edit(); break; case 'add_emotions': self::emotions_add(); break; default: self::main(); break; } }
<?php /** * Maintenance script to re-initialise or update the site statistics table * * @file * @ingroup Maintenance * @author Brion Vibber * @author Rob Church <*****@*****.**> * @licence GNU General Public Licence 2.0 or later */ $options = array('help', 'update', 'noviews'); require_once 'commandLine.inc'; echo "Refresh Site Statistics\n\n"; if (isset($options['help'])) { showHelp(); exit; } require "{$IP}/maintenance/initStats.inc"; wfInitStats($options); function showHelp() { echo "Re-initialise the site statistics tables.\n\n"; echo "Usage: php initStats.php [--update|--noviews]\n\n"; echo " --update : Update the existing statistics (preserves the ss_total_views field)\n"; echo "--noviews : Don't update the page view counter\n\n"; }