Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/174874
Change subject: Maintenance script to dump the site store ...................................................................... Maintenance script to dump the site store as simple as possible that works Change-Id: Iaee4c1f9fb5d54efe01975f733ebd5c339ac106f --- A maintenance/dumpSites.php 1 file changed, 55 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/174874/1 diff --git a/maintenance/dumpSites.php b/maintenance/dumpSites.php new file mode 100644 index 0000000..bb87b94 --- /dev/null +++ b/maintenance/dumpSites.php @@ -0,0 +1,55 @@ +<?php + +/** + * 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 + */ + +require_once __DIR__ . '/Maintenance.php'; + +/** + * Maintenance script to dump the SiteStore as a static json file. + * + * @ingroup Maintenance + */ +class DumpSites extends Maintenance { + + public function __construct() { + parent::__construct(); + + $this->mDescription = "Dumps site store as json"; + $this->addArg( 'file', 'File to output the json to', false ); + } + + public function execute() { + $jsonFile = $this->getArg( 0 ); + + $siteList = SiteSQLStore::newInstance()->getSites(); + $sites = array(); + + foreach( $siteList as $site ) { + $sites[] = unserialize( $site->serialize() ); + } + + file_put_contents( $jsonFile, json_encode( array( 'sites' => $sites ) ) ); + } + +} + +$maintClass = "DumpSites"; +require_once RUN_MAINTENANCE_IF_MAIN; -- To view, visit https://gerrit.wikimedia.org/r/174874 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaee4c1f9fb5d54efe01975f733ebd5c339ac106f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aude <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
