(bug 35980) drcontinue should pay attention to drdir in "all" mode
[lhc/web/wiklou.git] / includes / api / ApiQueryWatchlistRaw.php
index 4adadf1..1b1eee0 100644 (file)
@@ -76,12 +76,12 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                                        "original value returned by the previous query", "_badcontinue" );
                        }
                        $ns = intval( $cont[0] );
-                       $title = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
+                       $title = $this->getDB()->addQuotes( $this->titleToKey( $cont[1] ) );
                        $op = $params['dir'] == 'ascending' ? '>' : '<';
                        $this->addWhere(
-                               "wl_namespace $op '$ns' OR " .
-                               "(wl_namespace = '$ns' AND " .
-                               "wl_title $op= '$title')"
+                               "wl_namespace $op $ns OR " .
+                               "(wl_namespace = $ns AND " .
+                               "wl_title $op= $title)"
                        );
                }
 
@@ -90,7 +90,10 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                if ( count( $params['namespace'] ) == 1 ) {
                        $this->addOption( 'ORDER BY', 'wl_title' . $sort );
                } else {
-                       $this->addOption( 'ORDER BY', 'wl_namespace' . $sort . ', wl_title' . $sort );
+                       $this->addOption( 'ORDER BY', array(
+                               'wl_namespace' . $sort,
+                               'wl_title' . $sort
+                       ));
                }
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
                $res = $this->select( __METHOD__ );
@@ -189,6 +192,21 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       ),
+                       'changed' => array(
+                               'changed' => array(
+                                       ApiBase::PROP_TYPE => 'timestamp',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
+                       )
+               );
+       }
+
        public function getDescription() {
                return "Get all pages on the logged in user's watchlist";
        }