File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public function newEntityImporter() {
7070 $ this ->getApiEntityLookup (),
7171 $ this ->entityStore ,
7272 $ this ->getImportedEntityMappingStore (),
73- new PagePropsStatementCountLookup ( $ this ->loadBalancer ),
73+ new PagePropsStatementCountLookup ( $ this ->loadBalancer , $ this -> getEntityNamespaceLookup () ),
7474 $ this ->logger
7575 );
7676 }
@@ -127,6 +127,12 @@ private function newSerializerFactory() {
127127 new DataValueSerializer ()
128128 );
129129 }
130+
131+ private function getEntityNamespaceLookup () {
132+ $ wikibaseRepo = WikibaseRepo::getDefaultInstance ();
133+
134+ return $ wikibaseRepo ->getEntityNamespaceLookup ();
135+ }
130136}
131137
132138$ maintClass = "Wikibase\Import\Maintenance\ImportEntities " ;
Original file line number Diff line number Diff line change 22
33namespace Wikibase \Import ;
44
5+ use Exception ;
56use LoadBalancer ;
67use Wikibase \DataModel \Entity \EntityId ;
8+ use Wikibase \Lib \Store \EntityNamespaceLookup ;
9+ use Wikibase \Repo \WikibaseRepo ;
710
811class PagePropsStatementCountLookup implements StatementsCountLookup {
912
1013 private $ loadBalancer ;
1114
12- public function __construct ( LoadBalancer $ loadBalancer ) {
15+ private $ lookup ;
16+
17+ public function __construct ( LoadBalancer $ loadBalancer , EntityNamespaceLookup $ lookup ) {
1318 $ this ->loadBalancer = $ loadBalancer ;
19+ $ this ->lookup = $ lookup ;
1420 }
1521
1622 public function getStatementCount ( EntityId $ entityId ) {
@@ -20,7 +26,7 @@ public function getStatementCount( EntityId $entityId ) {
2026 array ( 'page_props ' , 'page ' ),
2127 array ( 'pp_value ' ),
2228 array (
23- 'page_namespace ' => 0 ,
29+ 'page_namespace ' => $ this -> lookup -> getEntityNamespace ( $ entityId -> getEntityType () ) ,
2430 'page_title ' => $ entityId ->getSerialization (),
2531 'pp_propname ' => 'wb-claims '
2632 ),
@@ -32,7 +38,7 @@ public function getStatementCount( EntityId $entityId ) {
3238 $ this ->loadBalancer ->closeConnection ( $ db );
3339
3440 if ( $ res === false ) {
35- return 0 ;
41+ throw new Exception ( ' Could not find entity ' . $ entityId -> getSerialization () . ' in page_props! ' ) ;
3642 }
3743
3844 return (int )$ res ->pp_value ;
You can’t perform that action at this time.
0 commit comments