From 01eada74ef953acfdbc6db01df76e0923260ac6c Mon Sep 17 00:00:00 2001 From: David Causse Date: Thu, 30 Jul 2020 16:40:06 +0200 Subject: [PATCH] Write category parent hierarchy when handling categorization Since we do brute force update (DELETE ALL+INSERT ALL) of the parent categories we need to always write the parent category hierarchy. Bug: T246568 Change-Id: Id9c3282a97bf3fc3d5355cc08a0c9d833c72c9b2 --- maintenance/categoryChangesAsRdf.php | 19 ++----------------- .../data/categoriesrdf/categorization.txt | 4 ++++ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/maintenance/categoryChangesAsRdf.php b/maintenance/categoryChangesAsRdf.php index 7dd5d073454..938560182f6 100644 --- a/maintenance/categoryChangesAsRdf.php +++ b/maintenance/categoryChangesAsRdf.php @@ -54,23 +54,6 @@ DELETE { SPARQLD; - /** - * Delete/Insert query - */ - private const SPARQL_DELETE_INSERT = <<writeCategoryData( $row ); + $pages[$row->page_id] = $row->rc_title; $deleteUrls[] = '<' . $this->categoriesRdf->labelToUrl( $row->rc_title ) . '>'; $this->processed[$row->page_id] = true; } @@ -682,6 +666,7 @@ SPARQL; continue; } $this->writeCategoryData( $row ); + $pages[$row->page_id] = $row->rc_title; $deleteUrls[] = '<' . $this->categoriesRdf->labelToUrl( $row->rc_title ) . '>'; if ( $row->page_id ) { $this->processed[$row->page_id] = true; diff --git a/tests/phpunit/data/categoriesrdf/categorization.txt b/tests/phpunit/data/categoriesrdf/categorization.txt index 7799112360e..8dbf02c80dd 100644 --- a/tests/phpunit/data/categoriesrdf/categorization.txt +++ b/tests/phpunit/data/categoriesrdf/categorization.txt @@ -24,4 +24,8 @@ INSERT DATA { mediawiki:pages "0"^^xsd:integer ; mediawiki:subcategories "1"^^xsd:integer . + mediawiki:isInCategory . + + mediawiki:isInCategory . + };