X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=f6e59122e534c4573bd64416dacc7f86a6358fa5;hb=83524ae39afc953f33724ffd5ea35ac72ccd6134;hp=78d9850f075e22e56cbe75d1abb735333f313e30;hpb=b191e5e860f24e1dd05e3d3d782364e4ea75b176;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 78d9850f07..f6e59122e5 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -979,7 +979,7 @@ class Title implements LinkTarget { && ( !$this->mContentModel || $flags === self::GAID_FOR_UPDATE ) && $this->getArticleID( $flags ) ) { - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->addLinkObj( $this ); # in case we already had an article ID $this->mContentModel = $linkCache->getGoodLinkFieldObj( $this, 'model' ); } @@ -2553,7 +2553,10 @@ class Title implements LinkTarget { return $errors; } - if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) { + if ( $wgEmailConfirmToEdit + && !$user->isEmailConfirmed() + && $action === 'edit' + ) { $errors[] = [ 'confirmedittext' ]; } @@ -3086,9 +3089,7 @@ class Title implements LinkTarget { if ( !$this->mRestrictionsLoaded ) { $this->loadRestrictions(); } - return isset( $this->mRestrictions[$action] ) - ? $this->mRestrictions[$action] - : []; + return $this->mRestrictions[$action] ?? []; } /** @@ -3116,7 +3117,7 @@ class Title implements LinkTarget { if ( !$this->mRestrictionsLoaded ) { $this->loadRestrictions(); } - return isset( $this->mRestrictionsExpiry[$action] ) ? $this->mRestrictionsExpiry[$action] : false; + return $this->mRestrictionsExpiry[$action] ?? false; } /** @@ -3432,7 +3433,7 @@ class Title implements LinkTarget { $this->mArticleID = 0; return $this->mArticleID; } - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); if ( $flags & self::GAID_FOR_UPDATE ) { $oldUpdate = $linkCache->forUpdate( true ); $linkCache->clearLink( $this ); @@ -3462,7 +3463,7 @@ class Title implements LinkTarget { return $this->mRedirect; } - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->addLinkObj( $this ); # in case we already had an article ID $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' ); if ( $cached === null ) { @@ -3496,7 +3497,7 @@ class Title implements LinkTarget { $this->mLength = 0; return $this->mLength; } - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->addLinkObj( $this ); # in case we already had an article ID $cached = $linkCache->getGoodLinkFieldObj( $this, 'length' ); if ( $cached === null ) { @@ -3524,7 +3525,7 @@ class Title implements LinkTarget { $this->mLatestID = 0; return $this->mLatestID; } - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->addLinkObj( $this ); # in case we already had an article ID $cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' ); if ( $cached === null ) { @@ -3549,7 +3550,7 @@ class Title implements LinkTarget { * @param int $newid The new Article ID */ public function resetArticleID( $newid ) { - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->clearLink( $this ); if ( $newid === false ) { @@ -3571,7 +3572,7 @@ class Title implements LinkTarget { } public static function clearCaches() { - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->clear(); $titleCache = self::getTitleCache(); @@ -3675,7 +3676,7 @@ class Title implements LinkTarget { $retVal = []; if ( $res->numRows() ) { - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); foreach ( $res as $row ) { $titleObj = self::makeTitle( $row->page_namespace, $row->page_title ); if ( $titleObj ) { @@ -3743,7 +3744,7 @@ class Title implements LinkTarget { ); $retVal = []; - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); foreach ( $res as $row ) { if ( $row->page_id ) { $titleObj = self::newFromRow( $row ); @@ -4942,7 +4943,7 @@ class Title implements LinkTarget { // check, if the page language could be saved in the database, and if so and // the value is not requested already, lookup the page language using LinkCache if ( $wgPageLanguageUseDB && $this->mDbPageLanguage === false ) { - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->addLinkObj( $this ); $this->mDbPageLanguage = $linkCache->getGoodLinkFieldObj( $this, 'lang' ); } @@ -4982,7 +4983,7 @@ class Title implements LinkTarget { $langObj = $contentHandler->getPageLanguage( $this ); $this->mPageLanguage = [ $langObj->getCode(), $wgLanguageCode ]; } else { - $langObj = wfGetLangObj( $this->mPageLanguage[0] ); + $langObj = Language::factory( $this->mPageLanguage[0] ); } return $langObj;