MediaWiki  1.23.8
getLagTimes.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/Maintenance.php';
25 
31 class GetLagTimes extends Maintenance {
32  public function __construct() {
33  parent::__construct();
34  $this->mDescription = "Dump replication lag times";
35  }
36 
37  public function execute() {
38  $lb = wfGetLB();
39 
40  if ( $lb->getServerCount() == 1 ) {
41  $this->error( "This script dumps replication lag times, but you don't seem to have\n"
42  . "a multi-host db server configuration." );
43  } else {
44  $lags = $lb->getLagTimes();
45  foreach ( $lags as $n => $lag ) {
46  $host = $lb->getServerName( $n );
47  if ( IP::isValid( $host ) ) {
48  $ip = $host;
49  $host = gethostbyaddr( $host );
50  } else {
51  $ip = gethostbyname( $host );
52  }
53  $starLen = min( intval( $lag ), 40 );
54  $stars = str_repeat( '*', $starLen );
55  $this->output( sprintf( "%10s %20s %3d %s\n", $ip, $host, $lag, $stars ) );
56  }
57  }
58  }
59 }
60 
61 $maintClass = "GetLagTimes";
62 require_once RUN_MAINTENANCE_IF_MAIN;
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
GetLagTimes\__construct
__construct()
Default constructor.
Definition: getLagTimes.php:32
GetLagTimes\execute
execute()
Do the actual work.
Definition: getLagTimes.php:37
wfGetLB
wfGetLB( $wiki=false)
Get a load balancer object.
Definition: GlobalFunctions.php:3669
$n
$n
Definition: RandomTest.php:76
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
$maintClass
$maintClass
Definition: getLagTimes.php:61
$lb
if( $wgAPIRequestLog) $lb
Definition: api.php:126
GetLagTimes
Maintenance script that displays replication lag times.
Definition: getLagTimes.php:31
IP\isValid
static isValid( $ip)
Validate an IP address.
Definition: IP.php:108
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Maintenance\error
error( $err, $die=0)
Throw an error to the user.
Definition: Maintenance.php:333
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:314