verbb / super-table

Super-charge your Craft workflow using Super Table.
MIT License
317 stars 47 forks source link

SuperTable -> Assets field project config issue #336

Closed proimage closed 4 months ago

proimage commented 4 years ago

Continued from the issue on Craft's repo here: https://github.com/craftcms/cms/issues/5660

I've now run the Check Content Tables tool (didn't know about it before, cool!). Here's what it says:

First page is the check:

> ERROR: Blocktype field #639 is not a Super Table field ...
> ERROR: Blocktype field #649 is not a Super Table field ...
> ERROR: Blocktype field #653 is not a Super Table field ...
> ERROR: Blocktype field #654 is not a Super Table field ...
> ERROR: Blocktype field #683 is not a Super Table field ...

Then after clicking on "Fix Content Tables":

> Super Table field #409 has content table {{%stc_customdonationlevels}} ...
> Super Table field #467 has content table {{%stc_globaldonationlevels}} ...
> Super Table field #594 has content table {{%stc_popupheader}} ...
> Super Table field #603 has content table {{%stc_popupfooter}} ...
> Super Table field #637 has content table {{%stc_popupsizing}} ...
> Super Table field #647 has content table {{%stc_maximumwidth}} ...
> Super Table field #648 has content table {{%stc_textsize}} ...
> Super Table field #650 has content table {{%stc_verticalpadding}} ...
> Super Table field #664 has content table {{%stc_herobackgroundimages}} ...
> Super Table field #669 has content table {{%stc_buttonproperties}} ...
> Super Table field #688 has content table {{%stc_verticaloffset}} ...
> Super Table field #691 has content table {{%stc_height}} ...
> Super Table field #698 has content table {{%stc_backgroundratio}} ...
> Super Table field #440 has content table {{%stc_58_blocksettings}} ...
> Super Table field #445 has content table {{%stc_59_blocksettings}} ...
> Super Table field #455 has content table {{%stc_60_blocksettings}} ...
> Super Table field #458 has content table {{%stc_61_blocksettings}} ...
> Super Table field #463 has content table {{%stc_62_blocksettings}} ...
> Super Table field #517 has content table {{%stc_17_card1buttons}} ...
> Super Table field #520 has content table {{%stc_17_card2buttons}} ...
> Super Table field #523 has content table {{%stc_17_card3buttons}} ...
> Super Table field #528 has content table {{%stc_21_buttons}} ...
> Super Table field #530 has content table {{%stc_21_options}} ...
> Super Table field #543 has content table {{%stc_67_ctaslides}} ...
> Super Table field #568 has content table {{%stc_69_buttons}} ...
> Super Table field #621 has content table {{%stc_84_position}} ...
> Super Table field #628 has content table {{%stc_85_distancefromedge}} ...
> ERROR: Blocktype field #639 is not a Super Table field ...
> ERROR: Blocktype field #649 is not a Super Table field ...
> ERROR: Blocktype field #653 is not a Super Table field ...
> ERROR: Blocktype field #654 is not a Super Table field ...
> ERROR: Blocktype field #683 is not a Super Table field ...

Fixes complete.

But then re-running the check & fix gives the same exact results, so I don't think it actually fixed anything. :-/

proimage commented 4 years ago

And if I run the "Re-save Fields" tool, it spits this out:

> Super Table field #409 re-saved ...
> Super Table field #440 re-saved ...
> Super Table field #445 re-saved ...
> Super Table field #455 re-saved ...
> Super Table field #458 re-saved ...
> Super Table field #463 re-saved ...
> Super Table field #467 re-saved ...
> Super Table field #517 re-saved ...
> Super Table field #520 re-saved ...
> Super Table field #523 re-saved ...
> Super Table field #528 re-saved ...
> Super Table field #530 re-saved ...
> Super Table field #543 re-saved ...
> Super Table field #568 re-saved ...
> Super Table field #594 re-saved ...
> Super Table field #603 re-saved ...
> Super Table field #621 re-saved ...
> Super Table field #628 re-saved ...
> Super Table field #637 re-saved ...
> Super Table field #639 skipped as it isn't a Super Table field ...
> Super Table field #649 skipped as it isn't a Super Table field ...
> Super Table field #653 skipped as it isn't a Super Table field ...
> Super Table field #654 skipped as it isn't a Super Table field ...
> Super Table field #650 re-saved ...
> Super Table field #664 re-saved ...
> Super Table field #669 re-saved ...
> Super Table field #647 re-saved ...
> Super Table field #648 re-saved ...
> Super Table field #683 skipped as it isn't a Super Table field ...
> Super Table field #688 re-saved ...
> Super Table field #691 re-saved ...
> Super Table field #698 re-saved ...

Field re-saving complete.
engram-design commented 4 years ago

So some of that output is informational, that's fine. For the:

> ERROR: Blocktype field #639 is not a Super Table field ...
> ERROR: Blocktype field #649 is not a Super Table field ...
> ERROR: Blocktype field #653 is not a Super Table field ...
> ERROR: Blocktype field #654 is not a Super Table field ...
> ERROR: Blocktype field #683 is not a Super Table field ...

You'll need to manually fix these fields - you can head to /admin/settings/fields/edit/639 and check what fields these are?

It sounds like something has fixed up your field types.

proimage commented 4 years ago

639 is a Neo field. 649: Color Swatches 653: Redactor 654: Plain Text 683: Assets

How would I go about repairing those fields manually?

engram-design commented 4 years ago

So that error usually means that at one point, these fields were Super Table fields, but were changed. Its not a massive issue, it just means there are some rows in your supertableblocktypes table that are orphaned. You can delete any that match the field IDs above.

