Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Upgrading SilverStripe /

Ask questions about upgrading SilverStripe to the latest version.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Upgrade 2.4.5 'sapphire' -> 3.0.5 'framework' various questions


Go to End


5 Posts   4935 Views

Avatar
forumq42

Community Member, 18 Posts

26 February 2013 at 12:38pm

Edited: 26/02/2013 2:42pm

Currently I have multiple installations SS 2.4.5 running in production.

On our dev web server I've just recently downloaded SS 3.0.5 and started walking through the upgrade guidelines from:
http://doc.silverstripe.org/framework/en/installation/upgrading

and reading:
http://doc.silverstripe.org/framework/en/trunk/changelogs/3.0.0#upgrading

"Rename references of sapphire to framework in .htaccess, web.config and /usr/bin/sake (the last is only necessary if you use sake)"
- don't see any .htaccess files
- /cms/web.config doesn't seem to contain any reference to /sapphire or /framework
- not using /usr/bin/sake as far as I know

I've backed up the working test installation of 2.4.5 before starting. I've only been working with this inherited SilverStripe a few months however I am fairly familiar with Unix, Apache and PHP. There is a fair bit of content on the 3 sites along with a handful of custom templates that were developed outside our organization.

Basically I've just deleted/moved the old 2.4.5 /cms and /sapphire directories and moved the 3.0.5 directories for /cms and the /framework directories into the old /html.

At this point I am sure some url's are broken due to rewrite rules. I've gone into Apache's httpd.conf and vhosts.conf files and replaced the few instances of 'sapphire' with 'framework' and restarted Apache. I did not find any .htaccess files under /html.

When I attempt to go the the website in order to do a /dev/build, I end up with a 500 Internal Error instead of the /dev/build output. Going to http://<mysite>/i.php will show me the PHP info page.

