use Config;
use ConfigFactory;
use CryptHKDF;
-use CryptRand;
+use DateFormatterFactory;
use EventRelayerGroup;
use GenderCache;
use GlobalVarConfig;
use Hooks;
use IBufferingStatsdDataFactory;
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
+ use MediaWiki\Block\BlockRestrictionStore;
use MediaWiki\Http\HttpRequestFactory;
use MediaWiki\Permissions\PermissionManager;
use MediaWiki\Preferences\PreferencesFactory;
use Wikimedia\Services\NoSuchServiceException;
use MediaWiki\Interwiki\InterwikiLookup;
use MagicWordFactory;
+use MediaWiki\Storage\PageEditStash;
/**
* Service locator for MediaWiki core services.
return $this->getService( 'BlobStoreFactory' );
}
+ /**
+ * @since 1.33
+ * @return BlockRestrictionStore
+ */
+ public function getBlockRestrictionStore() : BlockRestrictionStore {
+ return $this->getService( 'BlockRestrictionStore' );
+ }
+
/**
* Returns the Config object containing the bootstrap configuration.
* Bootstrap configuration would typically include database credentials
}
/**
- * @since 1.28
- * @deprecated since 1.32, use random_bytes()/random_int()
- * @return CryptRand
+ * @since 1.33
+ * @return DateFormatterFactory
*/
- public function getCryptRand() {
- wfDeprecated( __METHOD__, '1.32' );
- return $this->getService( 'CryptRand' );
+ public function getDateFormatterFactory() {
+ return $this->getService( 'DateFormatterFactory' );
}
/**
}
/**
- * @since 1.33
+ * @since 1.34
* @return NamespaceInfo
*/
public function getNamespaceInfo() : NamespaceInfo {
return $this->getService( 'OldRevisionImporter' );
}
+ /**
+ * @return PageEditStash
+ * @since 1.34
+ */
+ public function getPageEditStash() {
+ return $this->getService( 'PageEditStash' );
+ }
+
/**
* @since 1.29
* @return Parser
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
use MediaWiki\Auth\AuthManager;
+ use MediaWiki\Block\BlockRestrictionStore;
use MediaWiki\Config\ConfigRepository;
use MediaWiki\Interwiki\ClassicInterwikiLookup;
use MediaWiki\Interwiki\InterwikiLookup;
use MediaWiki\Storage\BlobStoreFactory;
use MediaWiki\Storage\NameTableStoreFactory;
use MediaWiki\Storage\SqlBlobStore;
+use MediaWiki\Storage\PageEditStash;
return [
'ActorMigration' => function ( MediaWikiServices $services ) : ActorMigration {
);
},
+ 'BlockRestrictionStore' => function ( MediaWikiServices $services ) : BlockRestrictionStore {
+ return new BlockRestrictionStore(
+ $services->getDBLoadBalancer()
+ );
+ },
+
'CommentStore' => function ( MediaWikiServices $services ) : CommentStore {
return new CommentStore(
$services->getContentLanguage(),
return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), $cache, $context );
},
- 'CryptRand' => function () : CryptRand {
- return new CryptRand();
+ 'DateFormatterFactory' => function () : DateFormatterFactory {
+ return new DateFormatterFactory;
},
'DBLoadBalancer' => function ( MediaWikiServices $services ) : Wikimedia\Rdbms\LoadBalancer {
);
},
+ 'PageEditStash' => function ( MediaWikiServices $services ) : PageEditStash {
+ $config = $services->getMainConfig();
+
+ return new PageEditStash(
+ ObjectCache::getLocalClusterInstance(),
+ $services->getDBLoadBalancer(),
+ LoggerFactory::getInstance( 'StashEdit' ),
+ $services->getStatsdDataFactory(),
+ defined( 'MEDIAWIKI_JOB_RUNNER' ) || $config->get( 'CommandLineMode' )
+ ? PageEditStash::INITIATOR_JOB_OR_CLI
+ : PageEditStash::INITIATOR_USER
+ );
+ },
+
'Parser' => function ( MediaWikiServices $services ) : Parser {
return $services->getParserFactory()->create();
},
wfUrlProtocols(),
$services->getSpecialPageFactory(),
$services->getMainConfig(),
- $services->getLinkRendererFactory()
+ $services->getLinkRendererFactory(),
+ $services->getNamespaceInfo()
);
},
$config->get( 'WhitelistRead' ),
$config->get( 'WhitelistReadRegexp' ),
$config->get( 'EmailConfirmToEdit' ),
- $config->get( 'BlockDisablesLogin' ) );
+ $config->get( 'BlockDisablesLogin' ),
+ $services->getNamespaceInfo()
+ );
},
'PreferencesFactory' => function ( MediaWikiServices $services ) : PreferencesFactory {
$config,
LoggerFactory::getInstance( 'resourceloader' )
);
+
$rl->addSource( $config->get( 'ResourceLoaderSources' ) );
+
+ // Core modules, then extension/skin modules
$rl->register( include "$IP/resources/Resources.php" );
+ $rl->register( $config->get( 'ResourceModules' ) );
+ Hooks::run( 'ResourceLoaderRegisterModules', [ &$rl ] );
+
+ if ( $config->get( 'EnableJavaScriptTest' ) === true ) {
+ $rl->registerTestModules();
+ }
return $rl;
},
$services->getContentLanguage(),
$services->getGenderCache(),
$services->getMainConfig()->get( 'LocalInterwikis' ),
- $services->getInterwikiLookup()
+ $services->getInterwikiLookup(),
+ $services->getNamespaceInfo()
);
},
* @ingroup SpecialPage
*/
- use MediaWiki\Block\BlockRestriction;
use MediaWiki\Block\Restriction\PageRestriction;
use MediaWiki\Block\Restriction\NamespaceRestriction;
+ use MediaWiki\MediaWikiServices;
/**
* A special page that allows users with 'block' right to block users from
* @return array
*/
protected function getFormFields() {
- global $wgBlockAllowsUTEdit;
+ $conf = $this->getConfig();
+ $enablePartialBlocks = $conf->get( 'EnablePartialBlocks' );
+ $blockAllowsUTEdit = $conf->get( 'BlockAllowsUTEdit' );
$this->getOutput()->enableOOUI();
$suggestedDurations = self::getSuggestedDurations();
- $conf = $this->getConfig();
- $enablePartialBlocks = $conf->get( 'EnablePartialBlocks' );
-
$a = [];
$a['Target'] = [
];
}
- if ( $wgBlockAllowsUTEdit ) {
+ if ( $blockAllowsUTEdit ) {
$a['DisableUTEdit'] = [
'type' => 'check',
'label-message' => 'ipb-disableusertalk',
$currentBlock->isSitewide( $block->isSitewide() );
// Set the block id of the restrictions.
+ $blockRestrictionStore = MediaWikiServices::getInstance()->getBlockRestrictionStore();
$currentBlock->setRestrictions(
- BlockRestriction::setBlockId( $currentBlock->getId(), $restrictions )
+ $blockRestrictionStore->setBlockId( $currentBlock->getId(), $restrictions )
);
}
*
* @todo strtotime() only accepts English strings. This means the expiry input
* can only be specified in English.
- * @see https://secure.php.net/manual/en/function.strtotime.php
+ * @see https://www.php.net/manual/en/function.strtotime.php
*
* @param string $expiry Whatever was typed into the form
* @return string|bool Timestamp or 'infinity' or false on error.