X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FTitle.php;h=de551b4d233a5aa91f35974e49dc3349d7d5e6c7;hb=b8733c7d26461a1a352a3c357f7f717f0bd82b36;hp=ca62e0e0dece2575d9357f2ac6a661cf0cdfcefe;hpb=2901b84c495edb9ebf70798e12f5695fd19c1b42;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Title.php b/includes/Title.php index ca62e0e0de..de551b4d23 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1665,7 +1665,7 @@ class Title implements LinkTarget { if ( $nsText === false ) { // See T165149. Awkward, but better than erroneously linking to the main namespace. $nsText = MediaWikiServices::getInstance()->getContentLanguage()-> - getNsText( NS_SPECIAL ) . ":Badtitle/NS{$this->mNamespace}"; + getNsText( NS_SPECIAL ) . ":Badtitle/NS{$this->mNamespace}"; } $p .= $nsText . ':'; @@ -2447,7 +2447,7 @@ class Title implements LinkTarget { # XXX: this might be better using restrictions if ( $action === 'patrol' ) { - return []; + return $errors; } if ( preg_match( '/^' . preg_quote( $user->getName(), '/' ) . '\//', $this->mTextform ) ) { @@ -3354,11 +3354,12 @@ class Title implements LinkTarget { $id = $this->getArticleID(); if ( $id ) { $cache = ObjectCache::getMainWANInstance(); + $fname = __METHOD__; $rows = $cache->getWithSetCallback( // Page protections always leave a new null revision $cache->makeKey( 'page-restrictions', $id, $this->getLatestRevID() ), $cache::TTL_DAY, - function ( $curValue, &$ttl, array &$setOpts ) { + function ( $curValue, &$ttl, array &$setOpts ) use ( $fname ) { $dbr = wfGetDB( DB_REPLICA ); $setOpts += Database::getCacheSetOptions( $dbr ); @@ -3368,7 +3369,7 @@ class Title implements LinkTarget { 'page_restrictions', [ 'pr_type', 'pr_expiry', 'pr_level', 'pr_cascade' ], [ 'pr_page' => $this->getArticleID() ], - __METHOD__ + $fname ) ); } @@ -4427,7 +4428,7 @@ class Title implements LinkTarget { $revQuery['joins'] ); if ( $row ) { - return new Revision( $row ); + return new Revision( $row, 0, $this ); } } return null; @@ -4777,7 +4778,39 @@ class Title implements LinkTarget { } /** - * Get the default message text or false if the message doesn't exist + * Get the default (plain) message contents for an page that overrides an + * interface message key. + * + * Primary use cases: + * + * - Article: + * - Show default when viewing the page. The Article::getSubstituteContent + * method displays the default message content, instead of the + * 'noarticletext' placeholder message normally used. + * + * - EditPage: + * - Title of edit page. When creating an interface message override, + * the editor is told they are "Editing the page", instead of + * "Creating the page". (EditPage::setHeaders) + * - Edit notice. The 'translateinterface' edit notice is shown when creating + * or editing a an interface message override. (EditPage::showIntro) + * - Opening the editor. The contents of the localisation message are used + * as contents of the editor when creating a new page in the MediaWiki + * namespace. This simplifies the process for editors when "changing" + * an interface message by creating an override. (EditPage::getContentObject) + * - Showing a diff. The left-hand side of a diff when an editor is + * previewing their changes before saving the creation of a page in the + * MediaWiki namespace. (EditPage::showDiff) + * - Disallowing a save. When attempting to create a a MediaWiki-namespace + * page with the proposed content matching the interface message default, + * the save is rejected, the same way we disallow blank pages from being + * created. (EditPage::internalAttemptSave) + * + * - ApiEditPage: + * - Default content, when using the 'prepend' or 'append' feature. + * + * - SkinTemplate: + * - Label the create action as "Edit", if the page can be an override. * * @return string|bool */