Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/284420
Change subject: Namespace LinkTarget under MediaWiki\Linker
......................................................................
Namespace LinkTarget under MediaWiki\Linker
And add a GPL file header while we're at it.
Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
---
M autoload.php
D includes/LinkTarget.php
M includes/Linker.php
M includes/Revision.php
M includes/Title.php
M includes/WatchedItem.php
M includes/WatchedItemStore.php
M includes/api/ApiQueryInfo.php
M includes/cache/LinkBatch.php
A includes/linker/LinkTarget.php
M includes/mail/EmailNotification.php
M includes/specials/SpecialEditWatchlist.php
M includes/title/MediaWikiPageLinkRenderer.php
M includes/title/MediaWikiTitleCodec.php
M includes/title/PageLinkRenderer.php
M includes/title/TitleFormatter.php
M includes/title/TitleValue.php
M maintenance/namespaceDupes.php
M tests/phpunit/includes/WatchedItemStoreUnitTest.php
M tests/phpunit/includes/WatchedItemUnitTest.php
20 files changed, 95 insertions(+), 58 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/20/284420/1
diff --git a/autoload.php b/autoload.php
index b851e39..946503c 100644
--- a/autoload.php
+++ b/autoload.php
@@ -696,7 +696,6 @@
'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 @@
'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
index b7132a8..0000000
--- a/includes/LinkTarget.php
+++ /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 );
-}
diff --git a/includes/Linker.php b/includes/Linker.php
index 799b8b8..977d71e 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -19,6 +19,7 @@
*
* @file
*/
+use MediaWiki\Linker\LinkTarget;
/**
* Some internal bits split of from Skin.php. These functions are used
diff --git a/includes/Revision.php b/includes/Revision.php
index 79cab79..40daf3d 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -19,6 +19,7 @@
*
* @file
*/
+use MediaWiki\Linker\LinkTarget;
/**
* @todo document
diff --git a/includes/Title.php b/includes/Title.php
index 06195b3..5b65868 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -21,6 +21,7 @@
*
* @file
*/
+use MediaWiki\Linker\LinkTarget;
/**
* Represents a title within MediaWiki.
diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php
index 4dbe0f6..db6ce87 100644
--- a/includes/WatchedItem.php
+++ b/includes/WatchedItem.php
@@ -18,6 +18,7 @@
* @file
* @ingroup Watchlist
*/
+use MediaWiki\Linker\LinkTarget;
/**
* Representation of a pair of user and title for watchlist entries.
diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php
index 5e99f8e..2180b2d 100644
--- a/includes/WatchedItemStore.php
+++ b/includes/WatchedItemStore.php
@@ -1,6 +1,7 @@
<?php
use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
+use MediaWiki\Linker\LinkTarget;
use Wikimedia\Assert\Assert;
/**
diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index ea1b94e..b94f567 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -23,6 +23,7 @@
*
* @file
*/
+use MediaWiki\Linker\LinkTarget;
/**
* A query module to show basic page information.
diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php
index 5dc8110..c5bd290 100644
--- a/includes/cache/LinkBatch.php
+++ b/includes/cache/LinkBatch.php
@@ -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
index 0000000..2764f46
--- /dev/null
+++ b/includes/linker/LinkTarget.php
@@ -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 );
+}
diff --git a/includes/mail/EmailNotification.php
b/includes/mail/EmailNotification.php
index fe24c34..664c111 100644
--- a/includes/mail/EmailNotification.php
+++ b/includes/mail/EmailNotification.php
@@ -23,6 +23,7 @@
* @author Tim Starling
* @author Luke Welling [email protected]
*/
+use MediaWiki\Linker\LinkTarget;
/**
* This module processes the email notifications when the current page is
diff --git a/includes/specials/SpecialEditWatchlist.php
b/includes/specials/SpecialEditWatchlist.php
index c1abd6e..f2fa921 100644
--- a/includes/specials/SpecialEditWatchlist.php
+++ b/includes/specials/SpecialEditWatchlist.php
@@ -2,6 +2,7 @@
/**
* @defgroup Watchlist Users watchlist handling
*/
+use MediaWiki\Linker\LinkTarget;
/**
* Implements Special:EditWatchlist
diff --git a/includes/title/MediaWikiPageLinkRenderer.php
b/includes/title/MediaWikiPageLinkRenderer.php
index b458578..a565271 100644
--- a/includes/title/MediaWikiPageLinkRenderer.php
+++ b/includes/title/MediaWikiPageLinkRenderer.php
@@ -21,6 +21,7 @@
* @license GPL 2+
* @author Daniel Kinzler
*/
+use MediaWiki\Linker\LinkTarget;
/**
* A service for generating links from page titles.
diff --git a/includes/title/MediaWikiTitleCodec.php
b/includes/title/MediaWikiTitleCodec.php
index 22d5f0d..7c08be4 100644
--- a/includes/title/MediaWikiTitleCodec.php
+++ b/includes/title/MediaWikiTitleCodec.php
@@ -21,6 +21,7 @@
* @license GPL 2+
* @author Daniel Kinzler
*/
+use MediaWiki\Linker\LinkTarget;
/**
* A codec for %MediaWiki page titles.
diff --git a/includes/title/PageLinkRenderer.php
b/includes/title/PageLinkRenderer.php
index 1c5f0f7..e26fe1a 100644
--- a/includes/title/PageLinkRenderer.php
+++ b/includes/title/PageLinkRenderer.php
@@ -21,6 +21,7 @@
* @license GPL 2+
* @author Daniel Kinzler
*/
+use MediaWiki\Linker\LinkTarget;
/**
* Represents a link rendering service for %MediaWiki.
diff --git a/includes/title/TitleFormatter.php
b/includes/title/TitleFormatter.php
index 4edc5db..96f396c 100644
--- a/includes/title/TitleFormatter.php
+++ b/includes/title/TitleFormatter.php
@@ -21,6 +21,7 @@
* @license GPL 2+
* @author Daniel Kinzler
*/
+use MediaWiki\Linker\LinkTarget;
/**
* A title formatter service for MediaWiki.
diff --git a/includes/title/TitleValue.php b/includes/title/TitleValue.php
index a0a7b1d..c23d698 100644
--- a/includes/title/TitleValue.php
+++ b/includes/title/TitleValue.php
@@ -21,6 +21,7 @@
* @license GPL 2+
* @author Daniel Kinzler
*/
+use MediaWiki\Linker\LinkTarget;
use Wikimedia\Assert\Assert;
/**
diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php
index 55f361c..8fd25a6 100644
--- a/maintenance/namespaceDupes.php
+++ b/maintenance/namespaceDupes.php
@@ -24,6 +24,8 @@
* @ingroup Maintenance
*/
+use MediaWiki\Linker\LinkTarget;
+
require_once __DIR__ . '/Maintenance.php';
/**
diff --git a/tests/phpunit/includes/WatchedItemStoreUnitTest.php
b/tests/phpunit/includes/WatchedItemStoreUnitTest.php
index 17b2fa4..d9fd4de 100644
--- a/tests/phpunit/includes/WatchedItemStoreUnitTest.php
+++ b/tests/phpunit/includes/WatchedItemStoreUnitTest.php
@@ -1,4 +1,5 @@
<?php
+use MediaWiki\Linker\LinkTarget;
/**
* @author Addshore
diff --git a/tests/phpunit/includes/WatchedItemUnitTest.php
b/tests/phpunit/includes/WatchedItemUnitTest.php
index b4eaa76..c33ba7e 100644
--- a/tests/phpunit/includes/WatchedItemUnitTest.php
+++ b/tests/phpunit/includes/WatchedItemUnitTest.php
@@ -1,4 +1,5 @@
<?php
+use MediaWiki\Linker\LinkTarget;
/**
* @author Addshore
--
To view, visit https://gerrit.wikimedia.org/r/284420
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits