(bug 13718) Return the proper continue parameter for cmsort=timestamp
[lhc/web/wiklou.git] / includes / SpecialExport.php
index 2a0d13f..1fe2e44 100644 (file)
@@ -83,8 +83,8 @@ function wfExportGetLinks( $inputPages, $pageSet, $table, $fields, $join ) {
        $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(
@@ -104,6 +104,13 @@ function wfExportGetLinks( $inputPages, $pageSet, $table, $fields, $join ) {
        return $pageSet;
 }
 
+/**
+ * Callback function to remove empty strings from the pages array.
+ */
+function wfFilterPage( $page ) {
+       return $page !== '' && $page !== null;
+}
+
 /**
  *
  */
@@ -198,7 +205,7 @@ function wfSpecialExport( $page = '' ) {
                }
                
                /* 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' ) ) {
@@ -238,7 +245,7 @@ function wfSpecialExport( $page = '' ) {
                        #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 );
                }