"http://en.wikipedia.org. This is sometimes necessary because " .
"server name detection may fail in command line scripts.", false, true );
$this->addOption( 'profiler', 'Profiler output format (usually "text")', false, true );
+ // This is named --mwdebug, because --debug would conflict in the phpunit.php CLI script.
+ $this->addOption( 'mwdebug', 'Enable built-in MediaWiki development settings', false, true );
# Save generic options to display them separately in help
$this->mGenericParameters = $this->mParams;
* Do some sanity checking and basic setup
*/
public function setup() {
- global $IP, $wgCommandLineMode, $wgRequestTime;
+ global $IP, $wgCommandLineMode;
# Abort if called from a web server
# wfIsCLI() is not available yet
# But sometimes this doesn't seem to be the case.
ini_set( 'max_execution_time', 0 );
- $wgRequestTime = microtime( true );
-
# Define us as being in MediaWiki
define( 'MEDIAWIKI', true );
// ... append parameters ...
if ( $this->mParams ) {
- $output .= " [--" . implode( array_keys( $this->mParams ), "|--" ) . "]";
+ $output .= " [--" . implode( "|--", array_keys( $this->mParams ) ) . "]";
}
// ... and append arguments.
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->destroy();
}
+ # Apply debug settings
+ if ( $this->hasOption( 'mwdebug' ) ) {
+ require __DIR__ . '/../includes/DevelopmentSettings.php';
+ }
+
// Per-script profiling; useful for debugging
$this->activateProfiler();
$wgShowSQLErrors = true;
- MediaWiki\suppressWarnings();
+ Wikimedia\suppressWarnings();
set_time_limit( 0 );
- MediaWiki\restoreWarnings();
+ Wikimedia\restoreWarnings();
$this->adjustMemoryLimit();
}
* This function has the same parameters as wfGetDB()
*
* @param int $db DB index (DB_REPLICA/DB_MASTER)
- * @param array $groups default: empty array
+ * @param string|string[] $groups default: empty array
* @param string|bool $wiki default: current wiki
* @return IMaintainableDatabase
*/