Merge "escape HTML elements in docblock with double quotes"
[lhc/web/wiklou.git] / includes / api / ApiImport.php
index ade9f1f..15eac33 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Created on Feb 4, 2009
  *
- * Copyright © 2009 Roan Kattouw <Firstname>.<Lastname>@gmail.com
+ * Copyright © 2009 Roan Kattouw "<Firstname>.<Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -126,6 +126,17 @@ class ApiImport extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_LIST => true,
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'revisions' => 'integer'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array(
                        'Import a page from another wiki, or an XML file.' ,
@@ -186,8 +197,16 @@ class ApiImportReporter extends ImportReporter {
        function reportPage( $title, $origTitle, $revisionCount, $successCount, $pageInfo ) {
                // Add a result entry
                $r = array();
-               ApiQueryBase::addTitleInfo( $r, $title );
-               $r['revisions'] = intval( $successCount );
+
+               if ( $title === null ) {
+                       # Invalid or non-importable title
+                       $r['title'] = $pageInfo['title'];
+                       $r['invalid'] = '';
+               } else {
+                       ApiQueryBase::addTitleInfo( $r, $title );
+                       $r['revisions'] = intval( $successCount );
+               }
+
                $this->mResultArr[] = $r;
 
                // Piggyback on the parent to do the logging