3 # Run this script periodically if you have miser mode enabled, to refresh the caches
5 require_once( 'commandLine.inc' );
7 require_once( 'SpecialPage.php' );
8 require_once( 'QueryPage.php' );
11 $dbw =& wfGetDB( DB_MASTER
);
13 foreach ( $wgQueryPages as $page ) {
14 list( $class, $special ) = $page;
16 $specialObj = SpecialPage
::getPage( $special );
18 print "No such special page: $special\n";
21 $file = $specialObj->getFile();
23 require_once( $file );
25 $queryPage = new $class;
27 printf( '%-30s', $special );
29 if ( $queryPage->isExpensive() ) {
30 $t1 = explode( ' ', microtime() );
32 $num = $queryPage->recache();
33 $t2 = explode( ' ', microtime() );
35 if ( $num === false ) {
36 print "FAILED: database error\n";
38 print "got $num rows in ";
40 $elapsed = ($t2[0] - $t1[0]) +
($t2[1] - $t1[1]);
41 $hours = intval( $elapsed / 3600 );
42 $minutes = intval( $elapsed %
3600 / 60 );
43 $seconds = $elapsed - $hours * 3600 - $minutes * 60;
48 print $minutes . 'm ';
50 printf( "%.2fs\n", $seconds );
53 # Reopen any connections that have closed
54 if ( !$wgLoadBalancer->pingAll()) {
57 print "Connection failed, reconnecting in 10 seconds...\n";
59 } while ( !$wgLoadBalancer->pingAll() );
60 print "Reconnected\n\n";
63 $dbw->immediateCommit();
66 print "cheap, skipped\n";