TTO has uploaded a new change for review.
https://gerrit.wikimedia.org/r/148585
Change subject: Update article count when pages are moved
......................................................................
Update article count when pages are moved
If a page is no longer countable (or becomes newly countable) after a move,
we need to update the site statistics (count of content pages).
Bug: 64333
Change-Id: I0349cfe0e32229706e01d654aacf8ccbe5ebabf3
---
M includes/Title.php
M includes/page/WikiPage.php
2 files changed, 12 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/85/148585/1
diff --git a/includes/Title.php b/includes/Title.php
index b7c0a25..29900b0 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -3909,6 +3909,9 @@
$dbw = wfGetDB( DB_MASTER );
+ $oldpage = WikiPage::factory( $this );
+ $oldcountable = $oldpage->isCountable();
+
$newpage = WikiPage::factory( $nt );
if ( $moveOverRedirect ) {
@@ -3956,7 +3959,8 @@
wfRunHooks( 'NewRevisionFromEditComplete',
array( $newpage, $nullRevision,
$nullRevision->getParentId(), $wgUser ) );
- $newpage->doEditUpdates( $nullRevision, $wgUser, array(
'changed' => false ) );
+ $newpage->doEditUpdates( $nullRevision, $wgUser,
+ array( 'changed' => false, 'moved' => true,
'oldcountable' => $oldcountable ) );
if ( !$moveOverRedirect ) {
WikiPage::onArticleCreate( $nt );
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index fc269d8..2d9981d 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -2178,7 +2178,12 @@
wfProfileIn( __METHOD__ );
- $options += array( 'changed' => true, 'created' => false,
'oldcountable' => null );
+ $options += array(
+ 'changed' => true,
+ 'created' => false,
+ 'moved' => false,
+ 'oldcountable' => null
+ );
$content = $revision->getContent();
// Parse the text
@@ -2227,7 +2232,7 @@
$title = $this->mTitle->getPrefixedDBkey();
$shortTitle = $this->mTitle->getDBkey();
- if ( !$options['changed'] ) {
+ if ( !$options['changed'] && !$options['moved'] ) {
$good = 0;
} elseif ( $options['created'] ) {
$good = (int)$this->isCountable( $editInfo );
--
To view, visit https://gerrit.wikimedia.org/r/148585
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0349cfe0e32229706e01d654aacf8ccbe5ebabf3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TTO <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits