presseddigital / colorit

A slick color picker fieldtype plugin for the Craft CMS control panel
Other
21 stars 8 forks source link

How to migrate from fruitstudio? #21

Closed sunscreem closed 4 years ago

sunscreem commented 4 years ago

Would some kind person explain the correct procedure to "move" to presseddigtal's version of the plugin please? I can see another issue where it seems to have broken things.

samhibberd commented 4 years ago

Hi @sunscreem, apologies if you are running into issues, it should just be a case of updating the plugin as with any Craft plugin.

You may have run into a new issue, can you provide a bit more detail on the specific error you are running into and steps to create.

sunscreem commented 4 years ago

Hey @samhibberd:

Here's my outdated dependencies and the abandoned warning:

$ composer outdated --direct
fruitstudios/colorit 1.0.8  1.0.8  A slick color picker fieldtype plugin for the Craft CMS 3 control panel.
Package fruitstudios/colorit is abandoned, you should avoid using it. Use presseddigital/colorit instead.
vlucas/phpdotenv     v2.6.3 v4.1.4 Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagi.

Here's my composer update:

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package fruitstudios/colorit is abandoned, you should avoid using it. Use presseddigital/colorit instead.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Generating optimized autoload files
24 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

And finally here's my composer.json:

{
  "require": {
    "craftcms/aws-s3": "^1.0",
    "craftcms/cms": "^3.2",
    "craftcms/contact-form": "^2.2",
    "craftcms/redactor": "^2.1",
    "fruitstudios/colorit": "^1.0",
    "misterbk/mix": "^1.5",
    "nystudio107/craft-minify": "^1.2",
    "nystudio107/craft-seomatic": "^3.2",
    "spicyweb/craft-embedded-assets": "^2.1",
    "studioespresso/craft-dumper": "^2.0",
    "superbig/craft3-bugsnag": "^2.0",
    "verbb/super-table": "^2.3",
    "vlucas/phpdotenv": "^2.4.0",
    "wildbit/craft3-donottrack": "^1.0"
  },
  "autoload": {
    "psr-4": {
      "modules\\": "modules/"
    }
  },
  "config": {
    "sort-packages": true,
    "optimize-autoloader": true
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ]
  }
}

Any help appreciated :)

samhibberd commented 4 years ago

@brandonkelly may well correct me but I don't believe the Craft plugin store relies on Packagist under the hood to handle packages, if you are not updating via the Craft CP (which most likely handles the name changes), you may need to manually update your composer.json with the new package requirements, either by:

# replacing
"fruitstudios/colorit": "^1.0",
# with
"presseddigital/colorit": "^1.0",
# and running
composer update

or

composer remove fruitstudios/colorit
composer require presseddigital/colorit
sunscreem commented 4 years ago

Thank Sam - I tried that.

