SilverStripe version update from 3.6.1 to 4.3.3

silverstripe-3
silverstripe-4
Tags: #<Tag:0x00007f10c6030100> #<Tag:0x00007f10c6037f18>

#1

3.6.1

How to recover from command line error while upgrading silverstripe version 3.6.1 to 4.3.3

I have a website that uses SilverStripe version 3.6.1. I have set it up in localhost, PHP version 5.6 to upgrade its version from 3.6.1 to 4.3.3.
I am using Windows 10 system.

I am following SilverStripe Auckland Meetup - Maxime on upgrading to SS4 and https://docs.silverstripe.org/en/4/upgrading/upgrading_project/

I am using command prompt of Windows.

I could run following command successfully.
composer global require silverstripe/upgrader

But when I am trying to run following command, I get error - Command “all” is not defined.
upgrade-code all --recipe-core-constraint=4.3.3 --namespace=“App\Web” --psr4

If I run upgrade-code recompose --recipe-core-constraint=4.1 --write command, I see Command “recompose” is not defined. error.

Same errors I get if I run above commands in Windows PowerShell.

Can you please suggest how to run above command without error?

// Include any relevant code. If you have a lot of code, link to a gist instead.

#3

If I run upgrade-code -v, I see following.

SilverStripe Upgrader 1.0.0

Usage:
command [options] [arguments]

Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
–ansi Force ANSI output
–no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
add-namespace Add a namespace to a file
doctor Run all cleanup tasks configured for this project
help Displays help for a command
inspect Inspect unfixable code and provide useful warnings. Run after “upgrade” command.
list Lists commands
upgrade Upgrade a set of code files to work with a newer version of a library

I think, I should update silverstripe upgrader itself. If yes, can you please suggest how to update?


#4

Definitely. The current version is 1.4.1 I think, and should have the missing commands. On that second link, there are some notes about upgrading the upgrader which might help.


#2

If you run

upgrade-code -v

what version number does it show?
It may be something as simple as having an old version


#5

I think, here the second link is asking to run self-update command.
Should I run upgrade-code self-update command?

I am at root directory of my website in command prompt. If I run above command, it does not work. It displays Command "self-update" is not defined.

Can you please suggest?


#7

I am now following in unix bash interface:

  1. Download the upgrader as a PHAR executable or wget https://silverstripe.github.io/silverstripe-upgrader/upgrade-code.phar
  2. Make the file executable chmod +x upgrade-code.phar
  3. Move the file to a folder in your path, for example sudo mv upgrade-code.phar /usr/local/bin/upgrade-code
    as per https://docs.silverstripe.org/en/4/upgrading/upgrading_project/

But when I run sudo upgrade-code -v command, i get following error.
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in phar:///usr/local/bin/upgrade-code/src/Util/UpdateChecker.php on line 30

Is there any help on it? Thank you.


#6

The self-update function was only added in the later versions. If you installed it with composer, you’ll need to update it with composer (or remove it an re-install). If you are using the .phar file, then you just need to get the latest version of that and replace the old one on your system


#9

If I run php -v in the command line, I get following:

PHP 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

#8

I’m guessing that’s related to the PHP version you’re running in the command line, it looks like that kind of error. If you run php -v in the command line, what do you get?


#10

Thank you. I could run upgrade-code with PHP 7.1. But when I run upgrade-code recompose --write command, I see following:

Upgrading PHP constraint
========================

 Done.

Rebuilding dependencies
=======================

 ! [NOTE] Trying to re-require all packages

 * Requiring php:">=5.6" .......................... ✔
 * Requiring silverstripe/recipe-core:"4.3.3" ............................................................................................................................................. ✔
 * Requiring silverstripe/recipe-cms:"*" .......................................................................................................................................................................................................................... ✔
 * Requiring silverstripe/reports:"*" .................................................................................................................................................................................................................................................... ✔
 * Requiring silverstripe/siteconfig:"*" ............................................................................................................................................................................................................................ ✔
 * Requiring silverstripe-themes/simple:"*" .................................................................................................................................................................................................................................. ✔

In Process.php line 1236:

The process "composer update --working-dir='/tmp/ss-upgrader-5cebcffcc32fb' --prefer-stable --ignore-platform-reqs --no-plugins" exceeded the timeout of 60 seconds.


recompose [-d|--root-dir ROOT-DIR] [-w|--write] [-S|--strict] [-R|--recipe-core-constraint [RECIPE-CORE-CONSTRAINT]] [--cwp-constraint [CWP-CONSTRAINT]] [-P|--composer-path [COMPOSER-PATH]] [-Q|--quick]

I have set composer process-timeout to 900. But still I am getting above error.

I have searched for help links like Upgrading to silverstripe 4.3 shows “exceeded the timeout of 60 seconds” · Issue #7943 · composer/composer · GitHub but without success.

Is there any help on it? Thank you.