Can't upgrade past 8.1.0

Permalink
I tried posting this in the development forum a few days ago, but got no responses, so I'm trying again here!

My main issue is that I have been unable to upgrade to any version past what I'm currently running, which is 8.1.0. Originally, I thought maybe it was just a bug with 8.2.0 and 8.2.1, and decided to wait for the next version, but I'm not having any luck with 8.3.2 either.

I have never gotten the dashboard updates to work, so I'm doing the manual method where I replace the concrete folder with the new version. And in the case of 8.3.2. I also copied the composer.json and composer.lock files (though I have no idea what those do). I always get some sort of database error and end up restoring my 8.1.0 site. The error with the 8.3.2 upgrade is:

An exception occurred while executing 'INSERT INTO SystemDatabaseMigrations (version) VALUES (?)' with params ["20170818000000"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '20170818000000' for key 'PRIMARY'

I'm wondering if something went wrong with the database migration when I upgraded to 8.1.0, and that is now preventing any further migrations. Any thoughts on how to figure this out?

Not sure if this is related, but I am also getting a PHP fatal error (Call to a member function number() on null in /xxx/concrete/attributes/number/form.php on line 3) when I try to view or edit a file's properties in the image manager. I assume this has been going on since the upgrade to 8.1.0, but I can't confirm that. I checked out the particular file, and it's the same in 8.1.0 as in 8.3.2, but I'm not familiar enough with php or databases to know whether there's an error in the file, or if it's a sign that something is messed up elsewhere. Also, I can't edit my image attributes and alt tags, which is frustrating!

EDIT: Contents of concrete/attributes/number/form.php are

<?php
    defined('C5_EXECUTE') or die("Access Denied.");
    print $form->number(
        $this->field('value'),
        $value,
        [
            'step' => 'any'
        ]
    );


I would really appreciate any insight anyone might have! I'm not even sure where to start looking for the problem. Thanks!

 
hutman replied on at Permalink Reply
hutman
When you tried to upgrade previously did you take your original concrete folder and rename it to something like concrete_8.1.0 and (after making a database backup) place the new concrete directory from the 8.2.1 download then access the website?

If so, I assume you then got an error of some kind. Did you restore the original concrete folder and database? It almost seems like your core and database versions aren't matching up for some reason.
DustyStrings replied on at Permalink Reply
Thanks for the response!

Actually, I think the first time I tried to upgrade to 8.2, I tried via the dashboard, which failed. Then I tried the manual method exactly as you've described. Each time, I restored both files and database to the 8.1.0 version, but I don't know how to check for sure if the database and core are the same version. In my environment info, both core and installed say 8.1.0.

Going back to look at my error log from the previous updates (which no doubt I should have done sooner) shows many repeats of this error:

PHP Fatal error: Doctrine\Common\Proxy\AbstractProxyFactory::getProxyDefinition(): Failed opening required '/xxx/application/config/doctrine/proxies/__CG__ConcreteCoreEntitySiteType.php' (include_path='/xxx/updates/concrete5-8.2.1_remote_updater/concrete/vendor:.:/usr/local/php56/pear') in /xxx/updates/concrete5-8.2.1_remote_updater/concrete/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209

Which I think are from trying to update through the dashboard/updates folder. And then a whole of the same error, but without the updates folder, from when I tried upgrading by replacing the concrete folder.

Now with some further searching, I see I'm not the only one to have run into this error:

https://www.concrete5.org/developers/bugs/8-1-0/.binconcrete5-ormgen...

https://www.concrete5.org/community/forums/customizing_c5/c5.8.1.0-a...

So it may be a php version issue, but it seem like the first thread is recommending switching from 5.6 (which is what I'm on now) to 7+, and the second thread is recommending the other direction. I guess since it's not working as is, I'll give 7+ a try and see if that allows me to upgrade.

THEN I'll find out if my other error (with opening file properties) is still happening.
hutman replied on at Permalink Reply
hutman
Yes, I would upgrade your PHP version to 7.0, delete everything in the /updates folder (assuming you're not using anything in there) and then try the upgrade again.
DustyStrings replied on at Permalink Reply
Well, I switched to PHP v. 7.0.27, cleared cache, made sure updates folder was empty, then tried replacing the concrete folder with the 8.3.2 concrete folder and visiting the site.

It looks like it may have timed out, but I also got an error in my log:

[31-Jan-2018 13:24:57 CST6CDT] PHP Fatal error: require(): Failed opening required 'concrete/dispatcher.php' (include_path='.:/usr/local/php70/pear') in /home/manufac3/public_html/index.php on line 2

There is a concrete/dispatcher.php file present. Could it just be a timeout error, and if so, any advice on resolving that? I've read about updating via command line, but that's an arena I'm unfamiliar with.
hutman replied on at Permalink Reply
hutman
I'm pretty sure you have to go 8.1 -> 8.2.1 -> 8.3.2, I could be wrong, but I don't think you can go from 8.1 -> 8.3.2
DustyStrings replied on at Permalink Reply
You might be right. It looks like you should be able to upgrade to 8.3.2 from anything after 5.7.13 (http://www.concrete5.org/download), but just for kicks, I'll give it a try incrementally!
hutman replied on at Permalink Reply
hutman
And here is the information on how to upgrade - https://documentation.concrete5.org/developers/installation/upgradin...
DustyStrings replied on at Permalink Reply
I tried the force upgrade link:

/ccm/system/upgrade

and it told me the upgrade was complete and the version was 8.3.2. However, visiting the site showed a blank white page. When I tried to re-run the upgrade script from that system/upgrade page, I got the same error I was getting before:

Doctrine\Common\Proxy\AbstractProxyFactory::getProxyDefinition(): Failed opening required '/home/manufac3/public_html/application/config/doctrine/proxies/__CG__ConcreteCoreEntitySiteType.php' (include_path='/home/manufac3/public_html/concrete/vendor:.:/usr/local/php70/pear')

This is now with PHP v. 7.0.27
hutman replied on at Permalink Reply
hutman
Make sure you restore your database before you try again.
DustyStrings replied on at Permalink Reply
Yep, will do!
hutman replied on at Permalink Reply
hutman
Also, check your /application/config files, I"m not sure which one, but just make sure that none of them say you have 8.3.2 or the upgrade will get messed up.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Are you sure that the file /concrete/attributes/number/form.php does exist in concrete5 version
8.1.0?
I just downloaded the 8.1.0 archive and looked for that file and I don't see it?
The only file i see in that location is a controller.php file?
DustyStrings replied on at Permalink Reply
Good question. I'm hoping if I can solve the upgrade problem first, then either my attributes/number/form.php problem will go away, or it'll be more clear that it's an unrelated issue. That file does exist in 8.3.2, so I suppose it's possible it got left over somehow after one of my failed upgrades?
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Yes that is my thought also, I think I would replace the concrete folder from a fresh download to ensure you do not have a corrupt 8.1.0 concrete file system.
DustyStrings replied on at Permalink Reply
I hadn't thought of that approach, thanks!
DustyStrings replied on at Permalink Reply
You're a genius! I haven't worked out the upgrade problem yet, but this absolutely fixed my file properties error, which was actually starting to cause problems with the existing site.

I don't suppose I can eventually mark two best answers, can I? I really asked two different questions, I just thought they might be related.
DustyStrings replied on at Permalink Reply
I may have spoken a little too soon. I can indeed now *view* my file properties, but when trying to save a change (in the tags field for an image), I get the following error:

{"error":{"message":"Entity class 'Concrete\\Core\\Entity\\Attribute\\Key\\EventKey' used in the discriminator map of class 'Concrete\\Core\\Entity\\Attribute\\Key\\ExpressKey' does not exist."},"errors":["Entity class 'Concrete\\Core\\Entity\\Attribute\\Key\\EventKey' used in the discriminator map of class 'Concrete\\Core\\Entity\\Attribute\\Key\\ExpressKey' does not exist."]}

It does let me save if I try again, but that seems to result in the image being deleted entirely. :-)

Does this mean there's likely a leftover in the database as well? I'm afraid I have no idea what a discriminator map is. I do see an ExpressKey.php file, but no EventKey file.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Yes it does look like you have a corrupted database, the file in the error message 'EventKey.php' does not exist in the 8.1.0 system whereas it does exist in the 8.3.2 system..
A possible hack would be to copy the EventKey.php file from 8.3.2 into your 8.1.0 file system and see if the errors go away.
If so, then you have no alternative but to get the 8.3.2 upgrade to work.
If you can let me have access to the server cpanel, I will try putting copies of your files and database on my development server (local machine) to see if I can resolve this upgrade problem for you.
If you want to try this, PM me the details.
If you do not want to try this, no worries, I completely understand.
DustyStrings replied on at Permalink Reply
I had to let this drop for a few weeks, but back to trying to sort it out now!

I tried the hack of copying the EventKey file from 8.3.2, which did clear up everything related to file attributes. Unfortunately, the upgrade to 8.3.2 failed again, with the same error as before:

An exception occurred while executing 'INSERT INTO SystemDatabaseMigrations (version) VALUES (?)' with params ["20170512000000"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '20170512000000' for key 'PRIMARY'

If your very kind offer to look into this still stands, I think I would like to take you up on that. Given my own limited knowledge of php and databases, the other option I see at this point is to restore back to a six-month-old backup (doing it the slow way where I make sure to empty the database first, as hutman pointed out), and then painstakingly try to remember and recreate all the copy and layout and image changes that have happened since then.

Or is there any other way to clean up a corrupted database?

I very much appreciate all the advice and help!
hutman replied on at Permalink Reply
hutman
Just to verify, when you restore your database you are removing all tables and then restoring from the backup, right? If not you could have leftover rows from the previous install.
DustyStrings replied on at Permalink Reply
To be honest, I don't know for sure. I've been downloading a database backup through cpanel and then restoring it through cpanel. It's just a button click for both processes - no options available to select.
DustyStrings replied on at Permalink Reply
Thanks everyone for the ideas and support! I'm reaching the conclusion that I've got a corrupted database, likely due to so many failed upgrades, and probably incompletely-restored backups. It's beyond my skills at this point to do anything besides roll back to a really old backup and undo months of work, so I've reached out to the Concrete5 core team to see about hiring tech support from them.
edbeeny replied on at Permalink Reply
edbeeny
I've experienced similar issues, wait until the next version is released as there are more fixes for upgrading.

Have you tried command line update using SSH?

https://github.com/concrete5/concrete5/pull/6457...
DustyStrings replied on at Permalink Reply
A few others have said the same thing about waiting for 8.3.3. Seems like good advice, since the site is more or less functional at the moment.

SSH is outside my skill area without very specific step-by-step instructions, so I haven't tried it.
edbeeny replied on at Permalink Reply
edbeeny
If you want pm me your ftp details and access to your database, I will set it up on my server and try to update.

Ed
DustyStrings replied on at Permalink Reply
Thanks, but I think we'll wait and not make it harder than it needs to be!