X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FdumpSisterSites.php;h=e05e154ed454944cc5a6a30024842d55e2630c2f;hb=51491c785b688a63949d0500703e38b95700d948;hp=45927b0db3113bc413b44ce579489896f71ae870;hpb=c771fc9c96aacb44b86ade5ecca68334c5d8213f;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/dumpSisterSites.php b/maintenance/dumpSisterSites.php index 45927b0db3..e05e154ed4 100644 --- a/maintenance/dumpSisterSites.php +++ b/maintenance/dumpSisterSites.php @@ -3,7 +3,7 @@ * Quickie page name dump script for SisterSites usage. * http://www.eekim.com/cgi-bin/wiki.pl?SisterSites * - * Copyright (C) 2006 Brion Vibber + * Copyright © 2006 Brion Vibber * http://www.mediawiki.org/ * * This program is free software; you can redistribute it and/or modify @@ -21,28 +21,41 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * - * @addtogroup SpecialPage + * @file + * @ingroup Maintenance */ -require_once( 'commandLine.inc' ); +require_once( __DIR__ . '/Maintenance.php' ); -$dbr = wfGetDB( DB_SLAVE ); -$dbr->bufferResults( false ); -$result = $dbr->select( 'page', - array( 'page_namespace', 'page_title' ), - array( - 'page_namespace' => NS_MAIN, - 'page_is_redirect' => 0, - ), - 'dumpSisterSites' ); +/** + * Maintenance script that generates a page name dump for SisterSites usage. + * + * @ingroup Maintenance + */ +class DumpSisterSites extends Maintenance { + public function __construct() { + parent::__construct(); + $this->mDescription = "Quickie page name dump script for SisterSites usage"; + } -while( $row = $dbr->fetchObject( $result ) ) { - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); - $url = $title->getFullUrl(); - $text = $title->getPrefixedText(); - echo "$url $text\n"; -} + public function execute() { + $dbr = wfGetDB( DB_SLAVE ); + $dbr->bufferResults( false ); + $result = $dbr->select( 'page', + array( 'page_namespace', 'page_title' ), + array( 'page_namespace' => NS_MAIN, + 'page_is_redirect' => 0, + ), + __METHOD__ ); -$dbr->freeResult( $result ); + foreach ( $result as $row ) { + $title = Title::makeTitle( $row->page_namespace, $row->page_title ); + $url = $title->getFullUrl(); + $text = $title->getPrefixedText(); + $this->output( "$url $text\n" ); + } + } +} -?> +$maintClass = "DumpSisterSites"; +require_once( RUN_MAINTENANCE_IF_MAIN );