[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Moves all code related to Index fields management outside of...

2017-08-10 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/370810 )

Change subject: Moves all code related to Index fields management outside of 
ProofreadIndexPage
..


Moves all code related to Index fields management outside of ProofreadIndexPage

Change-Id: I0bebd9b5c59d60ee5c3b810a3754954cc8d71cda
---
M extension.json
M includes/Context.php
M includes/Parser/PagesTagParser.php
R includes/index/CustomIndexField.php
A includes/index/CustomIndexFieldsParser.php
M includes/index/EditIndexPage.php
M includes/index/ProofreadIndexPage.php
M includes/page/PageContentBuilder.php
M includes/page/PageDisplayHandler.php
M tests/phpunit/ContextTest.php
M tests/phpunit/ProofreadPageTestCase.php
A tests/phpunit/index/CustomIndexFieldsParserTest.php
M tests/phpunit/index/ProofreadIndexPageTest.php
13 files changed, 614 insertions(+), 548 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/extension.json b/extension.json
index 4f95dc1..266871c 100644
--- a/extension.json
+++ b/extension.json
@@ -47,8 +47,9 @@
"ProofreadPage\\FileNotFoundException": 
"includes/FileNotFoundException.php",
"ProofreadPage\\FileProvider": "includes/FileProvider.php",
"ProofreadPage\\Link": "includes/Link.php",
-   "ProofreadIndexEntry": "includes/index/ProofreadIndexEntry.php",
"ProofreadIndexPage": "includes/index/ProofreadIndexPage.php",
+   "ProofreadPage\\Index\\CustomIndexField": 
"includes/index/CustomIndexField.php",
+   "ProofreadPage\\Index\\CustomIndexFieldsParser": 
"includes/index/CustomIndexFieldsParser.php",
"ProofreadPage\\Index\\IndexContent": 
"includes/index/IndexContent.php",
"ProofreadPage\\Index\\IndexRedirectContent": 
"includes/index/IndexRedirectContent.php",
"ProofreadPage\\Index\\IndexContentHandler": 
"includes/index/IndexContentHandler.php",
diff --git a/includes/Context.php b/includes/Context.php
index 5393f29..129a27d 100644
--- a/includes/Context.php
+++ b/includes/Context.php
@@ -2,6 +2,7 @@
 
 namespace ProofreadPage;
 
+use ProofreadPage\Index\CustomIndexFieldsParser;
 use ProofreadPage\Pagination\PaginationFactory;
 use RepoGroup;
 
@@ -32,14 +33,24 @@
private $fileProvider;
 
/**
+* @var CustomIndexFieldsParser
+*/
+   private $customIndexFieldsParser;
+
+   /**
 * @param int $pageNamespaceId
 * @param int $indexNamespaceId
 * @param FileProvider $fileProvider
+* @param CustomIndexFieldsParser $customIndexFieldsParser
 */
-   public function __construct( $pageNamespaceId, $indexNamespaceId, 
FileProvider $fileProvider ) {
+   public function __construct(
+   $pageNamespaceId, $indexNamespaceId, FileProvider $fileProvider,
+   CustomIndexFieldsParser $customIndexFieldsParser
+   ) {
$this->pageNamespaceId = $pageNamespaceId;
$this->indexNamespaceId = $indexNamespaceId;
$this->fileProvider = $fileProvider;
+   $this->customIndexFieldsParser = $customIndexFieldsParser;
}
 
/**
@@ -71,6 +82,13 @@
}
 
/**
+* @return CustomIndexFieldsParser
+*/
+   public function getCustomIndexFieldsParser() {
+   return $this->customIndexFieldsParser;
+   }
+
+   /**
 * @param bool $purgeFileProvider
 * @return Context
 */
@@ -81,7 +99,8 @@
$defaultContext = new self(
ProofreadPageInit::getNamespaceId( 'page' ),
ProofreadPageInit::getNamespaceId( 'index' ),
-   new FileProvider( RepoGroup::singleton() )
+   new FileProvider( RepoGroup::singleton() ),
+   new CustomIndexFieldsParser()
);
}
if ( $purgeFileProvider ) {
diff --git a/includes/Parser/PagesTagParser.php 
b/includes/Parser/PagesTagParser.php
index 90cabe0..5ccf5d2 100644
--- a/includes/Parser/PagesTagParser.php
+++ b/includes/Parser/PagesTagParser.php
@@ -4,6 +4,7 @@
 
 use OutOfBoundsException;
 use ProofreadIndexPage;
+use ProofreadPage\Context;
 use ProofreadPage\Pagination\FilePagination;
 use ProofreadPageDbConnector;
 use ProofreadPagePage;
@@ -62,6 +63,7 @@
return $this->formatError( 'proofreadpage_nosuch_index' 
);
}
$indexPage = ProofreadIndexPage::newFromTitle( $indexTitle );
+   $indexContent = $indexPage->getContent();
$pagination = $this->context->getPaginationFactory()
->getPaginationForIndexPage( $indexPage );
$language = 

[MediaWiki-commits] [Gerrit] mediawiki...ProofreadPage[master]: Moves all code related to Index fields management outside of...

