Post by xcentriq » Tue Aug 30, 2011 11:37 pm

is this upgrade script available yet? I want to upgrade my cart from 1.5.0.5 to 1.5.1.1

New member

Posts

Joined
Thu Jun 16, 2011 3:26 pm

Post by Qphoria » Wed Aug 31, 2011 12:05 am

1.4.x was fine.. just going from 1.4.x to 1.5.x is the only time you should lose anything
Again.. this isn't a new upgrade script. It's the same upgrade script as it has been for the last 2 years... just more integrated and styled.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by xcentriq » Wed Aug 31, 2011 9:58 pm

So is there a upgrade script from 1.5.0.5 to 1.5.1.1 in the current 1.5.1.1 package?

New member

Posts

Joined
Thu Jun 16, 2011 3:26 pm

Post by Xsecrets » Wed Aug 31, 2011 10:15 pm

xcentriq wrote:So is there a upgrade script from 1.5.0.5 to 1.5.1.1 in the current 1.5.1.1 package?
no you have to use the beta upgrade script. None of the 1.5 versions so far have included a working upgrade script. This one from this thread will be in 1.5.2 whenever it is released and things will get back to normal.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by opencartrules » Sat Sep 03, 2011 4:34 pm

Can anyone answer this question :

At the latest OC release on 23/7 my developer made a backup on our current 1.5.0.5 installation and installed 1.5.1.1
Then he made a restore from backup but with some incomplete cart as a result, among other things, product options were missing! I had to put them back manually. He has done something wrong?

Will the new upgrade script to be launched with 1.5.2 fix those problems so that product options are included with the upgrade from current 1.5.1.1 to 1.5.2 ?

New member

Posts

Joined
Tue Aug 09, 2011 9:47 pm

Post by Qphoria » Sat Sep 03, 2011 11:12 pm

Xsecrets wrote:
xcentriq wrote:So is there a upgrade script from 1.5.0.5 to 1.5.1.1 in the current 1.5.1.1 package?
no you have to use the beta upgrade script. None of the 1.5 versions so far have included a working upgrade script. This one from this thread will be in 1.5.2 whenever it is released and things will get back to normal.
Negative... 1.5.1.1 DOES have an upgrade script in it already and it only works for 1.5.0 to 1.5.1.1

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Freddo » Fri Sep 09, 2011 7:09 am

just a heads up that the upgrade script to 1.5.1 will lose your extensions/modules data. My advice is don't use it.

Newbie

Posts

Joined
Thu Mar 11, 2010 12:17 pm

Post by Xsecrets » Fri Sep 09, 2011 8:11 am

Freddo wrote:just a heads up that the upgrade script to 1.5.1 will lose your extensions/modules data. My advice is don't use it.
yeah well no way around that since the way modules store data was changed between 1.5.0.x and 1.5.1, but how much data is that really?

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Freddo » Fri Sep 09, 2011 8:25 am

Xsecrets wrote:
Freddo wrote:just a heads up that the upgrade script to 1.5.1 will lose your extensions/modules data. My advice is don't use it.
yeah well no way around that since the way modules store data was changed between 1.5.0.x and 1.5.1, but how much data is that really?
Not that hard to write sql to transfer from old format to new format either! Hey but I'm a professional programmer what would i know!

Newbie

Posts

Joined
Thu Mar 11, 2010 12:17 pm

Post by Qphoria » Fri Sep 09, 2011 9:07 am

Freddo wrote:just a heads up that the upgrade script to 1.5.1 will lose your extensions/modules data. My advice is don't use it.
There is no way around this really unless I took the time to extract, serialize, and reinsert all the data.. but by this point it's almost moot and takes less time for you to simply uninstall/reinstall each module. The way data is saved for modules has changed in 1.5.1.1. To make is less clunky, I should just make it blow away ALL module settings during upgrade. That will likely clear up the confusion people have with php errors after upgrade. Then you'll just reinstall all modules and be done.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Landho » Sat Sep 10, 2011 6:15 am

Thanks! Upgrade script worked - broke the stuff that was mentioned it would break.

Is there a post or details about where old data is store for modules? Thought it wouldn't be so tough to re-type everything, but it is a royal pain.

Newbie

Posts

Joined
Sun Jul 10, 2011 1:34 am

Post by Guardian » Wed Sep 14, 2011 4:47 pm

Qphoria wrote:<snip> Unfortunately we need to have a static version number to do this. The current VERSION constant is stored in the index.php file, but when you upload the new files, it overwrites the index.php file and the last version is lost.

So my idea is to add the config version to the config.php files during install.
Then compare the index version to the config version and run the upgrade steps from the current version to the new version.

I'm thinking to keep it simple, it can just be added as a comment to the config.php file
like

Code: Select all

// config_version = 1.5.0
at the top of the config file.
<snip>
More demos to follow.
Why not just store the version number in the DB?

For my own software I use a simple function to determine the current version number (from the DB) then load and execute a SQL file. The SQL files are numbered sequencially (using the version number as a base) and the version number is updated in the DB from each of the SQL files.
The installer just loops through the upgrade function until it cannot find a SQL file with a number higher than the current (DB) version number.

New member

Posts

Joined
Fri Jun 10, 2011 5:34 pm

Post by Qphoria » Tue Sep 20, 2011 2:34 am

yea.. that is part of it... was thinking if we needed a separate "config version" vs "db version" but we may not need the config versions

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by rmullaney77 » Tue Dec 10, 2013 2:15 am

Up until version is stored within the system that is not overwritten during an upgrade... Could you not just check the db for missing fields/values to automate version detection?

Code: Select all

if (v140_stuff_missing) {
	trigger_error("Cannot upgrade OpenCart", E_USER_ERROR);
} else {
	$major = 1; $minor = 4; $build = 0; $revision = 0;
	if (v142_stuff_missing) { //no variables to change; }
	if (v144_stuff_missing) { $revision = 2; }
	if (v145_stuff_missing) { $revision = 4; }
	if (v146_stuff_missing) { $revision = 5; }
}
Where "vXXX_stuff_missing" is the result of an internal method (see edit below) that checks the DB structure.

Working backwards would probably be more efficient, but you get the idea ;)

[EDIT]

Maybe the method would look like...

Code: Select all

private function match_table_field($table, $field = NULL, $value = NULL) {
	//sanitize variables since we are not forced to remove install folder
	$table = DB_PREFIX . $this->db->escape($table);
	$query = $this->db->query("SHOW TABLES LIKE '{$table}'");
	if ($query->num_rows) {
		if (empty($field)) {
			return TRUE;
		} else {
			$sql = "SELECT * FROM `{$table}`";
			if ($value) {
				$value = $this->db->escape($value);
				$sql .= " WHERE `{$field}` = '{$value}'";
			}
			$query = $this->db->query($sql);
			if ($query->num_rows) {
				return (empty($value)) ? isset($query->row[$field]) : return TRUE;
			}
		}
	}
	return FALSE;
}
Only $table is required. If other variables are passed/checked if provided/necessary for the comparison 8)

Code: Select all

$table_exists = $this->match_table_field('some_table');
$field_exists = $this->match_table_field('some_table', 'some_field');
$field_equals = $this->match_table_field('some_table', 'some_field', 'some value');
Note: This untested example is MySQL-only. I'm sure the actual SQL varies between DB drivers.

--------------------------------------------------
My BlogMy ExtensionsOpenCart Templates


User avatar
Active Member

Posts

Joined
Fri Nov 19, 2010 2:08 am
Location - Tampa, Florida
Who is online

Users browsing this forum: No registered users and 95 guests