Page MenuHomePhabricator

IPInfo: REST APIs throw an exception if site is in read only mode
Closed, ResolvedPublic1 Estimated Story Points

Description

Summary

When a wiki is configured to insert jobs into a database table, the IP Info REST APIs return a 500 error when the site is in read only mode along with a stack trace. This should instead return a more user friendly error.

Background

  • When a user uses the IP Info popup or infobox, a REST API request is made to the IPInfo REST APIs
    • This request will create a log entry if the subject is defined (which is in most cases)
  • Inserting jobs on wikis may require writing to the DB, if the $wgJobTypeConf is configured to use the DB (which is the default)
  • Even if the job is inserted, the write in the job will still fail
  • When in read-only mode we should probably disable the REST APIs because we need to log the use of them.

Acceptance criteria

  • IP Info REST APIs return a user-friendly error message when the site is in read only mode

Event Timeline

Change #1123008 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/IPInfo@master] REST APIs: Return user friendly error when site in read only mode

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

Dreamy_Jazz renamed this task from IPInfo: REST APIs return 500 error if site is in read only mode to IPInfo: REST APIs throw an exception if site is in read only mode.Feb 26 2025, 5:52 PM

Change #1123008 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] REST APIs: Return user friendly error when site in read only mode

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

Djackson-ctr subscribed.

QA is completed, I have verified the new code has been implemented and is functioning as expected (When a site is in read-only mode, and a user is viewing a page with the IP Info popup icon or the IP Infobox (such as: Logs or Recent Changes or View History or User Contributions), and then the user selects the IP Info popup icon or views the IP Infobox, it will display an error message indicating the database cannot be modified).

image.png (309×1 px, 32 KB)

image.png (854×889 px, 53 KB)