2017-08-09 Thread Tpt (Code Review)
Tpt has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370810 )

Change subject: Moves all code related to Index fields management outside of 
ProofreadIndexPage
..

Moves all code related to Index fields management outside of ProofreadIndexPage

Change-Id: I0bebd9b5c59d60ee5c3b810a3754954cc8d71cda
---
M extension.json
M includes/Context.php
M includes/Parser/PagesTagParser.php
R includes/index/CustomIndexField.php
A includes/index/CustomIndexFieldsParser.php
M includes/index/EditIndexPage.php
M includes/index/ProofreadIndexPage.php
M includes/page/PageContentBuilder.php
M includes/page/PageDisplayHandler.php
M tests/phpunit/ContextTest.php
M tests/phpunit/ProofreadPageTestCase.php
A tests/phpunit/index/CustomIndexFieldsParserTest.php
M tests/phpunit/index/ProofreadIndexPageTest.php
13 files changed, 605 insertions(+), 535 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ProofreadPage 
refs/changes/10/370810/1

diff --git a/extension.json b/extension.json
index 4f95dc1..9efbc29 100644
--- a/extension.json
+++ b/extension.json
@@ -49,6 +49,8 @@
"ProofreadPage\\Link": "includes/Link.php",
"ProofreadIndexEntry": "includes/index/ProofreadIndexEntry.php",
"ProofreadIndexPage": "includes/index/ProofreadIndexPage.php",
+   "ProofreadPage\\Index\\CustomIndexField": 
"includes/index/CustomIndexField.php",
+   "ProofreadPage\\Index\\CustomIndexFieldsParser": 
"includes/index/CustomIndexFieldsParser.php",
"ProofreadPage\\Index\\IndexContent": 
"includes/index/IndexContent.php",
"ProofreadPage\\Index\\IndexRedirectContent": 
"includes/index/IndexRedirectContent.php",
"ProofreadPage\\Index\\IndexContentHandler": 
"includes/index/IndexContentHandler.php",
diff --git a/includes/Context.php b/includes/Context.php
index 5393f29..129a27d 100644
--- a/includes/Context.php
+++ b/includes/Context.php
@@ -2,6 +2,7 @@
 
 namespace ProofreadPage;
 
+use ProofreadPage\Index\CustomIndexFieldsParser;
 use ProofreadPage\Pagination\PaginationFactory;
 use RepoGroup;
 
@@ -32,14 +33,24 @@
private $fileProvider;
 
/**
+* @var CustomIndexFieldsParser
+*/
+   private $customIndexFieldsParser;
+
+   /**
 * @param int $pageNamespaceId
 * @param int $indexNamespaceId
 * @param FileProvider $fileProvider
+* @param CustomIndexFieldsParser $customIndexFieldsParser
 */
-   public function __construct( $pageNamespaceId, $indexNamespaceId, 
FileProvider $fileProvider ) {
+   public function __construct(
+   $pageNamespaceId, $indexNamespaceId, FileProvider $fileProvider,
+   CustomIndexFieldsParser $customIndexFieldsParser
+   ) {
$this->pageNamespaceId = $pageNamespaceId;
$this->indexNamespaceId = $indexNamespaceId;
$this->fileProvider = $fileProvider;
+   $this->customIndexFieldsParser = $customIndexFieldsParser;
}
 
/**
@@ -71,6 +82,13 @@
}
 
/**
+* @return CustomIndexFieldsParser
+*/
+   public function getCustomIndexFieldsParser() {
+   return $this->customIndexFieldsParser;
+   }
+
+   /**
 * @param bool $purgeFileProvider
 * @return Context
 */
@@ -81,7 +99,8 @@
$defaultContext = new self(
ProofreadPageInit::getNamespaceId( 'page' ),
ProofreadPageInit::getNamespaceId( 'index' ),
-   new FileProvider( RepoGroup::singleton() )
+   new FileProvider( RepoGroup::singleton() ),
+   new CustomIndexFieldsParser()
);
}
if ( $purgeFileProvider ) {
diff --git a/includes/Parser/PagesTagParser.php 
b/includes/Parser/PagesTagParser.php
index 90cabe0..5ccf5d2 100644
--- a/includes/Parser/PagesTagParser.php
+++ b/includes/Parser/PagesTagParser.php
@@ -4,6 +4,7 @@
 
 use OutOfBoundsException;
 use ProofreadIndexPage;
+use ProofreadPage\Context;
 use ProofreadPage\Pagination\FilePagination;
 use ProofreadPageDbConnector;
 use ProofreadPagePage;
@@ -62,6 +63,7 @@
return $this->formatError( 'proofreadpage_nosuch_index' 
);
}
$indexPage = ProofreadIndexPage::newFromTitle( $indexTitle );
+   $indexContent = $indexPage->getContent();
$pagination = $this->context->getPaginationFactory()
->getPaginationForIndexPage( $indexPage );
$language = $this->parser->getTargetLanguage();
@@ -263,7 +265,7 @@
if ( $header == 'toc' ) {
$this->parser->getOutput()->is_toc =