What was the original issue though? Are you still getting a error: Getting unknown property: craft\fields\Assets::contentTable error? If so, can you provide the full stack trace of the error?

proimage commented 4 years ago

I've deleted those orphan lines and am still getting the error:

master@_____:/var/www/_______/htdocs$ ./craft project-config/sync --force=1
Applying changes from project.yaml ... error: Getting unknown property: craft\redactor\Field::contentTable

Trying to get the full stack trace now; do the ones from the original thread linked to in the first post here not suffice?

proimage commented 4 years ago

Found it:

2020-02-28 07:58:04 [-][-][-][trace][yii\db\Transaction::rollBack] Roll back transaction
2020-02-28 07:58:04 [-][-][-][error][yii\base\UnknownPropertyException] yii\base\UnknownPropertyException: Getting unknown property: craft\redactor\Field::contentTable in /var/www/__________/htdocs/vendor/yiisoft/yii2/base/Component.php:154
Stack trace:
#0 /var/www/__________/htdocs/vendor/verbb/super-table/src/services/SuperTableService.php(370): yii\base\Component->__get('contentTable')
#1 /var/www/__________/htdocs/vendor/craftcms/cms/src/services/ProjectConfig.php(872): verbb\supertable\services\SuperTableService->handleChangedBlockType(Object(craft\events\ConfigEvent))
#2 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#3 /var/www/__________/htdocs/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#4 /var/www/__________/htdocs/vendor/craftcms/cms/src/services/ProjectConfig.php(559): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#5 /var/www/__________/htdocs/vendor/craftcms/cms/src/services/ProjectConfig.php(866): craft\services\ProjectConfig->processConfigChanges('superTableBlock...')
#6 [internal function]: craft\services\ProjectConfig->craft\services\{closure}(Object(craft\events\ConfigEvent))
#7 /var/www/__________/htdocs/vendor/yiisoft/yii2/base/Component.php(627): call_user_func(Object(Closure), Object(craft\events\ConfigEvent))
#8 /var/www/__________/htdocs/vendor/craftcms/cms/src/services/ProjectConfig.php(559): yii\base\Component->trigger('updateItem', Object(craft\events\ConfigEvent))
#9 /var/www/__________/htdocs/vendor/craftcms/cms/src/services/ProjectConfig.php(950): craft\services\ProjectConfig->processConfigChanges('superTableBlock...')
#10 /var/www/__________/htdocs/vendor/craftcms/cms/src/services/ProjectConfig.php(441): craft\services\ProjectConfig->_applyChanges(Array)
#11 /var/www/__________/htdocs/vendor/craftcms/cms/src/console/controllers/ProjectConfigController.php(87): craft\services\ProjectConfig->applyYamlChanges()
#12 [internal function]: craft\console\controllers\ProjectConfigController->actionSync()
#13 /var/www/__________/htdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#14 /var/www/__________/htdocs/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#15 /var/www/__________/htdocs/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('sync', Array)
#16 /var/www/__________/htdocs/vendor/craftcms/cms/src/console/Controller.php(199): yii\console\Controller->runAction('sync', Array)
#17 /var/www/__________/htdocs/vendor/yiisoft/yii2/base/Module.php(528): craft\console\Controller->runAction('sync', Array)
#18 /var/www/__________/htdocs/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('project-config/...', Array)
#19 /var/www/__________/htdocs/vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('project-config/...', Array)
#20 /var/www/__________/htdocs/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('project-config/...', Array)
#21 /var/www/__________/htdocs/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#22 /var/www/__________/htdocs/craft(22): yii\base\Application->run()
#23 {main}
proimage commented 4 years ago

@engram-design ^^^ :)

engram-design commented 4 years ago

Sorry for the delay. So it still thinks this field is a Redactor field, and its trying to set stuff, where its assuming it'd be a Super Table field...

Something has clearly been borked with this one. Happy to pair program to sort this out for you, or at least get a bit more insight into what exactly is going on. Feel free to hit me up on the Craft Discord (handle crawf)

jbogendoerfer commented 4 years ago

Hello, I have a issue that is possibly connected to this one.

When I click "Check Content Table" I get this:

ERROR: #20 has inconsistent field settings in its project config ... ERROR: #37 has inconsistent field settings in its project config ...

both fields are the supertable-fieds, one consists of Redactor/Dropdown/Dropdown, the other is Asset/Asset/Plaintext.

After fix:

Super Table field #20 has content table {{%stc_headline}} ... Super Table field #37 has content table {{%stc_media}} ...

Fixes complete.

Pressing "Check" again it says everything is fine, No errors found.

When I then click "Re-save" it says:

Super Table field #37 re-saved ... Super Table field #20 re-saved ...

Field re-saving complete.

When I now click on "Check" again, the errors are back again..... :-(

Any suggestions what could be done to fix this?

engram-design commented 4 years ago

@jbogendoerfer Interesting. These are just solo Super Table field, and not in or contain Matrix fields?

I would also throw a ./craft project-config/rebuild in there before or after you do the content table checker. Basically that error just means that the database field settings don't quite match up with project config's values. It might be a false-positive so I'll try and replicate...

jbogendoerfer commented 4 years ago

Hi,

the fields are inside a NEO-Field

running the command ./craft project-config/rebuild creates the errors again, when I check after the command the errors are here again.

I made a database backup before and after and compared the files, I think it has to do something with the insert into projectconfig.

To have a better view I just replaced ")" with newline, so you must imagine a closing ) at the end of each line. The right version is the version with the errors.

image

engram-design commented 4 years ago

Let me test this with Neo's involvement, I haven't tested that out yet.