use MediaWiki\ProcOpenError;
use MediaWiki\Session\SessionManager;
use MediaWiki\Shell\Shell;
-use Wikimedia\ScopedCallback;
use Wikimedia\WrappedString;
+use Wikimedia\AtEase\AtEase;
/**
* Load an extension
if ( $wasRelative ) {
$url = "http:$url";
}
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$bits = parse_url( $url );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
// parse_url() returns an array without scheme for some invalid URLs, e.g.
// parse_url("%0Ahttp://example.com") == [ 'host' => '%0Ahttp', 'path' => 'example.com' ]
if ( !$bits || !isset( $bits['scheme'] ) ) {
return $besttype;
}
-/**
- * Reference-counted warning suppression
- *
- * @deprecated since 1.26, use Wikimedia\suppressWarnings() directly
- * @param bool $end
- */
-function wfSuppressWarnings( $end = false ) {
- Wikimedia\suppressWarnings( $end );
-}
-
-/**
- * @deprecated since 1.26, use Wikimedia\restoreWarnings() directly
- * Restore error level to previous value
- */
-function wfRestoreWarnings() {
- Wikimedia\restoreWarnings();
-}
-
/**
* Get a timestamp string in one of various formats
*
/**
* Convenience function; returns MediaWiki timestamp for the present time.
*
- * @return string
+ * @return string TS_MW timestamp
*/
function wfTimestampNow() {
- # return NOW
return MWTimestamp::now( TS_MW );
}
}
// Turn off the normal warning, we're doing our own below
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$ok = mkdir( $dir, $mode, true ); // PHP5 <3
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( !$ok ) {
// directory may have been created on another request since we last checked
# This check may also protect against code injection in
# case of broken installations.
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( !$haveDiff3 ) {
wfDebug( "diff3 not found\n" );
}
global $wgDiff;
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$haveDiff = $wgDiff && file_exists( $wgDiff );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
# This check may also protect against code injection in
# case of broken installations.
return implode( DIRECTORY_SEPARATOR, $pieces );
}
-/**
- * Reset the session id
- *
- * @deprecated since 1.27, use MediaWiki\Session\SessionManager instead
- * @since 1.22
- */
-function wfResetSessionID() {
- wfDeprecated( __FUNCTION__, '1.27' );
- $session = SessionManager::getGlobalSession();
- $delay = $session->delaySave();
-
- $session->resetId();
-
- // Make sure a session is started, since that's what the old
- // wfResetSessionID() did.
- if ( session_id() !== $session->getId() ) {
- wfSetupSession( $session->getId() );
- }
-
- ScopedCallback::consume( $delay );
-}
-
/**
* Initialise php session
*
if ( session_id() !== $session->getId() ) {
session_id( $session->getId() );
}
- Wikimedia\quietCall( 'session_start' );
+ AtEase::quietCall( 'session_start' );
}
/**
}
}
-/**
- * Get the load balancer factory object
- *
- * @deprecated since 1.27, use MediaWikiServices::getInstance()->getDBLoadBalancerFactory() instead.
- * TODO: Remove in MediaWiki 1.35
- *
- * @return \Wikimedia\Rdbms\LBFactory
- */
-function wfGetLBFactory() {
- wfDeprecated( __METHOD__, '1.27' );
- return MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
-}
-
/**
* Find a file.
* @deprecated since 1.34, use MediaWikiServices
return $lbFactory->waitForReplication( $opts );
}
-/**
- * Count down from $seconds to zero on the terminal, with a one-second pause
- * between showing each number. For use in command-line scripts.
- *
- * @deprecated since 1.31, use Maintenance::countDown()
- *
- * @codeCoverageIgnore
- * @param int $seconds
- */
-function wfCountDown( $seconds ) {
- wfDeprecated( __FUNCTION__, '1.31' );
- for ( $i = $seconds; $i >= 0; $i-- ) {
- if ( $i != $seconds ) {
- echo str_repeat( "\x08", strlen( $i + 1 ) );
- }
- echo $i;
- flush();
- if ( $i ) {
- sleep( 1 );
- }
- }
- echo "\n";
-}
-
/**
* Replace all invalid characters with '-'.
* Additional characters can be defined in $wgIllegalFileChars (see T22489).
return $val;
}
-/**
- * Get the normalised IETF language tag
- * See unit test for examples.
- * See mediawiki.language.bcp47 for the JavaScript implementation.
- *
- * @deprecated since 1.31, use LanguageCode::bcp47() directly.
- *
- * @param string $code The language code.
- * @return string The language code which complying with BCP 47 standards.
- */
-function wfBCP47( $code ) {
- wfDeprecated( __METHOD__, '1.31' );
- return LanguageCode::bcp47( $code );
-}
-
/**
* Get a specific cache object.
*
function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) {
# Handle redirects; callers almost always hit wfFindFile() anyway,
# so just use that method because it has a fast process cache.
- $file = wfFindFile( $name ); // get the final name
+ $file = MediaWikiServices::getInstance()->getRepoGroup()->findFile( $name ); // get the final name
$name = $file ? $file->getTitle()->getDBkey() : $name;
# Run the extension hook