Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/314478
Change subject: [POC] Implement ISBN virtual namespace for linking to Special:Booksources ...................................................................... [POC] Implement ISBN virtual namespace for linking to Special:Booksources Change-Id: Id76ef81b8d041bf84dd0cfd3b79771856d7b7351 --- M includes/Defines.php M includes/MediaWiki.php M includes/Setup.php M includes/Title.php M languages/messages/MessagesEn.php 5 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/78/314478/1 diff --git a/includes/Defines.php b/includes/Defines.php index 02930ea..68b3ec9 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -41,6 +41,7 @@ /**@{ * Virtual namespaces; don't appear in the page database */ +define( 'NS_ISBN', -3 ); define( 'NS_MEDIA', -2 ); define( 'NS_SPECIAL', -1 ); /**@}*/ diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 8cf009f..8118663 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -83,6 +83,10 @@ if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) { $ret = Title::makeTitle( NS_FILE, $ret->getDBkey() ); } + // NS_ISBN is a redirect to Special:Booksources + if ( !is_null( $ret ) && $ret->getNamespace() == NS_ISBN ) { + $ret = SpecialPage::getTitleFor( 'Booksources', $ret->getDBkey() ); + } // Check variant links so that interwiki links don't have to worry // about the possible different language variants if ( count( $wgContLang->getVariants() ) > 1 diff --git a/includes/Setup.php b/includes/Setup.php index 7cda14c..1fac148 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -377,6 +377,7 @@ * @private */ $wgCanonicalNamespaceNames = [ + NS_ISBN => 'ISBN', NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_TALK => 'Talk', diff --git a/includes/Title.php b/includes/Title.php index 5e1e8c6..931ed86 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4312,6 +4312,8 @@ case NS_MEDIAWIKI: // known system message return $this->hasSourceText() !== false; + case NS_ISBN: + return SpecialBookSources::isValidISBN( $this->getDBkey() ); default: return false; } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 67369e2..be808eb 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -74,6 +74,7 @@ * parser features are available. */ $namespaceNames = [ + NS_ISBN => 'ISBN', NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_MAIN => '', -- To view, visit https://gerrit.wikimedia.org/r/314478 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id76ef81b8d041bf84dd0cfd3b79771856d7b7351 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits