shopware / production

Shopware 6 production template
https://shopware.com
177 stars 151 forks source link

Update 6.4.5.1 => 6.4.7.0 fails, src/Command files missing #127

Closed devnullroot closed 2 years ago

devnullroot commented 2 years ago

PHP Version

7.4.25

Shopware Version

6.4.5.1

Expected behaviour

Updating the production template from 6.4.5.1 => 6.4.7.0 should work

Actual behaviour

Running:

git pull origin
composer install

results in missing files in src/Command:

PHP Warning:  include_once([...]/shopware/src/Command/SystemUpdatePrepareCommand.php): Failed to open stream: No such file or directory in [...]/shopware/var/cache/prod_h792db9212e817af79ff5b9b6ef4ab9ef/ContainerIDBFvLX/Shopware_Production_KernelProdContainer.php on line 23298

Attempted to load class "SystemUpdatePrepareCommand" from namespace "Shopware\Production\Command".
Did you forget a "use" statement for "Shopware\Core\DevOps\System\Command\SystemUpdatePrepareCommand"?

Clearing the cache before "composer update" results in:

There are no commands defined in the "system:update" namespace.

  Did you mean one of these?
      system
      system:config

How to reproduce

see above

marconett commented 2 years ago

Same here.

Sadly it seems like you always have to go digging through code and changelogs when installing a "non-breaking" minor upgrade through this template.

In 6.4.6.0, they moved the System scripts out of this production template repo into the core repo. If we git pull the newest production repo and then composer install, composer can't find system:update:prepare which it's supposed to execute as a pre-install-cmd and errors out.

To work around this, we need to restore this single command to it's original position. To do this, create the folder src/Command/ and download the latest SystemUpdatePrepareCommand.php prior to the move into it.

Then, add the following to config/services/defaults.xml.

     <services>
+        <service id="Shopware\Production\Command\SystemUpdatePrepareCommand">
+            <argument type="string">%kernel.shopware_version%</argument>
+            <argument type="service" id="event_dispatcher"/>
+            <argument type="service" id="service_container"/>
+            <tag name="console.command"/>
+        </service>
         <service class="League\OAuth2\Server\CryptKey" id="shopware.private_key">

composer install should now execute properly. Make sure to remove the folder and file src/Command/ again and revert the changes to config/services/defaults.xml afterwards.

References:

shyim commented 2 years ago

See answer of marconett