GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/289337

Change subject: WIP: exportRestrictions maintenance script
......................................................................

WIP: exportRestrictions maintenance script

Bug: T135278
Change-Id: I74aec31c86557b1997e95bf435bca5227f93b0ef
---
A maintenance/exportRestrictions.php
1 file changed, 60 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/289337/1

diff --git a/maintenance/exportRestrictions.php 
b/maintenance/exportRestrictions.php
new file mode 100644
index 0000000..59a9406
--- /dev/null
+++ b/maintenance/exportRestrictions.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Dump revision restrictions, one batch at a time.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Maintenance
+ * @author Gabriel Wicke <gwi...@wikimedia.org>
+ */
+
+require_once __DIR__ . '/Maintenance.php';
+
+/**
+ * Maintenance script to dump revision restrictions, one batch at a time.
+ *
+ * @ingroup Maintenance
+ */
+class ExportRevisionRestrictions extends Maintenance {
+
+       public function __construct() {
+               parent::__construct();
+               $this->addDescription( 'Dump revision restrictions, one batch 
at a time.' );
+               $this->addOption( 'start', 'Start from this revision.' );
+               $this->addOption( 'limit', 'Limit the batch size to this 
value.' );
+       }
+
+       public function execute() {
+               $dbr = $this->getDB( DB_SLAVE, 'vslow' );
+               $batchResult = $dbr->select( [ 'revision', 'page' ],
+                       [ 'page_title', 'page_id', 'rev_id', 'rev_deleted' ],
+                       [ 'rev_id > ' . intval( $this->getOption( 'start', '0' 
) ),
+                               'rev_deleted != 0' ],
+                       __METHOD__,
+                       [ 'ORDER BY' => 'rev_id ASC',
+                               'LIMIT' => intval( $this->getOption( 'limit', 
1000 ) ) ],
+                       [ 'page_id'     => 'rev_page' ] );
+               $rows = [];
+               forEach( $batchResult as $row ) {
+                       $rows[] = $row;
+               }
+               $this->output(json_encode($rows));
+       }
+}
+
+$maintClass = "ExportRevisionRestrictions";
+require_once RUN_MAINTENANCE_IF_MAIN;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74aec31c86557b1997e95bf435bca5227f93b0ef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: GWicke <gwi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to