Yaron Koren has submitted this change and it was merged.
Change subject: Fixed handling for Approved Revs'
$egApprovedRevsBlankIfUnapproved
......................................................................
Fixed handling for Approved Revs' $egApprovedRevsBlankIfUnapproved
Change-Id: Icf8dc03b681ee5b2048df9d279795599ca1680eb
---
M Cargo.hooks.php
M CargoPageData.php
2 files changed, 30 insertions(+), 14 deletions(-)
Approvals:
Yaron Koren: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/Cargo.hooks.php b/Cargo.hooks.php
index 7fe1b93..098e50f 100644
--- a/Cargo.hooks.php
+++ b/Cargo.hooks.php
@@ -229,10 +229,14 @@
* Called by a hook in the Approved Revs extension.
*/
public static function onARRevisionUnapproved( $parser, $title ) {
+ global $egApprovedRevsBlankIfUnapproved;
+
$pageID = $title->getArticleID();
self::deletePageFromSystem( $pageID );
- // This is all we need - see onARRevisionApproved(), above.
- CargoStore::$settings['origin'] = 'Approved Revs revision
unapproved';
+ if ( ! $egApprovedRevsBlankIfUnapproved ) {
+ // No point storing the Cargo data if it's blank.
+ CargoStore::$settings['origin'] = 'Approved Revs
revision unapproved';
+ }
return true;
}
diff --git a/CargoPageData.php b/CargoPageData.php
index 07661cf..c95ded3 100644
--- a/CargoPageData.php
+++ b/CargoPageData.php
@@ -46,7 +46,13 @@
return $tableSchema;
}
- public static function storeValuesForPage( $title ) {
+ /**
+ * The $setToBlank argument is a bit of a hack - used right now only
+ * for "blank if unapproved" with the Approved Revs extension, because
+ * that setting doesn't seem to take effect soon enough to get parsed
+ * as a blank page.
+ */
+ public static function storeValuesForPage( $title, $setToBlank = false
) {
global $wgCargoPageDataColumns;
if ( $title == null ) {
@@ -80,20 +86,26 @@
$pageDataValues['_creator'] = $wikiPage->getCreator();
}
if ( in_array( CARGO_STORE_FULL_TEXT, $wgCargoPageDataColumns )
) {
- $article = new Article( $title );
- $pageDataValues['_fullText'] = $article->getContent();
+ if ( $setToBlank ) {
+ $pageDataValues['_fullText'] = '';
+ } else {
+ $article = new Article( $title );
+ $pageDataValues['_fullText'] =
$article->getContent();
+ }
}
if ( in_array( CARGO_STORE_CATEGORIES, $wgCargoPageDataColumns
) ) {
$pageCategories = array();
- $dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->select(
- 'categorylinks',
- 'cl_to',
- array( 'cl_from' => $title->getArticleID() ),
- __METHOD__
- );
- foreach ( $res as $row ) {
- $pageCategories[] = $row->cl_to;
+ if ( !$setToBlank ) {
+ $dbr = wfGetDB( DB_SLAVE );
+ $res = $dbr->select(
+ 'categorylinks',
+ 'cl_to',
+ array( 'cl_from' =>
$title->getArticleID() ),
+ __METHOD__
+ );
+ foreach ( $res as $row ) {
+ $pageCategories[] = $row->cl_to;
+ }
}
$pageCategoriesString = implode( '|', $pageCategories );
--
To view, visit https://gerrit.wikimedia.org/r/283216
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icf8dc03b681ee5b2048df9d279795599ca1680eb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits