13require_once __DIR__ .
'/Maintenance.php';
27 parent::__construct();
29 $this->
addOption(
'r',
"Don't exit immediately, but show the lag every 5 seconds" );
37 $serverCount = $lb->getServerCount();
38 for ( $i = 1; $i < $serverCount; $i++ ) {
39 $hostname = $lb->getServerName( $i );
40 $this->
output( sprintf(
"%-12s ", $hostname ) );
45 $lags = $lb->getLagTimes();
47 $this->
output( gmdate(
'H:i:s' ) .
' ' );
48 foreach ( $lags as $lag ) {
52 $lag ===
false ?
'replication stopped or errored' : $lag
58 }
while ( !$this->stopReporting );
61 $lags = $lb->getLagTimes();
62 foreach ( $lags as $i => $lag ) {
63 $name = $lb->getServerName( $i );
68 $lag ===
false ?
'replication stopped or errored' : $lag
78require_once RUN_MAINTENANCE_IF_MAIN;
Maintenance script to show database lag.
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
hasOption( $name)
Checks to see if a particular option was set.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.