List of steps to reproduce (step by step, including full links if applicable):
- Identify an existing cargo table name
- php extensions/Cargo/maintenance/cargoRecreateData.php --table <table name>
What happens?:
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/heads/master/includes/Title.php#3059
Due to page_namespace not being selected, it throws PHP WARN at
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/heads/master/includes/Title.php#3072
And empty Title object returned
[error] [674972808e8245805261935f] /api.php?action=cargorecreatedata&table=Familiars&template=Infobox-familiar&offset=0 PHP Notice: Undefined property: stdClass::$page_namespace
#0 /var/www/wiki/includes/Title.php(3158): MWExceptionHandler::handleError()
#1 /var/www/wiki/includes/Title.php(3179): Title->getLinksTo()
#2 /var/www/wiki/extensions/Cargo/includes/api/CargoRecreateDataAPI.php(42): Title->getTemplateLinksTo()
#3 /var/www/wiki/includes/api/ApiMain.php(1874): CargoRecreateDataAPI->execute()
#4 /var/www/wiki/includes/api/ApiMain.php(853): ApiMain->executeAction()
#5 /var/www/wiki/includes/api/ApiMain.php(824): ApiMain->executeActionWithErrorHandling()
#6 /var/www/wiki/api.php(90): ApiMain->execute()
#7 /var/www/wiki/api.php(45): wfApiMain()
#8 {main}Due to this, Cargo data cannot be created as Title would always be empty
What should have happened instead?:
Title object should be properly setup and returned without any warning
Cargo data can be properly inserted and created
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
https://github.com/wikimedia/mediawiki/tree/REL1_37
https://github.com/wikimedia/mediawiki-extensions-Cargo/tree/REL1_37
Suggested fix
Replace
LinkCache::getSelectFields(),
with
self::getSelectFields(),