Page MenuHomePhabricator

Namespace bug not fixed by rebuildall.php
Closed, InvalidPublicBUG REPORT


Context: It is a "closed" corporative Mediawiki (no way to use URL here). I changed my LocalSettings.php adding some namespaces, editing, and changing namespaces again, and editing again... So perhaps I generated a "bug data", but after run php maintenance/update.php; php maintenance/rebuildall.php no bug-fix.

Steps to Reproduce: The error is produced only when I do a search by word that is into a article of the problematic namespace, using "search all".

Actual Results: complete DUMP of page error message at http://myMediawiki/index.php?title=Especial:Busca&profile=all&search=namespace&fulltext=1

[de46e97d75b91e37d7ff6d45] /index.php?title=Especial:Busca&profile=all&search=namespace&fulltext=1 InvalidArgumentException from line 100 of /var/www/dev-quali/html/includes/Revision/RevisionStoreRecord.php: The given Title does not belong to page ID 130 but actually belongs to 16


#0 /var/www/dev-quali/html/includes/Revision/RevisionStore.php(1823): MediaWiki\Revision\RevisionStoreRecord->__construct(Title, User, CommentStoreComment, stdClass, MediaWiki\Revision\RevisionSlots, boolean)
#1 /var/www/dev-quali/html/includes/Revision/RevisionStore.php(2156): MediaWiki\Revision\RevisionStore->newRevisionFromRow(stdClass, integer, Title)
#2 /var/www/dev-quali/html/includes/Revision/RevisionStore.php(1534): MediaWiki\Revision\RevisionStore->loadRevisionFromConds(Wikimedia\Rdbms\DBConnRef, array, integer, Title)
#3 /var/www/dev-quali/html/includes/Revision.php(138): MediaWiki\Revision\RevisionStore->getRevisionByTitle(Title, boolean, integer)
#4 /var/www/dev-quali/html/includes/search/SearchResult.php(93): Revision::newFromTitle(Title, boolean, integer)
#5 /var/www/dev-quali/html/includes/search/SearchResult.php(74): SearchResult->initFromTitle(Title)
#6 /var/www/dev-quali/html/includes/search/SqlSearchResultSet.php(45): SearchResult::newFromTitle(Title, SqlSearchResultSet)
#7 /var/www/dev-quali/html/includes/search/SearchResultSet.php(110): SqlSearchResultSet->extractResults()
#8 /var/www/dev-quali/html/includes/search/SearchResultSet.php(264): SearchResultSet->count()
#9 /var/www/dev-quali/html/includes/search/SearchEngine.php(183): SearchResultSet->shrink(integer)
#10 /var/www/dev-quali/html/includes/search/SearchEngine.php(84): SearchEngine->maybePaginate(Closure)
#11 /var/www/dev-quali/html/includes/specials/SpecialSearch.php(348): SearchEngine->searchText(string)
#12 /var/www/dev-quali/html/includes/specials/SpecialSearch.php(173): SpecialSearch->showResults(string)
#13 /var/www/dev-quali/html/includes/specialpage/SpecialPage.php(569): SpecialSearch->execute(NULL)
#14 /var/www/dev-quali/html/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(NULL)
#15 /var/www/dev-quali/html/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#16 /var/www/dev-quali/html/includes/MediaWiki.php(865): MediaWiki->performRequest()
#17 /var/www/dev-quali/html/includes/MediaWiki.php(515): MediaWiki->main()
#18 /var/www/dev-quali/html/index.php(42): MediaWiki->run()
#19 {main}

Expected Results: normal page.

Event Timeline

Anomie subscribed.

Yes, you probably introduced a "data bug". It might help if you specify what the page table contains for the two page IDs in the error message, i.e. the output of SELECT * FROM page WHERE page_id IN (130,16). But probably the solution will be to run namespaceDupes.php to clean up page conflicts left over from your namespace editing, as mentioned at

Ciencia_Al_Poder subscribed.

As explained in previous comment, you need to run namespaceDupes.php

rebuildAll is not designed to fix this kind of error, because there's already a maintenance script for that. Feel free to reopen, however, if namespaceDupes.php doesn't fix it, providing the information requested in previous comment.

Hi @Ciencia_Al_Poder and @Anomie , I run namespaceDupes but no effect (same error message after it when searching). The SQL shows something (!), how to fix the bug that I induced (as I yet described) by changing namespaces?

SELECT page_id, page_namespace, page_title FROM page WHERE page_id IN (130,16);
| page_id | page_namespace | page_title |
|      16 |              0 | DOC:R103   |
|     130 |           8030 | R103       |

The namespace 8030 is the correct and most recent for "DOC:".

php maintenance/namespaceDupes.php
id=17 ns=0 dbk=DOC:R *** dest title exists and --add-prefix not specified
id=14 ns=0 dbk=DOC:R101 *** dest title exists and --add-prefix not specified
id=15 ns=0 dbk=DOC:R102 *** dest title exists and --add-prefix not specified
id=16 ns=0 dbk=DOC:R103 *** dest title exists and --add-prefix not specified
id=125 ns=0 dbk=DOC:R105 *** dest title exists and --add-prefix not specified
5 pages to fix, 0 were resolvable.

0 links to fix, 0 were resolvable.

Oh noeees

You need to run the script with --add-prefix parameter to be able to fix the errors (as the output of the script suggests). See the help for this script or the manual page for more information.

Thanks @Ciencia_Al_Poder . I run but it say "DRY RUN ONLY"... and the Guide (Manual:NamespaceDupes.php) say nothing about "how to really run a bug fix"... I edited the Manual, now the example is with with two options, php namespaceDupes.php --add-prefix="checkMePlease-" --fix that was fine, fixed the bug.

PS: problem solved we can close (!).

NOTICE (and bug on interface-instructions and/or Manual)

Bad usage (but following instructions) with only one flag (the correct is two flags)...

The php maintenance/namespaceDupes.php --fix not fix, only say to use --add-prefix but if you follow the instruction the results is

php maintenance/namespaceDupes.php --add-prefix=lixo
id=17 ns=0 dbk=DOC:R -> DOC:LixoR (alternate) DRY RUN ONLY
id=14 ns=0 dbk=DOC:R101 -> DOC:LixoR101 (alternate) DRY RUN ONLY
id=15 ns=0 dbk=DOC:R102 -> DOC:LixoR102 (alternate) DRY RUN ONLY
id=16 ns=0 dbk=DOC:R103 -> DOC:LixoR103 (alternate) DRY RUN ONLY
id=125 ns=0 dbk=DOC:R105 -> DOC:LixoR105 (alternate) DRY RUN ONLY
5 pages to fix, 5 were resolvable.

There are no "DRY RUN" need only to add the second option, --fix.