use StatusValue;
use User;
use WebRequest;
+use Wikimedia\ObjectFactory;
/**
* This serves as the entry point to the authentication system.
public function checkAccountCreatePermissions( User $creator ) {
// Wiki is read-only?
if ( wfReadOnly() ) {
- return Status::newFatal( 'readonlytext', wfReadOnlyReason() );
+ return Status::newFatal( wfMessage( 'readonlytext', wfReadOnlyReason() ) );
}
// This is awful, this permission check really shouldn't go through Title.
// Fetch the user ID from the master, so that we don't try to create the user
// when they already exist, due to replication lag
// @codeCoverageIgnoreStart
- if ( !$localId && wfGetLB()->getReaderIndex() != 0 ) {
+ if (
+ !$localId &&
+ MediaWikiServices::getInstance()->getDBLoadBalancer()->getReaderIndex() != 0
+ ) {
$localId = User::idFromName( $username, User::READ_LATEST );
$flags = User::READ_LATEST;
}
] );
$user->setId( 0 );
$user->loadFromId();
- return Status::newFatal( 'readonlytext', wfReadOnlyReason() );
+ return Status::newFatal( wfMessage( 'readonlytext', wfReadOnlyReason() ) );
}
// Check the session, if we tried to create this user already there's
* @param AuthenticationRequest[] &$reqs
* @param string $action
* @param string|null $username
- * @param boolean $forceAction
+ * @param bool $forceAction
*/
private function fillRequests( array &$reqs, $action, $username, $forceAction = false ) {
foreach ( $reqs as $req ) {
$ret = [];
foreach ( $specs as $spec ) {
- $provider = \ObjectFactory::getObjectFromSpec( $spec );
+ $provider = ObjectFactory::getObjectFromSpec( $spec );
if ( !$provider instanceof $class ) {
throw new \RuntimeException(
"Expected instance of $class, got " . get_class( $provider )