Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database error when saving page edits #51

Open
The-Foilist opened this issue Dec 27, 2021 · 5 comments · May be fixed by #52
Open

Database error when saving page edits #51

The-Foilist opened this issue Dec 27, 2021 · 5 comments · May be fixed by #52

Comments

@The-Foilist
Copy link

This error arose after upgrading from MediaWiki version 1.36 to version 1.37.1. It occurs whenever I try to save an edit to any page on the wiki when PortableInfobox is installed. Here's the trace:

[34f4255574036baeaae5c094] /w/index.php?title=Main_Page&action=submit Wikimedia\Rdbms\DBUnexpectedError: The unique key array should contain a single unique index

Backtrace:

from /var/www/w/includes/libs/rdbms/database/Database.php(2315)
#0 /var/www/w/includes/libs/rdbms/database/Database.php(2286): Wikimedia\Rdbms\Database->normalizeUpsertKeys()
#1 /var/www/w/includes/libs/rdbms/database/Database.php(3454): Wikimedia\Rdbms\Database->normalizeUpsertParams()
#2 /var/www/w/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->replace()
#3 /var/www/w/includes/libs/rdbms/database/DBConnRef.php(513): Wikimedia\Rdbms\DBConnRef->__call()
#4 /var/www/w/extensions/PortableInfobox/includes/services/Helpers/PagePropsProxy.php(48): Wikimedia\Rdbms\DBConnRef->replace()
#5 /var/www/w/extensions/PortableInfobox/includes/services/PortableInfoboxDataService.php(250): PortableInfobox\Helpers\PagePropsProxy->set()
#6 /var/www/w/extensions/PortableInfobox/includes/services/PortableInfoboxDataService.php(149): PortableInfoboxDataService->clear()
#7 /var/www/w/extensions/PortableInfobox/includes/PortableInfobox.hooks.php(42): PortableInfoboxDataService->delete()
#8 /var/www/w/includes/HookContainer/HookContainer.php(338): PortableInfoboxHooks::onPageContentSave()
#9 /var/www/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#10 /var/www/w/includes/HookContainer/HookRunner.php(2714): MediaWiki\HookContainer\HookContainer->run()
#11 /var/www/w/includes/Storage/PageUpdater.php(807): MediaWiki\HookContainer\HookRunner->onPageContentSave()
#12 /var/www/w/includes/page/WikiPage.php(1994): MediaWiki\Storage\PageUpdater->saveRevision()
#13 /var/www/w/includes/EditPage.php(2351): WikiPage->doUserEditContent()
#14 /var/www/w/includes/EditPage.php(1687): EditPage->internalAttemptSave()
#15 /var/www/w/includes/EditPage.php(665): EditPage->attemptSave()
#16 /var/www/w/includes/actions/EditAction.php(71): EditPage->edit()
#17 /var/www/w/includes/actions/SubmitAction.php(38): EditAction->show()
#18 /var/www/w/includes/MediaWiki.php(543): SubmitAction->show()
#19 /var/www/w/includes/MediaWiki.php(320): MediaWiki->performAction()
#20 /var/www/w/includes/MediaWiki.php(930): MediaWiki->performRequest()
#21 /var/www/w/includes/MediaWiki.php(564): MediaWiki->main()
#22 /var/www/w/index.php(53): MediaWiki->run()
#23 /var/www/w/index.php(46): wfIndexMain()
#24 {main}

@The-Foilist
Copy link
Author

The-Foilist commented Dec 29, 2021

Looks like the MediaWiki 1.37 release notes include the following:

  • Database::upsert() and IDatabase::replace() now only accept a single unique key. Previously, a warning was issued if there were multiple unique keys provided.

So I think the code in lines 37-49 of PagePropsProxy.php needs to be changed to only supply a single unique key.

@adgellida
Copy link

Hello, I'm very interested on this, I was investigating and trying to solve this, but I can't.
Anyone can do a PR to test it on my server please? If you need a tester I'm volunteer.

@The-Foilist The-Foilist linked a pull request Dec 30, 2021 that will close this issue
@The-Foilist
Copy link
Author

Hello, I'm very interested on this, I was investigating and trying to solve this, but I can't. Anyone can do a PR to test it on my server please? If you need a tester I'm volunteer.

The PR I made should fix it. I tested it on a wiki of mine and it seems to work fine. Feel free to test it yourself!

@adgellida
Copy link

Perfect, you're a pseudo-god!!! ASAP I'll test it.

@adgellida
Copy link

It works!!! @The-Foilist. Thanks. Can anyone merge this please? No error when saving a page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants