Merge "wfProfileOut() for new return added in c6396 (c4e407c)"
[lhc/web/wiklou.git] / includes / api / ApiQueryCategories.php
index 1c1f155..cbda6ab 100644 (file)
@@ -89,12 +89,13 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                                $this->dieUsage( "Invalid continue param. You should pass the " .
                                        "original value returned by the previous query", "_badcontinue" );
                        }
+                       $op = $params['dir'] == 'descending' ? '<' : '>';
                        $clfrom = intval( $cont[0] );
-                       $clto = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) );
+                       $clto = $this->getDB()->addQuotes( $this->titleToKey( $cont[1] ) );
                        $this->addWhere(
-                               "cl_from > $clfrom OR " .
+                               "cl_from $op $clfrom OR " .
                                "(cl_from = $clfrom AND " .
-                               "cl_to >= '$clto')"
+                               "cl_to $op= $clto)"
                        );
                }
 
@@ -123,14 +124,14 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
 
                $this->addOption( 'USE INDEX', array( 'categorylinks' => 'cl_from' ) );
 
-               $dir = ( $params['dir'] == 'descending' ? ' DESC' : '' );
+               $sort = ( $params['dir'] == 'descending' ? ' DESC' : '' );
                // Don't order by cl_from if it's constant in the WHERE clause
                if ( count( $this->getPageSet()->getGoodTitles() ) == 1 ) {
-                       $this->addOption( 'ORDER BY', 'cl_to' . $dir );
+                       $this->addOption( 'ORDER BY', 'cl_to' . $sort );
                } else {
                        $this->addOption( 'ORDER BY', array(
-                                               'cl_from' . $dir,
-                                               'cl_to' . $dir
+                                               'cl_from' . $sort,
+                                               'cl_to' . $sort
                        ));
                }