[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Introduces IndexForPageLookup
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/390886 ) Change subject: Introduces IndexForPageLookup .. Introduces IndexForPageLookup Change-Id: I3cea1f364e36c1809a76579f64bbb83b900b0284 --- M ProofreadPage.body.php M extension.json M includes/Context.php M includes/Pagination/FilePagination.php M includes/Pagination/PaginationFactory.php A includes/page/DatabaseIndexForPageLookup.php A includes/page/IndexForPageLookup.php M includes/page/PageContentBuilder.php M includes/page/PageDisplayHandler.php M includes/page/ProofreadPagePage.php M tests/phpunit/ContextTest.php M tests/phpunit/Pagination/FilePaginationTest.php M tests/phpunit/Pagination/PagePaginationTest.php M tests/phpunit/Pagination/PaginationFactoryTest.php M tests/phpunit/ProofreadPageTestCase.php A tests/phpunit/page/DatabaseIndexForPageLookupTest.php A tests/phpunit/page/IndexForPageLookupMock.php M tests/phpunit/page/PageContentBuilderTest.php M tests/phpunit/page/PageDisplayHandlerTest.php M tests/phpunit/page/ProofreadPagePageTest.php 20 files changed, 356 insertions(+), 199 deletions(-) Approvals: jenkins-bot: Verified Tpt: Looks good to me, approved diff --git a/ProofreadPage.body.php b/ProofreadPage.body.php index 2b78412..c771bed 100644 --- a/ProofreadPage.body.php +++ b/ProofreadPage.body.php @@ -741,8 +741,8 @@ } // Prev, Next and Index links - $indexPage = $page->getIndex(); - if ( $indexPage ) { + $indexPage = Context::getDefaultContext()->getIndexForPageLookup()->getIndexForPage( $page ); + if ( $indexPage !== null ) { $pagination = Context::getDefaultContext() ->getPaginationFactory()->getPaginationForIndexPage( $indexPage ); try { diff --git a/extension.json b/extension.json index 30fff6c..ae1ab61 100644 --- a/extension.json +++ b/extension.json @@ -82,6 +82,8 @@ "ProofreadPage\\Page\\PageViewAction": "includes/page/PageViewAction.php", "ProofreadPage\\Page\\PageDifferenceEngine": "includes/page/PageDifferenceEngine.php", "ProofreadPage\\Page\\PageDisplayHandler": "includes/page/PageDisplayHandler.php", + "ProofreadPage\\Page\\IndexForPageLookup": "includes/page/IndexForPageLookup.php", + "ProofreadPage\\Page\\DatabaseIndexForPageLookup": "includes/page/DatabaseIndexForPageLookup.php", "ProofreadPage\\Parser\\ParserEntryPoint": "includes/Parser/ParserEntryPoint.php", "ProofreadPage\\Parser\\TagParser": "includes/Parser/TagParser.php", "ProofreadPage\\Parser\\PagelistTagParser": "includes/Parser/PagelistTagParser.php", @@ -92,6 +94,7 @@ "ApiQueryProofread": "ApiQueryProofread.php", "ApiQueryProofreadInfo": "ApiQueryProofreadInfo.php", "ProofreadPage\\FileProviderMock": "tests/phpunit/FileProviderMock.php", + "ProofreadPage\\Page\\IndexForPageLookupMock": "tests/phpunit/page/IndexForPageLookupMock.php", "ProofreadPageTestCase": "tests/phpunit/ProofreadPageTestCase.php", "FixProofreadPagePagesContentModel": "maintenance/fixProofreadPagePagesContentModel.php", "FixProofreadIndexPagesContentModel": "maintenance/fixProofreadIndexPagesContentModel.php" diff --git a/includes/Context.php b/includes/Context.php index 0bbd60d..4644bfb 100644 --- a/includes/Context.php +++ b/includes/Context.php @@ -3,6 +3,8 @@ namespace ProofreadPage; use ProofreadPage\Index\CustomIndexFieldsParser; +use ProofreadPage\Page\DatabaseIndexForPageLookup; +use ProofreadPage\Page\IndexForPageLookup; use ProofreadPage\Pagination\PaginationFactory; use RepoGroup; @@ -38,19 +40,26 @@ private $customIndexFieldsParser; /** +* @var IndexForPageLookup +*/ + private $indexForPageLookup; + + /** * @param int $pageNamespaceId * @param int $indexNamespaceId * @param FileProvider $fileProvider * @param CustomIndexFieldsParser $customIndexFieldsParser +* @param IndexForPageLookup $indexForPageLookup */ public function __construct( $pageNamespaceId, $indexNamespaceId, FileProvider $fileProvider, - CustomIndexFieldsParser $customIndexFieldsParser + CustomIndexFieldsParser $customIndexFieldsParser, IndexForPageLookup $indexForPageLookup ) { $this->pageNamespaceId = $pageNamespaceId; $this->indexNamespaceId = $indexNamespaceId; $this->fileProvider = $fileProvider; $this->customIndexFieldsParser = $customIndexFieldsParser; + $this->indexForPageLookup = $indexForPageLookup; } /** @@ -89,2
[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Introduces IndexForPageLookup
Tpt has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/390886 ) Change subject: Introduces IndexForPageLookup .. Introduces IndexForPageLookup Change-Id: I3cea1f364e36c1809a76579f64bbb83b900b0284 --- M ProofreadPage.body.php M extension.json M includes/Context.php M includes/Pagination/FilePagination.php M includes/Pagination/PaginationFactory.php A includes/page/DatabaseIndexForPageLookup.php A includes/page/IndexForPageLookup.php M includes/page/PageContentBuilder.php M includes/page/PageDisplayHandler.php M includes/page/ProofreadPagePage.php M tests/phpunit/ContextTest.php M tests/phpunit/Pagination/FilePaginationTest.php M tests/phpunit/Pagination/PagePaginationTest.php M tests/phpunit/Pagination/PaginationFactoryTest.php M tests/phpunit/ProofreadPageTestCase.php A tests/phpunit/page/DatabaseIndexForPageLookupTest.php A tests/phpunit/page/IndexForPageLookupMock.php M tests/phpunit/page/PageContentBuilderTest.php M tests/phpunit/page/PageDisplayHandlerTest.php M tests/phpunit/page/ProofreadPagePageTest.php 20 files changed, 346 insertions(+), 190 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage refs/changes/86/390886/1 diff --git a/ProofreadPage.body.php b/ProofreadPage.body.php index 2b78412..c771bed 100644 --- a/ProofreadPage.body.php +++ b/ProofreadPage.body.php @@ -741,8 +741,8 @@ } // Prev, Next and Index links - $indexPage = $page->getIndex(); - if ( $indexPage ) { + $indexPage = Context::getDefaultContext()->getIndexForPageLookup()->getIndexForPage( $page ); + if ( $indexPage !== null ) { $pagination = Context::getDefaultContext() ->getPaginationFactory()->getPaginationForIndexPage( $indexPage ); try { diff --git a/extension.json b/extension.json index 30fff6c..ae1ab61 100644 --- a/extension.json +++ b/extension.json @@ -82,6 +82,8 @@ "ProofreadPage\\Page\\PageViewAction": "includes/page/PageViewAction.php", "ProofreadPage\\Page\\PageDifferenceEngine": "includes/page/PageDifferenceEngine.php", "ProofreadPage\\Page\\PageDisplayHandler": "includes/page/PageDisplayHandler.php", + "ProofreadPage\\Page\\IndexForPageLookup": "includes/page/IndexForPageLookup.php", + "ProofreadPage\\Page\\DatabaseIndexForPageLookup": "includes/page/DatabaseIndexForPageLookup.php", "ProofreadPage\\Parser\\ParserEntryPoint": "includes/Parser/ParserEntryPoint.php", "ProofreadPage\\Parser\\TagParser": "includes/Parser/TagParser.php", "ProofreadPage\\Parser\\PagelistTagParser": "includes/Parser/PagelistTagParser.php", @@ -92,6 +94,7 @@ "ApiQueryProofread": "ApiQueryProofread.php", "ApiQueryProofreadInfo": "ApiQueryProofreadInfo.php", "ProofreadPage\\FileProviderMock": "tests/phpunit/FileProviderMock.php", + "ProofreadPage\\Page\\IndexForPageLookupMock": "tests/phpunit/page/IndexForPageLookupMock.php", "ProofreadPageTestCase": "tests/phpunit/ProofreadPageTestCase.php", "FixProofreadPagePagesContentModel": "maintenance/fixProofreadPagePagesContentModel.php", "FixProofreadIndexPagesContentModel": "maintenance/fixProofreadIndexPagesContentModel.php" diff --git a/includes/Context.php b/includes/Context.php index 0bbd60d..4644bfb 100644 --- a/includes/Context.php +++ b/includes/Context.php @@ -3,6 +3,8 @@ namespace ProofreadPage; use ProofreadPage\Index\CustomIndexFieldsParser; +use ProofreadPage\Page\DatabaseIndexForPageLookup; +use ProofreadPage\Page\IndexForPageLookup; use ProofreadPage\Pagination\PaginationFactory; use RepoGroup; @@ -38,19 +40,26 @@ private $customIndexFieldsParser; /** +* @var IndexForPageLookup +*/ + private $indexForPageLookup; + + /** * @param int $pageNamespaceId * @param int $indexNamespaceId * @param FileProvider $fileProvider * @param CustomIndexFieldsParser $customIndexFieldsParser +* @param IndexForPageLookup $indexForPageLookup */ public function __construct( $pageNamespaceId, $indexNamespaceId, FileProvider $fileProvider, - CustomIndexFieldsParser $customIndexFieldsParser + CustomIndexFieldsParser $customIndexFieldsParser, IndexForPageLookup $indexForPageLookup ) { $this->pageNamespaceId = $pageNamespaceId; $this->indexNamespaceId = $indexNamespaceId; $this->fileProvider = $fileProvider; $this->customIndexFieldsParser = $customIndexFieldsParser; + $this->indexForPageLookup = $indexForPageLookup; }