Page MenuHomePhabricator

PHP Notice: Undefined index: afc_state
Closed, InvalidPublicPRODUCTION ERROR

Description

Error
  • mwversion: 1.40.0-alpha
  • reqId: Y308zrdrOxjNvwK8yYE5HgAAABA
  • Request
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined index: afc_state
exception.trace
from /srv/mediawiki/php-master/extensions/PageTriage/includes/Api/ApiPageTriageList.php(513)
#0 /srv/mediawiki/php-master/extensions/PageTriage/includes/Api/ApiPageTriageList.php(513): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-master/extensions/PageTriage/includes/Api/ApiPageTriageList.php(356): MediaWiki\Extension\PageTriage\Api\ApiPageTriageList::buildTagQuery(array)
#2 /srv/mediawiki/php-master/extensions/PageTriage/includes/PageTriageUtil.php(169): MediaWiki\Extension\PageTriage\Api\ApiPageTriageList::getPageIds(array, boolean)
#3 /srv/mediawiki/php-master/extensions/PageTriage/includes/Api/ApiPageTriageStats.php(24): MediaWiki\Extension\PageTriage\PageTriageUtil::getArticleFilterStat(array)
#4 /srv/mediawiki/php-master/includes/api/ApiMain.php(1902): MediaWiki\Extension\PageTriage\Api\ApiPageTriageStats->execute()
#5 /srv/mediawiki/php-master/includes/api/ApiMain.php(877): ApiMain->executeAction()
#6 /srv/mediawiki/php-master/includes/api/ApiMain.php(848): ApiMain->executeActionWithErrorHandling()
#7 /srv/mediawiki/php-master/api.php(90): ApiMain->execute()
#8 /srv/mediawiki/php-master/api.php(45): wfApiMain()
#9 /srv/mediawiki/w/api.php(3): require(string)
#10 {main}
Impact
Notes

Noticed during deploy of T323378: Install and test PageTriage for zhwiki on Beta Cluster to the beta cluster — possilikely expected behaviour

Details

Request URL
https://zh.wikipedia.beta.wmflabs.org/w/api.php?action=pagetriagestats&afcDir=*&afc_state=*&format=*&namespace=*&showreviewed=*&showunreviewed=*

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I'd guess that the relevant row is missing from the pagetriage_tags table.

I'd guess that the relevant row is missing from the pagetriage_tags table.

Agreed, though the question was more why, given I'd run mwscript extensions/WikimediaMaintenance/createExtensionTables.php zhwiki pagetriage ?

afc_state is also missing in the testwiki2 SQL database. T224705

The relevant code that is supposed to add afc_state appears to be here: https://github.com/wikimedia/mediawiki-extensions-PageTriage/blob/55fc8388a036a28a44494524195bac3e75423ee0/includes/Hooks.php#L963-L968 Is there any reason this code wouldn't get run during the zhwiki beta cluster installation procedure?

Also, according to that code, it appears to try to insert afc_state twice, on line 963 and on line 968. Is that a bug? Could that be leading to some weird behavior?

Reedy closed this task as Invalid.EditedApr 9 2024, 7:49 AM
Reedy subscribed.

I'd guess that the relevant row is missing from the pagetriage_tags table.

Agreed, though the question was more why, given I'd run mwscript extensions/WikimediaMaintenance/createExtensionTables.php zhwiki pagetriage ?

As this is still open, and never answered...

The createExtensionTables.php literally only does what the name says, it creates extension tables.

So for page triage:

			case 'pagetriage':
				$files = [ 'tables-generated.sql' ];
				$path = "$IP/extensions/PageTriage/sql/mysql";
				break;

It wouldn't run onLoadExtensionSchemaUpdates.

However, as the beta cluster is special, onLoadExtensionSchemaUpdates would be run when CI/Jenkins runs update.php, so the rows would've been created later.

Similarly, the tables in theory didn't need creating manually via running createExtensionTables.php.

reedy@deployment-deploy03:~$ sql zhwiki
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 17739678
Server version: 10.6.16-MariaDB-log MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [zhwiki]> select * from pagetriage_tags;
+-------------+--------------------+---------------------------------------------------------------------------------+
| ptrt_tag_id | ptrt_tag_name      | ptrt_tag_desc                                                                   |
+-------------+--------------------+---------------------------------------------------------------------------------+
|           1 | linkcount          | Number of inbound links                                                         |
|           2 | category_count     | Category mapping count                                                          |
|           3 | csd_status         | CSD status                                                                      |
|           4 | prod_status        | PROD status                                                                     |
|           5 | blp_prod_status    | BLP PROD status                                                                 |
|           6 | afd_status         | AFD status                                                                      |
|           7 | rev_count          | Number of edits to the article                                                  |
|           8 | page_len           | Number of bytes of article                                                      |
|           9 | snippet            | Beginning of article snippet                                                    |
|          10 | user_name          | User name                                                                       |
|          11 | user_editcount     | User total edit                                                                 |
|          12 | user_creation_date | User registration date                                                          |
|          13 | user_autoconfirmed | Check if user is autoconfirmed                                                  |
|          14 | user_experience    | Experience level: newcomer, learner, experienced or anonymous                   |
|          15 | user_bot           | Check if user is in bot group                                                   |
|          16 | user_block_status  | User block status                                                               |
|          17 | user_id            | User id                                                                         |
|          18 | reference          | Check if page has references                                                    |
|          19 | afc_state          | The submission state of drafts                                                  |
|          20 | copyvio            | Latest revision ID that has been tagged as a likely copyright violation, if any |
|          21 | recreated          | Check if the page has been previously deleted.                                  |
+-------------+--------------------+---------------------------------------------------------------------------------+
21 rows in set (0.001 sec)