I assumed at first SilverStripe's main.php isn't even getting read and that I'm missing somewhere that has sapphire hardcoded instead of framework at the very least but was wondering where I should be looking next, however from my Apache error log I've seen (IPs changed to xxx by me:

[Mon Feb 25 16:08:50 2013] [error] [client xxx.xxx.xxx.xxx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

[Mon Feb 25 16:05:10 2013] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Call to undefined function mb_http_output() in ../www/html/framework/core/Core.php on line 232

the lines from Core.php:
232 mb_http_output('UTF-8');
233 mb_internal_encoding('UTF-8');
234 mb_regex_encoding('UTF-8');

###

Update:

Looking at phpinfo() I don't think multibyte extensions are installed in the version of PHP on the server currently. Perhaps this is the culprit?

After doing a 'yum install php53-mbstring.x86_64' and restarting Apache I seem to no longer be getting mbstring errors. Still can't /dev/build but errors from Apache now look like:

[Mon Feb 25 17:05:18 2013] [error] [client xxx.xxx.xxx.xxx] PHP Strict Standards: Declaration of SortableDataObject::extraStatics() should be compatible with that of DataExtension::extraStatics() in /www/html/dataobject_manager/code/SortableDataObject.php on line 123

and similar errors for other modules like ConcurrentEditingSiteTree, GoogleSitemapDecorator, AssetManagerFolder, etc.

###

Update #2:

After commenting out about a dozen lines from /mysite/_config.php and many reloads of http://<mysite>/dev/buid/?flush=1 some dev/build output was displayed. Quite a bit actually. Hopefull I would at least be able to get to the front page I directed the browser to http://<mysite> but was greeted by trace output which I suppose is a better than a 500 Internal Error. The trace results without the actual lines of code displayed looks something like:

[Strict Notice] Declaration of Subsite::duplicate() should be compatible with that of DataObject::duplicate()
GET /
Line 8 in /www/html/subsites/code/Subsite.php

[Strict Notice] Declaration of Subsite::canEdit() should be compatible with that of DataObject::canEdit()
GET /
Line 8 in /www/html/subsites/code/Subsite.php

[User Deprecated] DataList->join is deprecated. Use innerJoin() or leftJoin() instead. Called from DataObject::get.
GET /
Line 171 in /www/html/framework/dev/Deprecation.php

[User Deprecated] DataQuery->join is deprecated. Use innerJoin() or leftJoin() instead. Called from {closure}.
GET /
Line 171 in /www/html/framework/dev/Deprecation.php

[Notice] Undefined offset: 0
GET /
Line 306 in /data/www/html/subsites/code/Subsite.php

[User Deprecated] SQLQuery->__get is deprecated. Please use getDelete() instead. Called from SiteTreeSubsites->augmentSQL.
GET /
Line 171 in /www/html/framework/dev/Deprecation.php

###

Suggestions welcome.

Avatar
Willr

Forum Moderator, 5523 Posts

28 February 2013 at 9:10pm

You should see a .htaccess file (it will be a hidden file so consult your OS documentation on how to show hidden files). On the subsite issue, make sure you've updated to the latest build of subsites for 3.0 support.

Avatar
forumq42

Community Member, 18 Posts

1 March 2013 at 2:17pm

Thanks for the reply!

No .htaccess that I can find in /html or above it. Pretty sure all the rewriting is done in httpd.conf on our installation and pretty sure I corrected those.

As for modules we have installed there are a few: /subsites, /googlesitemaps, /peruseraccess, /sitetreeimporter, /swfupload and a couple others. However the Subsites module is one that is a requirement to go along with upgrading from 2.4.x to 3.x for us as we have several sites configured with subsites.

/dev/build/?flush=1 managed to run, of course the result was a page with an updated error report.

I'm hopeful that eventually I can untangle the changes from 2.4.x to 3.x and come up with the best plan of attack. From what I can tell from the upgrade docs and changelog the :

- /cms and /sapphire -> /framework directory have to be replaced. Got that far.

- Then there's the issue of module compatibility. I plan to remove any that aren't supported in 3.x or immediately needed at least.
Subsites will have to be working and stable.
- /subsites <- replaced with 3.x version of /subsites & did a /dev/build/?flush=1

- /mysite : correct any code under /mysite/code SS API function calls that <- working on this as errors pop up, we have almost 50 files under /mysite/code

- /themes: correct custom templates (.ss) code in /themes/../template to correspond to SS 3.x template language changes. <- not touched yet

Currently in my Apache error log I'm still getting complaints about errors but working through them along with what's displayed when I hit http://<mysite>

__

extraStatics(): I'm pretty sure the changelog explains what to do here. Changed function calls to static variable declaration in a handful of files.

___

updateCMSFields(), need to change calls of getCMSFields() to have appropriate parameters in a few files. Think those were corrected.

___

DataObject function declaration changed so was getting errors on. Fixed those in a couple files.

DataObject::canEdit()
DataObject::canDelete()
DataObject::canCreate()

___
___

[Thu Feb 28 12:39:58 2013] [error] [client ] PHP Strict Standards: Declaration of Page_Controller::ThemeDir() should be compatible with that of ViewableData::ThemeDir() in /www/html/mysite/code/Page.php on line 300

Still working on this one.

---

Some functions deprecated including:

- DataObjectDecorator, use DataExtension instead from ReflectionClass->newInstance

- DataObjectSet , use DataList or DataArray instead.

- DataList->getRange. Use limit($length,$offset) instead.

Haven't looked much at these yet.

---

[Thu Feb 28 16:58:16 2013] [error] [client] PHP Parse error: syntax error, unexpected '<', expecting T_STRING or T_VARIABLE or '{' or '$' in /www/html/silverstripe-cache/.cache.themes.sass.templates.Page.ss on line 5

One of the newest ones. Assume I have to update some lines of template code in Page.ss.

Likely will try tackling some of these tomorrow.

Avatar
forumq42

Community Member, 18 Posts

2 March 2013 at 5:11pm

Latest update.

These browser errors:

- DataObjectDecorator -> DataExtension : seems to have gone smoothly.

###

[User Deprecated] DataObjectSet is deprecated. DataObjectSet is deprecated. Use DataList or ArrayList instead.

Replaced DataObjectSet instances with DataList wherever it was found. Not sure this is all that needs to be done regarding DataObjectSet -> DataList (or ArrayList) since I see warnings and errors that I think resulted from making this change.

###

Many instances of issues with canEdit, canDelete(), canCreate() parameter list. Replaced canEdit() with canEdit($member = false) wherever found

[Strict Notice] Declaration of Author::canEdit() should be compatible with that of DataObject::canEdit()
GET /dev/build/?flush=1

Think these are all corrected now.

###

[Warning] get_class() expects parameter 1 to be object, array given
GET /
Line 154 in /www/html/framework/core/ClassInfo.php

Haven't diagnosed solution yet. Only a warning though?

###

Many /dev/builds and flushes later, still main error popping up in Apache log:

[Fri Mar 01 19:31:49 2013] [error] [client ] PHP Strict Standards: Declaration of ItemController::ThemeDir() should be compatible with that of ViewableData::ThemeDir() in /www/html/mysite/code/Book.php on line 1610

I've changed any reference of Root.Content.____ to Root.____ where I found it, however still getting the error above. There's references to Root.Behavior and Root.Subnav . Should these be altered ?

###
###

Also browser still producing:

[Warning] get_class() expects parameter 1 to be object, array given
GET /
Line 154 in /www/html/framework/core/ClassInfo.php

###

I assume this one has something to do with changing DataObjectSet to DataList. Definitely did several /dev/builds and flushes, error still present.

[User Error] DataObject::buildSQL: Can't find data classes (classes linked to tables) for Array. Please ensure you run dev/build after creating a new DataObject.
GET /
Line 113 in /www/html/framework/model/DataQuery.php

###

Not sure on these yet though assume related to DataObjectSet in some fashion:

[User Error] singleton() passed bad class_name: array ( 0 => Project::__set_state(array( 'destroyed' => false, 'model' => DataModel: ..... longlonglong output....
GET /
Line 340 in /www/html/framework/core/Core.php

[Warning] Illegal offset type in isset or empty
GET /
Line 657 in /www/html/framework/control/injector/Injector.php

[Warning] strpos() expects parameter 1 to be string, array given
GET /
Line 663 in /www/html/framework/control/injector/Injector.php

[Warning] Illegal offset type in isset or empty
GET /
Line 886 in /www/html/framework/control/injector/Injector.php

[Warning] Illegal offset type in isset or empty
GET /
Line 306 in /www/html/framework/core/Object.php

[Warning] class_exists() expects parameter 1 to be string, array given
GET /
Line 897 in /www/html/framework/control/injector/Injector.php

[Warning] Illegal offset type
GET /
Line 786 in /www/html/framework/control/injector/Injector.php

[Notice] Array to string conversion
GET /
Line 843 in /www/html/framework/control/injector/Injector.php

[User Error] Uncaught ReflectionException: Class Array does not exist
GET /
Line 843 in /www/html/framework/control/injector/Injector.php

Avatar
Willr

Forum Moderator, 5523 Posts

3 March 2013 at 10:52am

I have in the past run into

[Warning] get_class() expects parameter 1 to be object, array given
GET /
Line 154 in /www/html/framework/core/ClassInfo.php

When I've tried applying an extension (ne. decorator) to a class that no longer exists.