wfEntryPointCheck( 'text' );
use MediaWiki\Shell\Shell;
+use Wikimedia\Rdbms\IResultWrapper;
/**
* @defgroup MaintenanceArchive Maintenance archives
$maintClass = false;
+// Some extensions rely on MW_INSTALL_PATH to find core files to include. Setting it here helps them
+// if they're included by a core script (like DatabaseUpdater) after Maintenance.php has already
+// been run.
+if ( strval( getenv( 'MW_INSTALL_PATH' ) ) === '' ) {
+ putenv( 'MW_INSTALL_PATH=' . realpath( __DIR__ . '/..' ) );
+}
+
use Wikimedia\Rdbms\IDatabase;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
* their own constructors
*/
public function __construct() {
- // Setup $IP, using MW_INSTALL_PATH if it exists
global $IP;
- $IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== ''
- ? getenv( 'MW_INSTALL_PATH' )
- : realpath( __DIR__ . '/..' );
+ $IP = getenv( 'MW_INSTALL_PATH' );
$this->addDefaultParams();
register_shutdown_function( [ $this, 'outputChanneled' ], false );
wfDeprecated( __METHOD__ . ' without an $argId', '1.33' );
}
- return $this->hasArg( $argId ) ? $this->mArgs[$argId] : $default;
+ return $this->mArgs[$argId] ?? $default;
}
/**
/**
* Perform a search index update with locking
* @param int $maxLockTime The maximum time to keep the search index locked.
- * @param string $callback The function that will update the function.
+ * @param callable $callback The function that will update the function.
* @param IMaintainableDatabase $dbw
- * @param array $results
+ * @param array|IResultWrapper $results
*/
public function updateSearchIndex( $maxLockTime, $callback, $dbw, $results ) {
$lockTime = time();
return false;
}
- $db->insert( 'updatelog', [ 'ul_key' => $key ], __METHOD__, 'IGNORE' );
+ $db->insert( 'updatelog', [ 'ul_key' => $key ], __METHOD__, [ 'IGNORE' ] );
return true;
}