$dbr = wfGetDB( DB_SLAVE );
foreach( $inputPages as $page ) {
$title = Title::newFromText( $page );
- $pageSet[$title->getPrefixedText()] = true;
if( $title ) {
+ $pageSet[$title->getPrefixedText()] = true;
/// @fixme May or may not be more efficient to batch these
/// by namespace when given multiple input pages.
$result = $dbr->select(
return $pageSet;
}
+/**
+ * Callback function to remove empty strings from the pages array.
+ */
+function wfFilterPage( $page ) {
+ return $page !== '' && $page !== null;
+}
+
/**
*
*/
}
/* Split up the input and look up linked pages */
- $inputPages = array_filter( explode( "\n", $page ) );
+ $inputPages = array_filter( explode( "\n", $page ), 'wfFilterPage' );
$pageSet = array_flip( $inputPages );
if( $wgRequest->getCheck( 'templates' ) ) {
#Bug 8824: Only export pages the user can read
$title = Title::newFromText( $page );
if( is_null( $title ) ) continue; #TODO: perhaps output an <error> tag or something.
- if( !$title->userCan( 'read' ) ) continue; #TODO: perhaps output an <error> tag or something.
+ if( !$title->userCanRead() ) continue; #TODO: perhaps output an <error> tag or something.
$exporter->pageByTitle( $title );
}