X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=maintenance%2FdumpCategoriesAsRdf.php;h=e4bd7564a62125634a1eb28f519bf92111181cb9;hb=5a7e9ba954c9b0556269be941080cd8c8fd10ff0;hp=c1835d05d1470bd141009d6a368f9ac87d19df63;hpb=58858df842f91d9ea1c9f9b6f3c767d8b204886b;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/dumpCategoriesAsRdf.php b/maintenance/dumpCategoriesAsRdf.php index c1835d05d1..e4bd7564a6 100644 --- a/maintenance/dumpCategoriesAsRdf.php +++ b/maintenance/dumpCategoriesAsRdf.php @@ -58,14 +58,32 @@ class DumpCategoriesAsRdf extends Maintenance { public function getCategoryIterator( IDatabase $dbr ) { $it = new BatchRowIterator( $dbr, - 'page', + [ 'page', 'page_props', 'category' ], [ 'page_title' ], $this->getBatchSize() ); $it->addConditions( [ 'page_namespace' => NS_CATEGORY, ] ); - $it->setFetchColumns( [ 'page_title', 'page_id' ] ); + $it->setFetchColumns( [ + 'page_title', + 'page_id', + 'pp_propname', + 'cat_pages', + 'cat_subcats', + 'cat_files' + ] ); + $it->addJoinConditions( + [ + 'page_props' => [ + 'LEFT JOIN', [ 'pp_propname' => 'hiddencat', 'pp_page = page_id' ] + ], + 'category' => [ + 'LEFT JOIN', [ 'cat_title = page_title' ] + ] + ] + + ); return $it; } @@ -90,6 +108,9 @@ class DumpCategoriesAsRdf extends Maintenance { return new RecursiveIteratorIterator( $it ); } + /** + * @param int $timestamp + */ public function addDumpHeader( $timestamp ) { global $wgRightsUrl; $licenseUrl = $wgRightsUrl; @@ -129,7 +150,12 @@ class DumpCategoriesAsRdf extends Maintenance { foreach ( $this->getCategoryIterator( $dbr ) as $batch ) { $pages = []; foreach ( $batch as $row ) { - $this->categoriesRdf->writeCategoryData( $row->page_title ); + $this->categoriesRdf->writeCategoryData( + $row->page_title, + $row->pp_propname === 'hiddencat', + (int)$row->cat_pages - (int)$row->cat_subcats - (int)$row->cat_files, + (int)$row->cat_subcats + ); $pages[$row->page_id] = $row->page_title; } @@ -154,5 +180,5 @@ class DumpCategoriesAsRdf extends Maintenance { } } -$maintClass = "DumpCategoriesAsRdf"; +$maintClass = DumpCategoriesAsRdf::class; require_once RUN_MAINTENANCE_IF_MAIN;