Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/234972
Change subject: Don't include Special pages as wiki links
......................................................................
Don't include Special pages as wiki links
Bug: T109814
Change-Id: If98fc695070fbf5d50184ad7aeb5e72b64db8b7b
---
M includes/Parsoid/ReferenceFactory.php
M maintenance/FlowFixLinks.php
2 files changed, 30 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/72/234972/1
diff --git a/includes/Parsoid/ReferenceFactory.php
b/includes/Parsoid/ReferenceFactory.php
index 6112def..38b4513 100644
--- a/includes/Parsoid/ReferenceFactory.php
+++ b/includes/Parsoid/ReferenceFactory.php
@@ -76,6 +76,10 @@
return null;
}
+ if ( $title->getNamespace() === NS_SPECIAL ) {
+ return null;
+ }
+
return new WikiReference(
$this->wikiId,
$this->workflowId,
diff --git a/maintenance/FlowFixLinks.php b/maintenance/FlowFixLinks.php
index 6070b2b..3531a15 100644
--- a/maintenance/FlowFixLinks.php
+++ b/maintenance/FlowFixLinks.php
@@ -12,7 +12,7 @@
require_once( __DIR__ . '/../../../includes/utils/RowUpdateGenerator.php' );
/**
- * Fixes Flow entries in categorylinks & related tables.
+ * Fixes Flow References & entries in categorylinks & related tables.
*
* @ingroup Maintenance
*/
@@ -20,18 +20,39 @@
public function __construct() {
parent::__construct();
- $this->mDescription = 'Fixes Flow entries in categorylinks &
related tables';
+ $this->mDescription = 'Fixes Flow References & entries in
categorylinks & related tables';
$this->setBatchSize( 300 );
}
protected function getUpdateKey() {
- return __CLASS__;
+ return __CLASS__ . ':v2';
}
protected function doDBUpdates() {
+ $this->removeSpecialPages();
+ $this->rebuildCoreTables();
+
+ $this->output( "Completed\n" );
+
+ return true;
+ }
+
+ protected function removeSpecialPages() {
+ /** @var \Flow\Data\ObjectManager $storage */
+ $storage = Container::get( 'storage.wiki_reference' );
+ $links = $storage->find( array( 'ref_target_namespace' => -1 )
);
+ if ( $links ) {
+ $storage->multiRemove( $links, array() );
+ }
+
+ $this->output( "Removed " . count( $links ) . " links to
special pages.\n");
+ }
+
+ protected function rebuildCoreTables() {
$dbw = wfGetDB( DB_MASTER );
$dbr = Container::get( 'db.factory' )->getDB( DB_SLAVE );
+ /** @var \Flow\LinksTableUpdater $linksTableUpdater */
$linksTableUpdater = Container::get(
'reference.updater.links-tables' );
$iterator = new BatchRowIterator( $dbr, 'flow_workflow',
'workflow_id', $this->mBatchSize );
@@ -59,12 +80,10 @@
}
$dbw->commit();
+
+ $this->output( "Rebuilt links for " . count( $rows ) .
" workflows...\n" );
wfWaitForSlaves();
}
-
- $this->output( "Completed\n" );
-
- return true;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/234972
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If98fc695070fbf5d50184ad7aeb5e72b64db8b7b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits