(bug 9226) Fetch restrictions properly on export
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 6 Oct 2008 23:51:33 +0000 (23:51 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 6 Oct 2008 23:51:33 +0000 (23:51 +0000)
includes/Export.php

index 827561e..72e8f1e 100644 (file)
@@ -425,13 +425,20 @@ class XmlDumpWriter {
         * @access private
         */
        function openPage( $row ) {
+               global $wgRestrictionTypes;
                $out = "  <page>\n";
                $title = Title::makeTitle( $row->page_namespace, $row->page_title );
                $out .= '    ' . wfElementClean( 'title', array(), $title->getPrefixedText() ) . "\n";
                $out .= '    ' . wfElement( 'id', array(), strval( $row->page_id ) ) . "\n";
-               if( '' != $row->page_restrictions ) {
-                       $out .= '    ' . wfElement( 'restrictions', array(),
-                               strval( $row->page_restrictions ) ) . "\n";
+               # Get page restrictions
+               $restrictions = array();
+               foreach( $wgRestrictionTypes as $action ) {
+                       $restrictions[$action] = implode( '', $title->getRestrictions( $action ) );
+               }
+               $restrictions = Article::flattenRestrictions( $restrictions );
+               if( '' != $restrictions ) {
+                       $out .= '    ' . wfElement( 'restrictions', array(), 
+                               strval( $restrictions ) ) . "\n";
                }
                return $out;
        }