API: Handle empty xxnamespace parameter in ApiQueryBacklinksprop
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 1 Oct 2018 14:18:40 +0000 (10:18 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 1 Oct 2018 14:18:40 +0000 (10:18 -0400)
If the xxnamespace parameter is specified but empty, we don't need to do
anything because there will be no results.

Bug: T205810
Change-Id: Iae5d766a5408368cadd01583d18b745661304a7f

includes/api/ApiQueryBacklinksprop.php

index bfacc51..f04ac66 100644 (file)
@@ -129,6 +129,9 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
                if ( !$titles ) {
                        return; // nothing to do
                }
+               if ( $params['namespace'] !== null && count( $params['namespace'] ) === 0 ) {
+                       return; // nothing to do
+               }
 
                // Figure out what we're sorting by, and add associated WHERE clauses.
                // MySQL's query planner screws up if we include a field in ORDER BY