Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/335387 )

Change subject: CloneDatabase: Populate site_stats when cloning it
......................................................................

CloneDatabase: Populate site_stats when cloning it

If $wgMiserMode is set, SiteStats breaks if the singleton row in the
site_stats table is missing. CloneDatabase should make sure this row is
populated when it's cloning the table, instead of leaving the table
empty.

Bug: T156881
Change-Id: Ib3274dc7f14e908fa5a14a22cd8fa185bec84a99
---
M includes/db/CloneDatabase.php
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/87/335387/1

diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php
index 2b394b6..4686526 100644
--- a/includes/db/CloneDatabase.php
+++ b/includes/db/CloneDatabase.php
@@ -109,6 +109,22 @@
                        wfDebug( __METHOD__ . " duplicating $oldTableName to 
$newTableName\n" );
                        $this->db->duplicateTableStructure(
                                $oldTableName, $newTableName, 
$this->useTemporaryTables );
+
+                       # SiteStats breaks if the singleton row in site_stats 
is missing,
+                       # so make sure it's created.
+                       if ( $tbl === 'site_stats' ) {
+                               $this->db->insert( 'site_stats',
+                                       [
+                                               'ss_row_id' => 1,
+                                               'ss_total_edits' => 0,
+                                               'ss_good_articles' => 0,
+                                               'ss_total_pages' => 0,
+                                               'ss_users' => 0,
+                                               'ss_images' => 0
+                                       ],
+                                       __METHOD__, 'IGNORE'
+                               );
+                       }
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/335387
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3274dc7f14e908fa5a14a22cd8fa185bec84a99
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to