diff options
Diffstat (limited to 'maintenance/dumpSisterSites.php')
-rw-r--r-- | maintenance/dumpSisterSites.php | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/maintenance/dumpSisterSites.php b/maintenance/dumpSisterSites.php index 2a7369c0..d9fd28a6 100644 --- a/maintenance/dumpSisterSites.php +++ b/maintenance/dumpSisterSites.php @@ -21,29 +21,36 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * - * @file - * @ingroup SpecialPage + * @ingroup Maintenance */ -require_once( 'commandLine.inc' ); +require_once( dirname(__FILE__) . '/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' ); +class DumpSisterSites extends Maintenance { + public function __construct() { + parent::__construct(); + $this->mDescription = "Quickie page name dump script for SisterSites usage"; + } + + 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__ ); -while( $row = $dbr->fetchObject( $result ) ) { - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); - $url = $title->getFullUrl(); - $text = $title->getPrefixedText(); - echo "$url $text\n"; + foreach( $result as $row ) { + $title = Title::makeTitle( $row->page_namespace, $row->page_title ); + $url = $title->getFullUrl(); + $text = $title->getPrefixedText(); + $this->output( "$url $text\n" ); + } + $dbr->freeResult( $result ); + } } -$dbr->freeResult( $result ); - - +$maintClass = "DumpSisterSites"; +require_once( DO_MAINTENANCE ); |