diff --git a/src/PagePropsStatementCountLookup.php b/src/PagePropsStatementCountLookup.php index 3799f46..8bd36bc 100644 --- a/src/PagePropsStatementCountLookup.php +++ b/src/PagePropsStatementCountLookup.php @@ -14,13 +14,15 @@ public function __construct( LoadBalancer $loadBalancer ) { } public function getStatementCount( EntityId $entityId ) { + global $wgWBRepoSettings; + $db = $this->loadBalancer->getConnection( DB_MASTER ); $res = $db->selectRow( array( 'page_props', 'page' ), array( 'pp_value' ), array( - 'page_namespace' => 0, + 'page_namespace' => array_values( $wgWBRepoSettings['entityNamespaces'] ), 'page_title' => $entityId->getSerialization(), 'pp_propname' => 'wb-claims' ), @@ -32,7 +34,7 @@ public function getStatementCount( EntityId $entityId ) { $this->loadBalancer->closeConnection( $db ); if ( $res === false ) { - return 0; + throw new Exception( "Could not find entity in page_props!" ); } return (int)$res->pp_value;