Page MenuHomePhabricator

unused images is broken
Closed, ResolvedPublic

Description

On https://commons.wikimedia.org/wiki/Commons:Monuments_database/Unused_images/Statistics all the countries report failed: unexpected error during processing

Found the logs in logs/post_harvesting_python.err and there I see a lot off:

ERROR: Unknown error occurred when processing country cl in lang es
(1054, "Unknown column 'cl_to' in 'WHERE'")

It broke on March 13, the friday of the hackathon, suggesting related to the upgrades?

Details

Related Changes in Gerrit:

Event Timeline

Searching for this,

On unused_monument_images.py, cl_to is used in getMonumentPhotos here. When I connect dbeaver to commons in the view categorylink I don't see a field cl_to at all. Needs more research.

The field cl_to is deprecated in mediawiki 1.45, source: https://www.mediawiki.org/wiki/Manual:Categorylinks_table

With the help of gemini, the correct query should be:

SELECT 
    p.page_title, 
    cl.cl_sortkey_prefix 
FROM page p
JOIN categorylinks cl ON p.page_id = cl.cl_from 
JOIN linktarget lt ON cl.cl_target_id = lt.lt_id
WHERE 
    p.page_namespace = 6 
    AND p.page_is_redirect = 0 
    AND lt.lt_namespace = 14  -- Namespace 14 is Category
    AND lt.lt_title = 'Category_name';

Tested in dbeaver and this does produce results.

Change #1261338 had a related patch set uploaded (by Akoopal; author: Akoopal):

[labs/tools/heritage@master] unused_monuments_images run broken

https://gerrit.wikimedia.org/r/1261338

Change #1261338 merged by jenkins-bot:

[labs/tools/heritage@master] unused_monuments_images run broken

https://gerrit.wikimedia.org/r/1261338

Mentioned in SAL (#wikimedia-cloud) [2026-03-26T21:48:21Z] <wmbot~lokal-profil@tools-bastion-15> Deploy 16e703f (T421295), dee6769