The site then throws up errors that its looking for fruitstudios version :(

I'll try using the craft updater.

sunscreem commented 4 years ago

Just the same I'm afraid Sam.

It swaps the package out but then this in the control panel:

image

samhibberd commented 4 years ago

Thanks for the update, that's a bug, will get it fixed asap.

michtio commented 4 years ago

@samhibberd can confirm I'm currently running into the exact same bug.

samhibberd commented 4 years ago

@sunscreem @michtio be great if one of you could send over the full stack trace, just so i can double check my fix?

sunscreem commented 4 years ago
2020-04-27 15:47:14 [-][5][9kgalacbavuc1h21ssf3m2tevo][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined index: fruitstudios\colorit\fields\ColoritField in /home/forge/mg.sunscreem.xyz/vendor/presseddigital/colorit/src/services/Fields.php:69
Stack trace:
#0 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/ErrorHandler.php(74): yii\base\ErrorHandler->handleError()
#1 /home/forge/mg.sunscreem.xyz/vendor/presseddigital/colorit/src/services/Fields.php(69): craft\web\ErrorHandler->handleError()
#2 /home/forge/mg.sunscreem.xyz/vendor/presseddigital/colorit/src/models/Preset.php(102): presseddigital\colorit\services\Fields->getFieldsByType()
#3 /home/forge/mg.sunscreem.xyz/vendor/presseddigital/colorit/src/models/Preset.php(119): presseddigital\colorit\models\Preset->getFieldsUsing()
#4 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Extension/CoreExtension.php(1499): presseddigital\colorit\models\Preset->getFieldsUsingHtml()
#5 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/helpers/Template.php(96): twig_get_attribute()
#6 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/e8/e8b7a8ca00f31560d0b0729c2cea37f19e1ff9e0a97e771bff7f44b80f60e790.php(149): craft\helpers\Template::attribute()
#7 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(184): __TwigTemplate_c2d9e13e0853d7c574c2ec89aa7390945be4385104824efa33cfca022be4c247->block_content()
#8 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/43/43930bd3e249c3479202b3818a64594407a8af330df985630bd369ede1d1252d.php(411): Twig\Template->displayBlock()
#9 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(184): __TwigTemplate_fb9f6bd0713dbeb3faffd0307aa0e1bf3ca7b47f7f6bca4a4841bd1f77ae5f24->block_main()
#10 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/43/43930bd3e249c3479202b3818a64594407a8af330df985630bd369ede1d1252d.php(266): Twig\Template->displayBlock()
#11 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(184): __TwigTemplate_fb9f6bd0713dbeb3faffd0307aa0e1bf3ca7b47f7f6bca4a4841bd1f77ae5f24->block_body()
#12 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/2d/2dc593736ac2bd26407803fbf59f4f9a8cff8cc9b0d11b0d0ad4c996281fb2bf.php(75): Twig\Template->displayBlock()
#13 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(407): __TwigTemplate_f6ab10c9bf217e161a63ed1aa6afc5c403b473dbefbfba61ffc8e4395ca7b8ac->doDisplay()
#14 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling()
#15 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/ff/ffb42f264a99456e8c6b2ca9a1e2d581ba7aab7fccbc660d1e9a82cb87fc6b99.php(56): Twig\Template->display()
#16 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(407): __TwigTemplate_937820431588742948f33e987d5fca6203aaf932d1c66d908113852db273c54b->doDisplay()
#17 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling()
#18 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/43/43930bd3e249c3479202b3818a64594407a8af330df985630bd369ede1d1252d.php(138): Twig\Template->display()
#19 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(407): __TwigTemplate_fb9f6bd0713dbeb3faffd0307aa0e1bf3ca7b47f7f6bca4a4841bd1f77ae5f24->doDisplay()
#20 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling()
#21 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/5e/5ec4751db92c300282a825cd390040a02c484246cc2d8d80b45f3b6dab9a22b4.php(48): Twig\Template->display()
#22 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(407): __TwigTemplate_6de2da53f072e66ff5499833b7e0089fcb1af31c2ade1cb522e7997064250562->doDisplay()
#23 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling()
#24 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/bb/bb2e69176ff82a6afdb83027e2482463769dd969cc683958e99a574778df56d5.php(53): Twig\Template->display()
#25 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(407): __TwigTemplate_afc5725001e23b4530dee81169b3b4d70c64d5a508c4e00a02243d08f88fa9d1->doDisplay()
#26 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling()
#27 /home/forge/mg.sunscreem.xyz/storage/runtime/compiled_templates/e8/e8b7a8ca00f31560d0b0729c2cea37f19e1ff9e0a97e771bff7f44b80f60e790.php(62): Twig\Template->display()
#28 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(407): __TwigTemplate_c2d9e13e0853d7c574c2ec89aa7390945be4385104824efa33cfca022be4c247->doDisplay()
#29 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling()
#30 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Template.php(392): Twig\Template->display()
#31 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render()
#32 /home/forge/mg.sunscreem.xyz/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render()
#33 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/View.php(397): Twig\Environment->render()
#34 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/View.php(458): craft\web\View->renderTemplate()
#35 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/Controller.php(235): craft\web\View->renderPageTemplate()
#36 /home/forge/mg.sunscreem.xyz/vendor/presseddigital/colorit/src/controllers/PresetsController.php(22): craft\web\Controller->renderTemplate()
#37 [internal function]: presseddigital\colorit\controllers\PresetsController->actionIndex()
#38 /home/forge/mg.sunscreem.xyz/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#39 /home/forge/mg.sunscreem.xyz/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#40 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction()
#41 /home/forge/mg.sunscreem.xyz/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction()
#42 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction()
#43 /home/forge/mg.sunscreem.xyz/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction()
#44 /home/forge/mg.sunscreem.xyz/vendor/craftcms/cms/src/web/Application.php(276): yii\web\Application->handleRequest()
#45 /home/forge/mg.sunscreem.xyz/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#46 /home/forge/mg.sunscreem.xyz/web/index.php(25): yii\base\Application->run()
#47 {main}

Is that what you need @samhibberd ?

samhibberd commented 4 years ago

That's great thanks, should be fixed in 1.0.9.2, just releasing now.

samhibberd commented 4 years ago

Do let me know if you run into any further issues, renaming the namespace has caused a bit of trouble. 🤦‍♂️

sunscreem commented 4 years ago

Sorry Sam - just went to 1.0.9.2 and still getting the exact same issue.

sunscreem commented 4 years ago

@samhibberd let me know what you need from me to help you fix this

samhibberd commented 4 years ago

Initially, can you confirm that you are trying to view the colorit presets page in the cp? And if you are able to access any other pages? What happens if / can you are view the field editing page for a colorit field?

michtio commented 4 years ago

@samhibberd I just updated, and still can confirm this is happening for me too, I can access all pages. Only happens when you go to plugin settings and try to view the presets.

In the field editing page, you can't select presets, since it says there are none.

Full Stacktrace:

yii\base\ErrorException: Undefined index: fruitstudios\colorit\fields\ColoritField in /Users/michtio/dev/hdac/vendor/presseddigital/colorit/src/services/Fields.php:77
Stack trace:
#0 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/ErrorHandler.php(75): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/Users/michtio/...', 77)
#1 /Users/michtio/dev/hdac/vendor/presseddigital/colorit/src/services/Fields.php(77): craft\web\ErrorHandler->handleError(8, 'Undefined index...', '/Users/michtio/...', 77, Array)
#2 /Users/michtio/dev/hdac/vendor/presseddigital/colorit/src/models/Preset.php(102): presseddigital\colorit\services\Fields->getFieldsByType('fruitstudios\\co...')
#3 /Users/michtio/dev/hdac/vendor/presseddigital/colorit/src/models/Preset.php(119): presseddigital\colorit\models\Preset->getFieldsUsing()
#4 /Users/michtio/dev/hdac/vendor/twig/twig/src/Extension/CoreExtension.php(1499): presseddigital\colorit\models\Preset->getFieldsUsingHtml()
#5 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/helpers/Template.php(95): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(presseddigital\colorit\models\Preset), 'getFieldsUsingH...', Array, 'method', false, false)
#6 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/18/18546ee5ed45840539c4d94ab6c32cd7407c159fe4643ae93ceff09cc580394b.php(149): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(presseddigital\colorit\models\Preset), 'getFieldsUsingH...', Array, 'method')
#7 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(184): __TwigTemplate_4781a4425496a66d0d42b580509f6af8908fce4f1edc3af874f61a192b06f651->block_content(Array, Array)
#8 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/51/51d2a4820657e0ff8c4896eaa47762e929b29519e96092178ee3645c1d0ff929.php(411): Twig\Template->displayBlock('content', Array, Array)
#9 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(184): __TwigTemplate_a3b195ee65a21a2f033bf5f77b647b06e6ef55f0277816961ed54214eb4affc7->block_main(Array, Array)
#10 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/51/51d2a4820657e0ff8c4896eaa47762e929b29519e96092178ee3645c1d0ff929.php(266): Twig\Template->displayBlock('main', Array, Array)
#11 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(184): __TwigTemplate_a3b195ee65a21a2f033bf5f77b647b06e6ef55f0277816961ed54214eb4affc7->block_body(Array, Array)
#12 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/f5/f5178af2e13f25380d818c94f0cf1e85201ca88e1d2c9e81092484566971144f.php(79): Twig\Template->displayBlock('body', Array, Array)
#13 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(407): __TwigTemplate_777066472b8e928e7e61c013b0cf55f8fc4ff5742a1127d3271578f7a515bc88->doDisplay(Array, Array)
#14 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#15 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/50/50bdd03fbe3da8620f0043f9d8e3c3ed9b86ad2d1ac6d147c6ef0eebe737f587.php(56): Twig\Template->display(Array, Array)
#16 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(407): __TwigTemplate_a6cd2d1a4f0dedc119715c679c722947d9ae5cb000d7e468d076e64856c8e3d0->doDisplay(Array, Array)
#17 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#18 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/51/51d2a4820657e0ff8c4896eaa47762e929b29519e96092178ee3645c1d0ff929.php(138): Twig\Template->display(Array, Array)
#19 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(407): __TwigTemplate_a3b195ee65a21a2f033bf5f77b647b06e6ef55f0277816961ed54214eb4affc7->doDisplay(Array, Array)
#20 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#21 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/41/41e8f74c8c4d9d44b047a69b57aff27a5d7e276a6b4a2023f82a042441a1e21c.php(48): Twig\Template->display(Array, Array)
#22 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(407): __TwigTemplate_76514c2fec1eb1345385434988d7cc5701c446d8e1835eb9f61ee5771f68ed66->doDisplay(Array, Array)
#23 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#24 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/5e/5e1bda4046dd3b99c309774657de4149d35b10aa6101cdbed97c0c5ccb468706.php(53): Twig\Template->display(Array, Array)
#25 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(407): __TwigTemplate_2d661562a4825547d5f157541631f1b6f122c64df662a273acd1b7d292946ff7->doDisplay(Array, Array)
#26 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#27 /Users/michtio/dev/hdac/storage/runtime/compiled_templates/18/18546ee5ed45840539c4d94ab6c32cd7407c159fe4643ae93ceff09cc580394b.php(62): Twig\Template->display(Array, Array)
#28 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(407): __TwigTemplate_4781a4425496a66d0d42b580509f6af8908fce4f1edc3af874f61a192b06f651->doDisplay(Array, Array)
#29 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(380): Twig\Template->displayWithErrorHandling(Array, Array)
#30 /Users/michtio/dev/hdac/vendor/twig/twig/src/Template.php(392): Twig\Template->display(Array)
#31 /Users/michtio/dev/hdac/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
#32 /Users/michtio/dev/hdac/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render(Array)
#33 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/View.php(400): Twig\Environment->render('colorit/presets...', Array)
#34 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/View.php(461): craft\web\View->renderTemplate('colorit/presets...', Array)
#35 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/Controller.php(235): craft\web\View->renderPageTemplate('colorit/presets...', Array, 'cp')
#36 /Users/michtio/dev/hdac/vendor/presseddigital/colorit/src/controllers/PresetsController.php(22): craft\web\Controller->renderTemplate('colorit/presets...', Array)
#37 [internal function]: presseddigital\colorit\controllers\PresetsController->actionIndex()
#38 /Users/michtio/dev/hdac/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#39 /Users/michtio/dev/hdac/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#40 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('index', Array)
#41 /Users/michtio/dev/hdac/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('index', Array)
#42 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/Application.php(289): yii\base\Module->runAction('colorit/presets...', Array)
#43 /Users/michtio/dev/hdac/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('colorit/presets...', Array)
#44 /Users/michtio/dev/hdac/vendor/craftcms/cms/src/web/Application.php(274): yii\web\Application->handleRequest(Object(craft\web\Request))
#45 /Users/michtio/dev/hdac/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#46 /Users/michtio/dev/hdac/web/index.php(21): yii\base\Application->run()
#47 /Users/michtio/.composer/vendor/laravel/valet/server.php(158): require('/Users/michtio/...')
#48 {main}
samhibberd commented 4 years ago

Fixed another bug, should be all good in https://github.com/presseddigital/colorit/releases/tag/1.0.9.3

michtio commented 4 years ago

@samhibberd this issue is still not fully resolved,

Now you can go to the presets page, and create / save presets, yet when adding the colorit field, the dropdown says there are no presents.

Screenshot 2020-04-28 at 14 14 58 Screenshot 2020-04-28 at 14 14 38
andersaloof commented 4 years ago

I'm also having this issue also, on 1.0.9.3.

https://github.com/presseddigital/colorit/blob/master/src/fields/ColoritField.php#L223 returns an empty list of presents, even though I have presets defined and can view them on the settings page.

I think the issue might be that self:class returns "presseddigital\colorit\fields\ColoritField" but my defined presets lists their type as fruitstudios\colorit\fields\ColoritField in the database.

Maybe there should be a migration to update the type of presets defined before the namespace change?

andersaloof commented 4 years ago

I can confirm that updating the string representing the type in the colorit_presets fixed this problem for me.

michtio commented 3 years ago

@samhibberd this should be reopened.

mrnebbi commented 3 years ago

Can anyone confirm if this is now resolved and what the process of migrating should be? (currently using 1.0.4)

@sunscreem any advice? ...also hey 👋

sunscreem commented 3 years ago

Hey @mrnebbi .

I honestly wish I could remember! damn,