Namespace LinkTarget under MediaWiki\Linker
authorKunal Mehta <legoktm@member.fsf.org>
Wed, 20 Apr 2016 08:29:21 +0000 (01:29 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Fri, 22 Apr 2016 00:19:10 +0000 (17:19 -0700)
And add a GPL file header while we're at it.

Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd

20 files changed:
autoload.php
includes/LinkTarget.php [deleted file]
includes/Linker.php
includes/Revision.php
includes/Title.php
includes/WatchedItem.php
includes/WatchedItemStore.php
includes/api/ApiQueryInfo.php
includes/cache/LinkBatch.php
includes/linker/LinkTarget.php [new file with mode: 0644]
includes/mail/EmailNotification.php
includes/specials/SpecialEditWatchlist.php
includes/title/MediaWikiPageLinkRenderer.php
includes/title/MediaWikiTitleCodec.php
includes/title/PageLinkRenderer.php
includes/title/TitleFormatter.php
includes/title/TitleValue.php
maintenance/namespaceDupes.php
tests/phpunit/includes/WatchedItemStoreUnitTest.php
tests/phpunit/includes/WatchedItemUnitTest.php

index b851e39..946503c 100644 (file)
@@ -696,7 +696,6 @@ $wgAutoloadLocalClasses = [
        'LinkFilter' => __DIR__ . '/includes/LinkFilter.php',
        'LinkHolderArray' => __DIR__ . '/includes/parser/LinkHolderArray.php',
        'LinkSearchPage' => __DIR__ . '/includes/specials/SpecialLinkSearch.php',
-       'LinkTarget' => __DIR__ . '/includes/LinkTarget.php',
        'Linker' => __DIR__ . '/includes/Linker.php',
        'LinksDeletionUpdate' => __DIR__ . '/includes/deferred/LinksDeletionUpdate.php',
        'LinksUpdate' => __DIR__ . '/includes/deferred/LinksUpdate.php',
@@ -779,6 +778,7 @@ $wgAutoloadLocalClasses = [
        'MediaWikiVersionFetcher' => __DIR__ . '/includes/MediaWikiVersionFetcher.php',
        'MediaWiki\\Languages\\Data\\Names' => __DIR__ . '/languages/data/Names.php',
        'MediaWiki\\Languages\\Data\\ZhConversion' => __DIR__ . '/languages/data/ZhConversion.php',
+       'MediaWiki\\Linker\\LinkTarget' => __DIR__ . '/includes/linker/LinkTarget.php',
        'MediaWiki\\Logger\\LegacyLogger' => __DIR__ . '/includes/debug/logger/LegacyLogger.php',
        'MediaWiki\\Logger\\LegacySpi' => __DIR__ . '/includes/debug/logger/LegacySpi.php',
        'MediaWiki\\Logger\\LoggerFactory' => __DIR__ . '/includes/debug/logger/LoggerFactory.php',
diff --git a/includes/LinkTarget.php b/includes/LinkTarget.php
deleted file mode 100644 (file)
index b7132a8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * @author Addshore
- *
- * @since 1.27
- */
-interface LinkTarget {
-
-       /**
-        * Get the namespace index.
-        *
-        * @return int Namespace index
-        */
-       public function getNamespace();
-
-       /**
-        * Get the link fragment (i.e. the bit after the #) in text form.
-        *
-        * @return string link fragment
-        */
-       public function getFragment();
-
-       /**
-        * Whether the link target has a fragment
-        *
-        * @return bool
-        */
-       public function hasFragment();
-
-       /**
-        * Get the main part with underscores.
-        *
-        * @return string Main part of the link, with underscores (for use in href attributes)
-        */
-       public function getDBkey();
-
-       /**
-        * Returns the link in text form, without namespace prefix or fragment.
-        *
-        * This is computed from the DB key by replacing any underscores with spaces.
-        *
-        * @return string
-        */
-       public function getText();
-
-       /**
-        * Creates a new LinkTarget for a different fragment of the same page.
-        * It is expected that the same type of object will be returned, but the
-        * only requirement is that it is a LinkTarget.
-        *
-        * @param string $fragment The fragment name, or "" for the entire page.
-        *
-        * @return LinkTarget
-        */
-       public function createFragmentTarget( $fragment );
-}
index 799b8b8..977d71e 100644 (file)
@@ -19,6 +19,7 @@
  *
  * @file
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * Some internal bits split of from Skin.php. These functions are used
index 79cab79..40daf3d 100644 (file)
@@ -19,6 +19,7 @@
  *
  * @file
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * @todo document
index 7368bb0..6f38283 100644 (file)
@@ -21,6 +21,7 @@
  *
  * @file
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * Represents a title within MediaWiki.
index 4dbe0f6..db6ce87 100644 (file)
@@ -18,6 +18,7 @@
  * @file
  * @ingroup Watchlist
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * Representation of a pair of user and title for watchlist entries.
index 5e99f8e..2180b2d 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
+use MediaWiki\Linker\LinkTarget;
 use Wikimedia\Assert\Assert;
 
 /**
index ea1b94e..b94f567 100644 (file)
@@ -23,6 +23,7 @@
  *
  * @file
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * A query module to show basic page information.
index 5dc8110..c5bd290 100644 (file)
@@ -20,6 +20,7 @@
  * @file
  * @ingroup Cache
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * Class representing a list of titles
diff --git a/includes/linker/LinkTarget.php b/includes/linker/LinkTarget.php
new file mode 100644 (file)
index 0000000..2764f46
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @license GPL 2+
+ * @author Addshore
+ */
+namespace MediaWiki\Linker;
+
+/**
+ * @since 1.27
+ */
+interface LinkTarget {
+
+       /**
+        * Get the namespace index.
+        *
+        * @return int Namespace index
+        */
+       public function getNamespace();
+
+       /**
+        * Get the link fragment (i.e. the bit after the #) in text form.
+        *
+        * @return string link fragment
+        */
+       public function getFragment();
+
+       /**
+        * Whether the link target has a fragment
+        *
+        * @return bool
+        */
+       public function hasFragment();
+
+       /**
+        * Get the main part with underscores.
+        *
+        * @return string Main part of the link, with underscores (for use in href attributes)
+        */
+       public function getDBkey();
+
+       /**
+        * Returns the link in text form, without namespace prefix or fragment.
+        *
+        * This is computed from the DB key by replacing any underscores with spaces.
+        *
+        * @return string
+        */
+       public function getText();
+
+       /**
+        * Creates a new LinkTarget for a different fragment of the same page.
+        * It is expected that the same type of object will be returned, but the
+        * only requirement is that it is a LinkTarget.
+        *
+        * @param string $fragment The fragment name, or "" for the entire page.
+        *
+        * @return LinkTarget
+        */
+       public function createFragmentTarget( $fragment );
+}
index fe24c34..664c111 100644 (file)
@@ -23,6 +23,7 @@
  * @author Tim Starling
  * @author Luke Welling lwelling@wikimedia.org
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * This module processes the email notifications when the current page is
index c1abd6e..f2fa921 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * @defgroup Watchlist Users watchlist handling
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * Implements Special:EditWatchlist
index b458578..a565271 100644 (file)
@@ -21,6 +21,7 @@
  * @license GPL 2+
  * @author Daniel Kinzler
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * A service for generating links from page titles.
index 22d5f0d..7c08be4 100644 (file)
@@ -21,6 +21,7 @@
  * @license GPL 2+
  * @author Daniel Kinzler
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * A codec for %MediaWiki page titles.
index 1c5f0f7..e26fe1a 100644 (file)
@@ -21,6 +21,7 @@
  * @license GPL 2+
  * @author Daniel Kinzler
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * Represents a link rendering service for %MediaWiki.
index 4edc5db..96f396c 100644 (file)
@@ -21,6 +21,7 @@
  * @license GPL 2+
  * @author Daniel Kinzler
  */
+use MediaWiki\Linker\LinkTarget;
 
 /**
  * A title formatter service for MediaWiki.
index a0a7b1d..c23d698 100644 (file)
@@ -21,6 +21,7 @@
  * @license GPL 2+
  * @author Daniel Kinzler
  */
+use MediaWiki\Linker\LinkTarget;
 use Wikimedia\Assert\Assert;
 
 /**
index 55f361c..8fd25a6 100644 (file)
@@ -24,6 +24,8 @@
  * @ingroup Maintenance
  */
 
+use MediaWiki\Linker\LinkTarget;
+
 require_once __DIR__ . '/Maintenance.php';
 
 /**