Jump to content

Maintenance Upgrade Fails


QuotesUK
 Share

Recommended Posts

Whilst attempting to upgrade via the admin control panel I get the following error...

(n.b. the space in front of .zip is as it appears)

 

The following errors were detected:

  • Sorry. CubeCart-5.2.14 .zip was not found. Please try again later.

WARNING: Your store is not up-to-date, v5.2.14 is available, but you are running v5.2.13

Link to comment
Share on other sites

If possible, please edit the file /admin/sources/maintenance.index.inc.php, near line 526:

Was:
if (($response = $request->send()) !== false) {
 
Now:
if (($response = $request->send()) !== false) { $response = trim($response);

When cubecart.com went to (mostly) SSL, it seems the response comes back with a bunch of trailing whitespace. That whitespace needs to be trimmed off.

Link to comment
Share on other sites

Well, it's a slightly different error.

 

This is very much probably due to cubecart.com going to SSL.

 

You made the edit to line 526, now also make this edit in maintenance.index.inc.php:

Near Line 159:
Was:
$contents = file_get_contents('http://www.cubecart.com/download/'.$_GET['upgrade'].'/zip');
 
Now:
$contents = file_get_contents('https://www.cubecart.com/download/'.$_GET['upgrade'].'/zip');
Link to comment
Share on other sites

I don't know what the exact version was around Feb 2013 but that was when a clean install was carried out. I have been patching to latest versions as they come out. Just wanted to reassure you that I have a standard install.

 

This issue now appears more complex than code typos so here is my info from server error logs (domain redacted to example.com)...

 

mod_fcgid: stderr: PHP Warning: krsort() expects parameter 1 to be array, null given in /var/www/vhosts/example.com/httpdocs/admin/sources/maintenance.index.inc.php on line 503

mod_fcgid: stderr: PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/example.com/httpdocs/admin/sources/maintenance.index.inc.php on line 505

mod_fcgid: stderr: PHP Warning:  Invalid argument supplied for foreach() in /var/www/vhosts/example.com/httpdocs/admin/sources/maintenance.index.inc.php on line 498

 

Additional info, the code around these lines is about backups - I have already taken backups - downloaded and then deleted - so there are no online backups present. I tried creating a new database backup and upgrading but still get the same error. I also cleared caches.

Link to comment
Share on other sites

Please check the version of PHP you have on your site. In admin, Dashboard, Store Overview tab, or PHP Info.

 

There is a bug in PHP that is contributing to the inability to make a backup. The bug is fixed in PHP versions 5.5.17 and 5.4.33. There is a similar bug fixed in PHP 5.2.5. I do not know if the bug exists in the 5.3 series, but the last release is PHP 5.3.29 and is dated before the dates of the 5.4.33 and 5.5.17 releases. So, if the bug is in 5.3.29 or earlier, it will probably not get fixed.

 

I do not know how far back in the PHP 5.4 and 5.5 series the bug exists, so please consult with your hosting provider to make sure your site is running these specific versions or later of these series.

Link to comment
Share on other sites

bsmither, your patch with the trim function removed the space character from my warning message

 

I'm just wondering, do you think there is a way of just inserting a value for the download path that skips all of the (broken) routines that are supposed to assemble the path? Or is it the error routine giving us a false positive on the file not found? Seems bizarre that this should break on this upgrade when it has worked for so many upgrades before. I would assume that either CubeCart changed their download location or it's the http(s) changes as a result of Poodle SSL.

Link to comment
Share on other sites

This has been resolved as an exception has been added to our server NOT to force SSL for access to the download files. Annoyingly DNS caches may still prevent this working for a while for some people. 

 

If anyone has any success without code modifications to your site I'd love to hear. I'm really sorry for any inconvenience caused. 

 

The demo store still doesn't work for forced upgrade. Below are the rules in place which from testing on another domain work fine. 

Link to comment
Share on other sites

CubeCart did not change the download location of the file except that it now requires https and the Request class can't do that yet.

 

The second edit, making the file_get_contents() function use an https URL should work. I'm not sure why it doesn't unless the server admin has disallowed fetching files from off-site locations as a security measure.

 

Assuming the actual problem is either any one or a combination of several factors, we can make some edits to the upgrade routine that will pre-check for the existence of the latest CubeCart package and if found, bypass trying to fetch it. in /admin/sources/maintenance.index.inc.php:

Find near line 149-151:
Was:
if(isset($_GET['upgrade']) && !empty($_GET['upgrade'])) {

  $contents = false;
 
Now:
if(isset($_GET['upgrade']) && !empty($_GET['upgrade'])) { // Entering upgrade routine.
  $destination_path = CC_ROOT_DIR.CC_DS.'backup'.CC_DS.'CubeCart-'.trim($_GET['upgrade']).'.zip'; if(!file_exists($destination_path)) { // Don't have it - go get it.
    $contents = false;

Near line 174:
Was:
$destination_path = CC_ROOT_DIR.CC_DS.'backup'.CC_DS.'CubeCart-'.$_GET['upgrade'].'.zip';
 
Now:
// $destination_path = CC_ROOT_DIR.CC_DS.'backup'.CC_DS.'CubeCart-'.trim($_GET['upgrade']).'.zip';
 
Near line 177-179:
Was:
fclose($fp);

if(file_exists($destination_path)) {
 
Now:
fclose($fp);
} }
if(file_exists($destination_path)) { // It's ready to process.

Near line 273-277:
Was:
      $_POST = array();
    }

  } // end if $contents
}

Now:
      $_POST = array();
    } // end if $contents
 

}

Download the latest version and then FTP that zip file to the /backup/ folder of CubeCart. Make sure the file is named CubeCart-X.Y.Z.zip where X, Y, and Z are the version numbers.




 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...