-
Notifications
You must be signed in to change notification settings - Fork 635
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
[5.x]: Running craft gc/run wipes the usertable #14891
Comments
It’s expected that the
Just tested locally and both of those are working as expected (and nothing more, as far as users go). Can you elaborate on what you’re seeing? |
hey @brandonkelly so what i did is, add a homepage entry, add some matrix fields add those to the homepage entry. After playing around with the new amazing features, i changed some search indexes and used the cli command to resave all entries After this i wasn't able to log in anymore, so i checked the cli. No entries anymore. The entry for the homepage section was deleted. My Admin user was deleted, basically everything was deleted, that was ion any relation to the before mentioned invalied elements. |
Do you happen to have a database backup from before running |
Unfortunately not, as I only did a little testing I did not create a backup. i also tried to reproduce it somehow but i think it could occur if there are entries whose ownerid no longer exists |
@brandonkelly I have the same issue here, Let me know if you need further details |
Our live DB ended up without any users this morning so I investigated a little bit more. delete from "elements"
USING "elements" "el"
INNER JOIN "entries" "t" ON "t"."id" = "el"."id"
LEFT JOIN "elements_owners" "eo" ON "eo"."elementId" = "el"."id"
WHERE "t"."fieldId" IS NOT NULL AND "eo"."elementId" IS NULL in Lines 563 to 569 in 5f69bc4
When the function $this->deleteOrphanedNestedElements(Entry::class, Table::ENTRIES); is called here However when I try to select the elements that should be deleted with the following query select el.id, el.type from "elements" "el"
INNER JOIN "entries" "t" ON "t"."id" = "el"."id"
LEFT JOIN "elements_owners" "eo" ON "eo"."elementId" = "el"."id"
WHERE "t"."fieldId" IS NOT NULL AND "eo"."elementId" IS NULL it will only show 19 entries, so I have absolutely no idea why this query will delete all users Additional note: I have about 30k elements in my table but the delete statement takes about 5 minutes, while the select statement executes immediately explain analyze delete from "elements"
USING "elements" "el"
INNER JOIN "entries" "t" ON "t"."id" = "el"."id"
LEFT JOIN "elements_owners" "eo" ON "eo"."elementId" = "el"."id"
WHERE "t"."fieldId" IS NOT NULL AND "eo"."elementId" IS NULL will output the following data
|
Thanks @Anubarak! We managed to reproduce with your database, and just tagged Craft 4.12.3 and 5.4.4 with a fix. |
What happened?
Description
Topic
Steps to reproduce
Expected behavior
Clean trashed item
Actual behavior
Cleans all of the stuff
Craft CMS version
5.0.5
PHP version
8.2
Operating system and version
No response
Database type and version
pgsql
Image driver and version
No response
Installed plugins and versions
"craftcms/ckeditor": "4.0.4",
"craftcms/cms": "5.0.5",
"craftpulse/craft-colour-swatches": "5.0.0",
"nystudio107/craft-imageoptimize": "5.0.0",
"nystudio107/craft-seomatic": "5.0.2",
"nystudio107/craft-vite": "5.0.0",
"putyourlightson/craft-blitz": "5.1.4",
"vaersaagod/dospaces": "3.0.0-beta.1",
"vlucas/phpdotenv": "^5.4.0",
"yiisoft/yii2-redis": "~2.0.0"
The text was updated successfully, but these errors were encountered: