Index: trunk/phase3/maintenance/dumpLinks.php |
— | — | @@ -0,0 +1,63 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Copyright (C) 2005 Brion Vibber <brion@pobox.com> |
| 5 | + * http://www.mediawiki.org/ |
| 6 | + * |
| 7 | + * Quick demo hack to generate a plaintext link dump, |
| 8 | + * per the proposed wiki link database standard: |
| 9 | + * http://www.usemod.com/cgi-bin/mb.pl?LinkDatabase |
| 10 | + * |
| 11 | + * Includes all (live and broken) intra-wiki links. |
| 12 | + * Does not include interwiki or URL links. |
| 13 | + * Dumps ASCII text to stdout; command-line. |
| 14 | + * |
| 15 | + * This program is free software; you can redistribute it and/or modify |
| 16 | + * it under the terms of the GNU General Public License as published by |
| 17 | + * the Free Software Foundation; either version 2 of the License, or |
| 18 | + * (at your option) any later version. |
| 19 | + * |
| 20 | + * This program is distributed in the hope that it will be useful, |
| 21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | + * GNU General Public License for more details. |
| 24 | + * |
| 25 | + * You should have received a copy of the GNU General Public License along |
| 26 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 27 | + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 28 | + * http://www.gnu.org/copyleft/gpl.html |
| 29 | + * |
| 30 | + * @package MediaWiki |
| 31 | + * @subpackage SpecialPage |
| 32 | + */ |
| 33 | + |
| 34 | +require_once './commandLine.inc'; |
| 35 | + |
| 36 | +$dbr =& wfGetDB( DB_SLAVE ); |
| 37 | +$result = $dbr->select( array( 'pagelinks', 'page' ), |
| 38 | + array( |
| 39 | + 'page_id', |
| 40 | + 'page_namespace', |
| 41 | + 'page_title', |
| 42 | + 'pl_namespace', |
| 43 | + 'pl_title' ), |
| 44 | + array( 'page_id=pl_from' ), |
| 45 | + 'dumpLinks', |
| 46 | + array( 'ORDER BY page_id' ) ); |
| 47 | + |
| 48 | +$lastPage = null; |
| 49 | +while( $row = $dbr->fetchObject( $result ) ) { |
| 50 | + if( $lastPage != $row->page_id ) { |
| 51 | + if( isset( $lastPage ) ) { |
| 52 | + print "\n"; |
| 53 | + } |
| 54 | + $page = Title::makeTitle( $row->page_namespace, $row->page_title ); |
| 55 | + print $page->getPrefixedUrl(); |
| 56 | + $lastPage = $row->page_id; |
| 57 | + } |
| 58 | + $link = Title::makeTitle( $row->pl_namespace, $row->pl_title ); |
| 59 | + print " " . $link->getPrefixedUrl(); |
| 60 | +} |
| 61 | +if( isset( $lastPage ) ) |
| 62 | + print "\n"; |
| 63 | + |
| 64 | +?> |
\ No newline at end of file |
Property changes on: trunk/phase3/maintenance/dumpLinks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 65 | + native |
Added: svn:keywords |
2 | 66 | + Author Date Id Revision |