Merge "Correct case for the "MediaWiki:Revdelete-reason-dropdown" link in Special...
[lhc/web/wiklou.git] / includes / api / ApiQueryBacklinks.php
index bf9aa3d..fcb9c4b 100644 (file)
@@ -188,25 +188,25 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $titleWhere = array();
                foreach ( $this->redirTitles as $t ) {
                        $titleWhere[] = "{$this->bl_title} = " . $db->addQuotes( $t->getDBkey() ) .
-                                       ( $this->hasNS ? " AND {$this->bl_ns} = '{$t->getNamespace()}'" : '' );
+                                       ( $this->hasNS ? " AND {$this->bl_ns} = {$t->getNamespace()}" : '' );
                }
                $this->addWhere( $db->makeList( $titleWhere, LIST_OR ) );
                $this->addWhereFld( 'page_namespace', $this->params['namespace'] );
 
                if ( !is_null( $this->redirID ) ) {
                        $first = $this->redirTitles[0];
-                       $title = $db->strencode( $first->getDBkey() );
+                       $title = $db->addQuotes( $first->getDBkey() );
                        $ns = $first->getNamespace();
                        $from = $this->redirID;
                        if ( $this->hasNS ) {
                                $this->addWhere( "{$this->bl_ns} > $ns OR " .
                                                "({$this->bl_ns} = $ns AND " .
-                                               "({$this->bl_title} > '$title' OR " .
-                                               "({$this->bl_title} = '$title' AND " .
+                                               "({$this->bl_title} > $title OR " .
+                                               "({$this->bl_title} = $title AND " .
                                                "{$this->bl_from} >= $from)))" );
                        } else {
-                               $this->addWhere( "{$this->bl_title} > '$title' OR " .
-                                               "({$this->bl_title} = '$title' AND " .
+                               $this->addWhere( "{$this->bl_title} > $title OR " .
+                                               "({$this->bl_title} = $title AND " .
                                                "{$this->bl_from} >= $from)" );
                        }
                }
@@ -369,7 +369,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                if ( !is_null( $this->params['continue'] ) ) {
                        $this->parseContinueParam();
                } else {
-                       $this->rootTitle = $this->getTitleOrPageId( $this->params );
+                       $this->rootTitle = $this->getTitleOrPageId( $this->params )->getTitle();
                }
 
                // only image titles are allowed for the root in imageinfo mode
@@ -481,6 +481,17 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                ) );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'pageid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string',
+                               'redirect' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                switch ( $this->getModuleName() ) {
                        case 'backlinks':