00001 <?php 00033 require_once 'commandLine.inc'; 00034 00035 $dbr = wfGetDB( DB_SLAVE ); 00036 $result = $dbr->select( array( 'pagelinks', 'page' ), 00037 array( 00038 'page_id', 00039 'page_namespace', 00040 'page_title', 00041 'pl_namespace', 00042 'pl_title' ), 00043 array( 'page_id=pl_from' ), 00044 'dumpLinks', 00045 array( 'ORDER BY' => 'page_id' ) ); 00046 00047 $lastPage = null; 00048 while( $row = $dbr->fetchObject( $result ) ) { 00049 if( $lastPage != $row->page_id ) { 00050 if( isset( $lastPage ) ) { 00051 print "\n"; 00052 } 00053 $page = Title::makeTitle( $row->page_namespace, $row->page_title ); 00054 print $page->getPrefixedUrl(); 00055 $lastPage = $row->page_id; 00056 } 00057 $link = Title::makeTitle( $row->pl_namespace, $row->pl_title ); 00058 print " " . $link->getPrefixedUrl(); 00059 } 00060 if( isset( $lastPage ) ) 00061 print "\n"; 00062 00063