X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=8586ad762de69c2bbd606407fc663ecc55b4ff7c;hb=2f23133bb669dc4c810bd5b1ed8d5d47ee995b66;hp=9711749d33a276c1a97f88ede8416395829a5ed7;hpb=5a6c78c441e9d977bb33a0eb4536d5a3c5067943;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index 9711749d33..8586ad762d 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' ); } @@ -2086,7 +2086,7 @@ class Title implements LinkTarget { * May provide false positives, but should never provide a false negative. * * @param string $action Action that permission needs to be checked for - * @param User $user User to check (since 1.19); $wgUser will be used if not provided. + * @param User|null $user User to check (since 1.19); $wgUser will be used if not provided. * @return bool */ public function quickUserCan( $action, $user = null ) { @@ -2097,7 +2097,7 @@ class Title implements LinkTarget { * Can $user perform $action on this page? * * @param string $action Action that permission needs to be checked for - * @param User $user User to check (since 1.19); $wgUser will be used if not + * @param User|null $user User to check (since 1.19); $wgUser will be used if not * provided. * @param string $rigor Same format as Title::getUserPermissionsErrors() * @return bool @@ -2553,7 +2553,10 @@ class Title implements LinkTarget { return $errors; } - if ( $wgEmailConfirmToEdit && !$user->isEmailConfirmed() ) { + if ( $wgEmailConfirmToEdit + && !$user->isEmailConfirmed() + && $action === 'edit' + ) { $errors[] = [ 'confirmedittext' ]; } @@ -3136,7 +3139,7 @@ class Title implements LinkTarget { * Public for usage by LiquidThreads. * * @param array $rows Array of db result objects - * @param string $oldFashionedRestrictions Comma-separated set of permission keys + * @param string|null $oldFashionedRestrictions Comma-separated set of permission keys * indicating who can move or edit the page from the page table, (pre 1.10) rows. * Edit and move sections are separated by a colon * Example: "edit=autoconfirmed,sysop:move=sysop" @@ -3208,7 +3211,7 @@ class Title implements LinkTarget { /** * Load restrictions from the page_restrictions table * - * @param string $oldFashionedRestrictions Comma-separated set of permission keys + * @param string|null $oldFashionedRestrictions Comma-separated set of permission keys * indicating who can move or edit the page from the page table, (pre 1.10) rows. * Edit and move sections are separated by a colon * Example: "edit=autoconfirmed,sysop:move=sysop" @@ -3430,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 ); @@ -3460,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 ) { @@ -3494,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 ) { @@ -3522,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 ) { @@ -3547,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 ) { @@ -3569,7 +3572,7 @@ class Title implements LinkTarget { } public static function clearCaches() { - $linkCache = LinkCache::singleton(); + $linkCache = MediaWikiServices::getInstance()->getLinkCache(); $linkCache->clear(); $titleCache = self::getTitleCache(); @@ -3673,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 ) { @@ -3741,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 ); @@ -4678,7 +4681,7 @@ class Title implements LinkTarget { /** * Updates page_touched for this page; called from LinksUpdate.php * - * @param string $purgeTime [optional] TS_MW timestamp + * @param string|null $purgeTime [optional] TS_MW timestamp * @return bool True if the update succeeded */ public function invalidateCache( $purgeTime = null ) { @@ -4749,7 +4752,7 @@ class Title implements LinkTarget { /** * Get the timestamp when this page was updated since the user last saw it. * - * @param User $user + * @param User|null $user * @return string|null */ public function getNotificationTimestamp( $user = null ) { @@ -4940,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' ); } @@ -4980,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;