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.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?
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
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 ?
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 ?
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.1Xsecrets wrote: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.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?
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?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.
OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter
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!Xsecrets wrote: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?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.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.
Why not just store the version number in the DB?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
likeat the top of the config file.Code: Select all
// config_version = 1.5.0
<snip>
More demos to follow.
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.
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?
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...
Only $table is required. If other variables are passed/checked if provided/necessary for the comparison
Note: This untested example is MySQL-only. I'm sure the actual SQL varies between DB drivers.
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; }
}
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;
}
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');
--------------------------------------------------
My Blog ↔ My Extensions ↔ OpenCart Templates
Who is online
Users browsing this forum: No registered users and 95 guests