X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcategoryChangesAsRdf.php;h=95a59d23c192df4ff459e3edd403e64c24d7393c;hb=e390198c4e4be7632b01173e42050061f1cc346a;hp=c4f175f3b975983916f45f40dba8b67af39afe4a;hpb=c20cbc6c1201611088d31c5168e4238e00ba6fd1;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/categoryChangesAsRdf.php b/maintenance/categoryChangesAsRdf.php index c4f175f3b9..95a59d23c1 100644 --- a/maintenance/categoryChangesAsRdf.php +++ b/maintenance/categoryChangesAsRdf.php @@ -115,19 +115,18 @@ SPARQLDI; } public function execute() { - global $wgRCMaxAge; - $this->initialize(); $startTS = new MWTimestamp( $this->getOption( "start" ) ); $endTS = new MWTimestamp( $this->getOption( "end" ) ); $now = new MWTimestamp(); + $rcMaxAge = $this->getConfig()->get( 'RCMaxAge' ); - if ( $now->getTimestamp() - $startTS->getTimestamp() > $wgRCMaxAge ) { - $this->error( "Start timestamp too old, maximum RC age is $wgRCMaxAge!" ); + if ( $now->getTimestamp() - $startTS->getTimestamp() > $rcMaxAge ) { + $this->error( "Start timestamp too old, maximum RC age is $rcMaxAge!" ); } - if ( $now->getTimestamp() - $endTS->getTimestamp() > $wgRCMaxAge ) { - $this->error( "End timestamp too old, maximum RC age is $wgRCMaxAge!" ); + if ( $now->getTimestamp() - $endTS->getTimestamp() > $rcMaxAge ) { + $this->error( "End timestamp too old, maximum RC age is $rcMaxAge!" ); } $this->startTS = $startTS->getTimestamp(); @@ -595,6 +594,8 @@ SPARQL; * TODO: For now, we do full update even though some data hasn't changed, * e.g. parents for parent cat and counts for child cat. */ + $childPages = []; + $parentCats = []; foreach ( $batch as $row ) { $childPages[$row->rc_cur_id] = true; $parentCats[$row->rc_title] = true; @@ -614,7 +615,7 @@ SPARQL; $pages = []; $deleteUrls = []; - if ( !empty( $childPages ) ) { + if ( $childPages ) { // Load child rows by ID $childRows = $dbr->select( [ 'page', 'page_props', 'category' ], @@ -642,7 +643,7 @@ SPARQL; } } - if ( !empty( $parentCats ) ) { + if ( $parentCats ) { // Load parent rows by title $joinConditions = [ 'page' => [