From: Waldir Pimenta Date: Mon, 11 Feb 2013 09:58:42 +0000 (+0000) Subject: normalize filenames of maintenance scripts X-Git-Tag: 1.31.0-rc.0~20461^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=158bf7cb558a6d2e4ef39eee080a0dd67e733891;p=lhc%2Fweb%2Fwiklou.git normalize filenames of maintenance scripts Use lowerCamelCase.php format for all files (per [[mw:CC#File_naming]]), and make filenames more specific: - clear_stats.php -> clearCacheStats.php - clear_interwiki_cache.php -> clearInterwikiCache.php - initStats.php -> initSiteStats.php - proxy_check.php -> proxyCheck.php - stats.php -> showCacheStats.php - showStats.php -> showSiteStats.php Also changed the class names accordingly (per [[mw:CC/PHP#Naming]]), and make class names more specific: - clear_stats -> ClearCacheStats - InitStats -> InitSiteStats - CacheStats -> ShowCacheStats - ShowStats -> ShowSiteStats Updated files that made references to the changed files/classes: - DefaultSettings.php and SpecialBlockme.php (proxy_check.php -> proxyCheck.php) - maintenance/showSiteStats.php (initStats.php -> initSiteStats.php) - maintenance/README and docs/memcached.txt (stats.php -> showCacheStats.php) - docs/maintenance.txt and docs/memcached.txt (clear_stats.php -> clearCacheStats.php) Thanks Hashar for the initial help and encouragement :) Change-Id: I60f76fc971e06e1b710dcda35f9c2d931b93bdd7 --- diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 303e0b0fe9..445e226953 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -291,6 +291,13 @@ changes to languages because of Bugzilla reports. Vector extension (and possibly disable its features using config settings if you don't want them). * Experimental IBM DB2 support was removed due to lack of interest and maintainership +* BREAKING CHANGE: Filenames of maintenance scripts were standardized into lowerCamelCase + format, and made more explicit: clear_stats.php -> clearCacheStats.php; + clear_interwiki_cache.php -> clearInterwikiCache.php; initStats.php -> initSiteStats.php; + proxy_check.php -> proxyCheck.php; stats.php -> showCacheStats.php; + showStats.php -> showSiteStats.php. Class names were renamed accordingly: + clear_stats -> ClearCacheStats; InitStats -> InitSiteStats; CacheStats -> ShowCacheStats + ShowStats -> ShowSiteStats. == Compatibility == diff --git a/docs/maintenance.txt b/docs/maintenance.txt index 988ff28093..27619c8622 100644 --- a/docs/maintenance.txt +++ b/docs/maintenance.txt @@ -15,7 +15,7 @@ subdirectories, all of which have unique purposes. level /maintenance directory. Example: - php clear_stats.php + php clearCacheStats.php The following parameters are available to all maintenance scripts --help : Print a help message diff --git a/docs/memcached.txt b/docs/memcached.txt index 971a611a0d..f54a4e7ad0 100644 --- a/docs/memcached.txt +++ b/docs/memcached.txt @@ -237,9 +237,9 @@ Statistics: controlled by: $wgStatsMethod key: $wgDBname:stats:$key ex: wikibd:stats:request_with_session - stores: counter for statistics (see maintenance/stats.php script) + stores: counter for statistics (see maintenance/showCacheStats.php script) expiry: none (?) - cleared by: maintenance/clear_stats.php script + cleared by: maintenance/clearCacheStats.php script User: key: $wgDBname:user:id:$sId diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 7b80715b9d..eb727a5dee 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4406,7 +4406,7 @@ $wgBlockOpenProxies = false; /** Port we want to scan for a proxy */ $wgProxyPorts = array( 80, 81, 1080, 3128, 6588, 8000, 8080, 8888, 65506 ); /** Script used to scan */ -$wgProxyScriptPath = "$IP/maintenance/proxy_check.php"; +$wgProxyScriptPath = "$IP/maintenance/proxyCheck.php"; /** */ $wgProxyMemcExpiry = 86400; /** This should always be customised in LocalSettings.php */ diff --git a/includes/specials/SpecialBlockme.php b/includes/specials/SpecialBlockme.php index 3840b2ffed..13e2351f17 100644 --- a/includes/specials/SpecialBlockme.php +++ b/includes/specials/SpecialBlockme.php @@ -22,7 +22,7 @@ */ /** - * A special page called by proxy_check.php to block open proxies + * A special page called by proxyCheck.php to block open proxies * * @ingroup SpecialPage */ diff --git a/maintenance/README b/maintenance/README index 9f95f5de49..5cb6f5f5ab 100644 --- a/maintenance/README +++ b/maintenance/README @@ -93,7 +93,7 @@ installations. runJobs.php Immediately complete all jobs in the job queue - stats.php + showCacheStats.php Show all statistics stored in the cache undelete.php @@ -106,4 +106,4 @@ installations. Update pages restriction to the new schema userOptions.php - Change user options \ No newline at end of file + Change user options diff --git a/maintenance/clearCacheStats.php b/maintenance/clearCacheStats.php new file mode 100644 index 0000000000..7a0d664aa5 --- /dev/null +++ b/maintenance/clearCacheStats.php @@ -0,0 +1,60 @@ +mDescription = "Remove all statistics tracking from the cache"; + } + + public function execute() { + global $wgLocalDatabases, $wgMemc; + foreach ( $wgLocalDatabases as $db ) { + $wgMemc->delete( "$db:stats:request_with_session" ); + $wgMemc->delete( "$db:stats:request_without_session" ); + $wgMemc->delete( "$db:stats:pcache_hit" ); + $wgMemc->delete( "$db:stats:pcache_miss_expired" ); + $wgMemc->delete( "$db:stats:pcache_miss_absent" ); + $wgMemc->delete( "$db:stats:pcache_miss_stub" ); + $wgMemc->delete( "$db:stats:image_cache_hit" ); + $wgMemc->delete( "$db:stats:image_cache_miss" ); + $wgMemc->delete( "$db:stats:image_cache_update" ); + $wgMemc->delete( "$db:stats:diff_cache_hit" ); + $wgMemc->delete( "$db:stats:diff_cache_miss" ); + $wgMemc->delete( "$db:stats:diff_uncacheable" ); + $wgMemc->delete( "$db:stats:job-insert" ); + $wgMemc->delete( "$db:stats:job-pop" ); + } + } +} + +$maintClass = "ClearCacheStats"; +require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/clearInterwikiCache.php b/maintenance/clearInterwikiCache.php new file mode 100644 index 0000000000..88769df2da --- /dev/null +++ b/maintenance/clearInterwikiCache.php @@ -0,0 +1,58 @@ +mDescription = "Clear all interwiki links for all languages from the cache"; + } + + public function execute() { + global $wgLocalDatabases, $wgMemc; + $dbr = wfGetDB( DB_SLAVE ); + $res = $dbr->select( 'interwiki', array( 'iw_prefix' ), false ); + $prefixes = array(); + foreach ( $res as $row ) { + $prefixes[] = $row->iw_prefix; + } + + foreach ( $wgLocalDatabases as $db ) { + $this->output( "$db..." ); + foreach ( $prefixes as $prefix ) { + $wgMemc->delete( "$db:interwiki:$prefix" ); + } + $this->output( "done\n" ); + } + } +} + +$maintClass = "ClearInterwikiCache"; +require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/clear_interwiki_cache.php b/maintenance/clear_interwiki_cache.php deleted file mode 100644 index 88769df2da..0000000000 --- a/maintenance/clear_interwiki_cache.php +++ /dev/null @@ -1,58 +0,0 @@ -mDescription = "Clear all interwiki links for all languages from the cache"; - } - - public function execute() { - global $wgLocalDatabases, $wgMemc; - $dbr = wfGetDB( DB_SLAVE ); - $res = $dbr->select( 'interwiki', array( 'iw_prefix' ), false ); - $prefixes = array(); - foreach ( $res as $row ) { - $prefixes[] = $row->iw_prefix; - } - - foreach ( $wgLocalDatabases as $db ) { - $this->output( "$db..." ); - foreach ( $prefixes as $prefix ) { - $wgMemc->delete( "$db:interwiki:$prefix" ); - } - $this->output( "done\n" ); - } - } -} - -$maintClass = "ClearInterwikiCache"; -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/clear_stats.php b/maintenance/clear_stats.php deleted file mode 100644 index 4581d53276..0000000000 --- a/maintenance/clear_stats.php +++ /dev/null @@ -1,60 +0,0 @@ -mDescription = "Remove all statistics tracking from the cache"; - } - - public function execute() { - global $wgLocalDatabases, $wgMemc; - foreach ( $wgLocalDatabases as $db ) { - $wgMemc->delete( "$db:stats:request_with_session" ); - $wgMemc->delete( "$db:stats:request_without_session" ); - $wgMemc->delete( "$db:stats:pcache_hit" ); - $wgMemc->delete( "$db:stats:pcache_miss_expired" ); - $wgMemc->delete( "$db:stats:pcache_miss_absent" ); - $wgMemc->delete( "$db:stats:pcache_miss_stub" ); - $wgMemc->delete( "$db:stats:image_cache_hit" ); - $wgMemc->delete( "$db:stats:image_cache_miss" ); - $wgMemc->delete( "$db:stats:image_cache_update" ); - $wgMemc->delete( "$db:stats:diff_cache_hit" ); - $wgMemc->delete( "$db:stats:diff_cache_miss" ); - $wgMemc->delete( "$db:stats:diff_uncacheable" ); - $wgMemc->delete( "$db:stats:job-insert" ); - $wgMemc->delete( "$db:stats:job-pop" ); - } - } -} - -$maintClass = "clear_stats"; -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/initSiteStats.php b/maintenance/initSiteStats.php new file mode 100644 index 0000000000..19906592d7 --- /dev/null +++ b/maintenance/initSiteStats.php @@ -0,0 +1,88 @@ + + */ + +require_once( __DIR__ . '/Maintenance.php' ); + +/** + * Maintenance script to re-initialise or update the site statistics table + * + * @ingroup Maintenance + */ +class InitSiteStats extends Maintenance { + public function __construct() { + parent::__construct(); + $this->mDescription = "Re-initialise the site statistics tables"; + $this->addOption( 'update', 'Update the existing statistics (preserves the ss_total_views field)' ); + $this->addOption( 'noviews', "Don't update the page view counter" ); + $this->addOption( 'active', 'Also update active users count' ); + $this->addOption( 'use-master', 'Count using the master database' ); + } + + public function execute() { + $this->output( "Refresh Site Statistics\n\n" ); + $counter = new SiteStatsInit( $this->hasOption( 'use-master' ) ); + + $this->output( "Counting total edits..." ); + $edits = $counter->edits(); + $this->output( "{$edits}\nCounting number of articles..." ); + + $good = $counter->articles(); + $this->output( "{$good}\nCounting total pages..." ); + + $pages = $counter->pages(); + $this->output( "{$pages}\nCounting number of users..." ); + + $users = $counter->users(); + $this->output( "{$users}\nCounting number of images..." ); + + $image = $counter->files(); + $this->output( "{$image}\n" ); + + if ( !$this->hasOption( 'noviews' ) ) { + $this->output( "Counting total page views..." ); + $views = $counter->views(); + $this->output( "{$views}\n" ); + } + + if ( $this->hasOption( 'active' ) ) { + $this->output( "Counting active users..." ); + $active = SiteStatsUpdate::cacheUpdate( wfGetDB( DB_MASTER ) ); + $this->output( "{$active}\n" ); + } + + $this->output( "\nUpdating site statistics..." ); + + if ( $this->hasOption( 'update' ) ) { + $counter->update(); + } else { + $counter->refresh(); + } + + $this->output( "done.\n" ); + } +} + +$maintClass = "InitSiteStats"; +require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/initStats.php b/maintenance/initStats.php deleted file mode 100644 index 5d8b8866a9..0000000000 --- a/maintenance/initStats.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ - -require_once( __DIR__ . '/Maintenance.php' ); - -/** - * Maintenance script to re-initialise or update the site statistics table - * - * @ingroup Maintenance - */ -class InitStats extends Maintenance { - public function __construct() { - parent::__construct(); - $this->mDescription = "Re-initialise the site statistics tables"; - $this->addOption( 'update', 'Update the existing statistics (preserves the ss_total_views field)' ); - $this->addOption( 'noviews', "Don't update the page view counter" ); - $this->addOption( 'active', 'Also update active users count' ); - $this->addOption( 'use-master', 'Count using the master database' ); - } - - public function execute() { - $this->output( "Refresh Site Statistics\n\n" ); - $counter = new SiteStatsInit( $this->hasOption( 'use-master' ) ); - - $this->output( "Counting total edits..." ); - $edits = $counter->edits(); - $this->output( "{$edits}\nCounting number of articles..." ); - - $good = $counter->articles(); - $this->output( "{$good}\nCounting total pages..." ); - - $pages = $counter->pages(); - $this->output( "{$pages}\nCounting number of users..." ); - - $users = $counter->users(); - $this->output( "{$users}\nCounting number of images..." ); - - $image = $counter->files(); - $this->output( "{$image}\n" ); - - if ( !$this->hasOption( 'noviews' ) ) { - $this->output( "Counting total page views..." ); - $views = $counter->views(); - $this->output( "{$views}\n" ); - } - - if ( $this->hasOption( 'active' ) ) { - $this->output( "Counting active users..." ); - $active = SiteStatsUpdate::cacheUpdate( wfGetDB( DB_MASTER ) ); - $this->output( "{$active}\n" ); - } - - $this->output( "\nUpdating site statistics..." ); - - if ( $this->hasOption( 'update' ) ) { - $counter->update(); - } else { - $counter->refresh(); - } - - $this->output( "done.\n" ); - } -} - -$maintClass = "InitStats"; -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/proxyCheck.php b/maintenance/proxyCheck.php new file mode 100644 index 0000000000..2ccf703eb1 --- /dev/null +++ b/maintenance/proxyCheck.php @@ -0,0 +1,70 @@ +> /home/tstarling/open/proxy.log`; diff --git a/maintenance/proxy_check.php b/maintenance/proxy_check.php deleted file mode 100644 index 2ccf703eb1..0000000000 --- a/maintenance/proxy_check.php +++ /dev/null @@ -1,70 +0,0 @@ -> /home/tstarling/open/proxy.log`; diff --git a/maintenance/showCacheStats.php b/maintenance/showCacheStats.php new file mode 100644 index 0000000000..8f2386800e --- /dev/null +++ b/maintenance/showCacheStats.php @@ -0,0 +1,106 @@ +mDescription = "Show statistics from the cache"; + parent::__construct(); + } + + public function getDbType() { + return Maintenance::DB_NONE; + } + + public function execute() { + global $wgMemc; + + // Can't do stats if + if ( get_class( $wgMemc ) == 'EmptyBagOStuff' ) { + $this->error( "You are running EmptyBagOStuff, I can not provide any statistics.", true ); + } + $session = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_with_session' ) ) ); + $noSession = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_without_session' ) ) ); + $total = $session + $noSession; + if ( $total == 0 ) { + $this->error( "You either have no stats or the cache isn't running. Aborting.", true ); + } + $this->output( "Requests\n" ); + $this->output( sprintf( "with session: %-10d %6.2f%%\n", $session, $session / $total * 100 ) ); + $this->output( sprintf( "without session: %-10d %6.2f%%\n", $noSession, $noSession / $total * 100 ) ); + $this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) ); + + + $this->output( "\nParser cache\n" ); + $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_hit' ) ) ); + $expired = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_expired' ) ) ); + $absent = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_absent' ) ) ); + $stub = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_stub' ) ) ); + $total = $hits + $expired + $absent + $stub; + if ( $total ) { + $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); + $this->output( sprintf( "expired: %-10d %6.2f%%\n", $expired, $expired / $total * 100 ) ); + $this->output( sprintf( "absent: %-10d %6.2f%%\n", $absent, $absent / $total * 100 ) ); + $this->output( sprintf( "stub threshold: %-10d %6.2f%%\n", $stub, $stub / $total * 100 ) ); + $this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) ); + } else { + $this->output( "no statistics available\n" ); + } + + $this->output( "\nImage cache\n" ); + $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_hit' ) ) ); + $misses = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_miss' ) ) ); + $updates = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_update' ) ) ); + $total = $hits + $misses; + if ( $total ) { + $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); + $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); + $this->output( sprintf( "updates: %-10d\n", $updates ) ); + } else { + $this->output( "no statistics available\n" ); + } + + $this->output( "\nDiff cache\n" ); + $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_cache_hit' ) ) ); + $misses = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_cache_miss' ) ) ); + $uncacheable = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_uncacheable' ) ) ); + $total = $hits + $misses + $uncacheable; + if ( $total ) { + $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); + $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); + $this->output( sprintf( "uncacheable: %-10d %6.2f%%\n", $uncacheable, $uncacheable / $total * 100 ) ); + } else { + $this->output( "no statistics available\n" ); + } + } +} + +$maintClass = "ShowCacheStats"; +require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/showSiteStats.php b/maintenance/showSiteStats.php new file mode 100644 index 0000000000..e7359b2f63 --- /dev/null +++ b/maintenance/showSiteStats.php @@ -0,0 +1,73 @@ + + * Based on initSiteStats.php by: + * @author Brion Vibber + * @author Rob Church + * + * @license GNU General Public License 2.0 or later + */ + +require_once( __DIR__ . '/Maintenance.php' ); + +/** + * Maintenance script to show the cached statistics. + * + * @ingroup Maintenance + */ +class ShowSiteStats extends Maintenance { + public function __construct() { + parent::__construct(); + $this->mDescription = "Show the cached statistics"; + } + public function execute() { + $fields = array( + 'ss_total_views' => 'Total views', + 'ss_total_edits' => 'Total edits', + 'ss_good_articles' => 'Number of articles', + 'ss_total_pages' => 'Total pages', + 'ss_users' => 'Number of users', + 'ss_images' => 'Number of images', + ); + + // Get cached stats from slave database + $dbr = wfGetDB( DB_SLAVE ); + $stats = $dbr->selectRow( 'site_stats', '*', '', __METHOD__ ); + + // Get maximum size for each column + $max_length_value = $max_length_desc = 0; + foreach ( $fields as $field => $desc ) { + $max_length_value = max( $max_length_value, strlen( $stats->$field ) ); + $max_length_desc = max( $max_length_desc, strlen( $desc ) ) ; + } + + // Show them + foreach ( $fields as $field => $desc ) { + $this->output( sprintf( "%-{$max_length_desc}s: %{$max_length_value}d\n", $desc, $stats->$field ) ); + } + } +} + +$maintClass = "ShowSiteStats"; +require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/showStats.php b/maintenance/showStats.php deleted file mode 100644 index 3036406123..0000000000 --- a/maintenance/showStats.php +++ /dev/null @@ -1,73 +0,0 @@ - - * Based on initStats.php by: - * @author Brion Vibber - * @author Rob Church - * - * @license GNU General Public License 2.0 or later - */ - -require_once( __DIR__ . '/Maintenance.php' ); - -/** - * Maintenance script to show the cached statistics. - * - * @ingroup Maintenance - */ -class ShowStats extends Maintenance { - public function __construct() { - parent::__construct(); - $this->mDescription = "Show the cached statistics"; - } - public function execute() { - $fields = array( - 'ss_total_views' => 'Total views', - 'ss_total_edits' => 'Total edits', - 'ss_good_articles' => 'Number of articles', - 'ss_total_pages' => 'Total pages', - 'ss_users' => 'Number of users', - 'ss_images' => 'Number of images', - ); - - // Get cached stats from slave database - $dbr = wfGetDB( DB_SLAVE ); - $stats = $dbr->selectRow( 'site_stats', '*', '', __METHOD__ ); - - // Get maximum size for each column - $max_length_value = $max_length_desc = 0; - foreach ( $fields as $field => $desc ) { - $max_length_value = max( $max_length_value, strlen( $stats->$field ) ); - $max_length_desc = max( $max_length_desc, strlen( $desc ) ) ; - } - - // Show them - foreach ( $fields as $field => $desc ) { - $this->output( sprintf( "%-{$max_length_desc}s: %{$max_length_value}d\n", $desc, $stats->$field ) ); - } - } -} - -$maintClass = "ShowStats"; -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/stats.php b/maintenance/stats.php deleted file mode 100644 index be448f9946..0000000000 --- a/maintenance/stats.php +++ /dev/null @@ -1,106 +0,0 @@ -mDescription = "Show statistics from the cache"; - parent::__construct(); - } - - public function getDbType() { - return Maintenance::DB_NONE; - } - - public function execute() { - global $wgMemc; - - // Can't do stats if - if ( get_class( $wgMemc ) == 'EmptyBagOStuff' ) { - $this->error( "You are running EmptyBagOStuff, I can not provide any statistics.", true ); - } - $session = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_with_session' ) ) ); - $noSession = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_without_session' ) ) ); - $total = $session + $noSession; - if ( $total == 0 ) { - $this->error( "You either have no stats or the cache isn't running. Aborting.", true ); - } - $this->output( "Requests\n" ); - $this->output( sprintf( "with session: %-10d %6.2f%%\n", $session, $session / $total * 100 ) ); - $this->output( sprintf( "without session: %-10d %6.2f%%\n", $noSession, $noSession / $total * 100 ) ); - $this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) ); - - - $this->output( "\nParser cache\n" ); - $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_hit' ) ) ); - $expired = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_expired' ) ) ); - $absent = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_absent' ) ) ); - $stub = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_stub' ) ) ); - $total = $hits + $expired + $absent + $stub; - if ( $total ) { - $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); - $this->output( sprintf( "expired: %-10d %6.2f%%\n", $expired, $expired / $total * 100 ) ); - $this->output( sprintf( "absent: %-10d %6.2f%%\n", $absent, $absent / $total * 100 ) ); - $this->output( sprintf( "stub threshold: %-10d %6.2f%%\n", $stub, $stub / $total * 100 ) ); - $this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) ); - } else { - $this->output( "no statistics available\n" ); - } - - $this->output( "\nImage cache\n" ); - $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_hit' ) ) ); - $misses = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_miss' ) ) ); - $updates = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_update' ) ) ); - $total = $hits + $misses; - if ( $total ) { - $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); - $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); - $this->output( sprintf( "updates: %-10d\n", $updates ) ); - } else { - $this->output( "no statistics available\n" ); - } - - $this->output( "\nDiff cache\n" ); - $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_cache_hit' ) ) ); - $misses = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_cache_miss' ) ) ); - $uncacheable = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_uncacheable' ) ) ); - $total = $hits + $misses + $uncacheable; - if ( $total ) { - $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); - $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); - $this->output( sprintf( "uncacheable: %-10d %6.2f%%\n", $uncacheable, $uncacheable / $total * 100 ) ); - } else { - $this->output( "no statistics available\n" ); - } - } -} - -$maintClass = "CacheStats"; -require_once( RUN_MAINTENANCE_IF_MAIN );