Skip to content

Commit

Permalink
DivaVocals#151: Correct upgrade when IH_VERSION isn't recorded
Browse files Browse the repository at this point in the history
From what I can surmise, this applies to IH versions prior to 4.3.4.
  • Loading branch information
lat9 committed Apr 11, 2019
1 parent e435726 commit d57de18
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
die('Illegal Access');
}

define('IH_CURRENT_VERSION', '5.1.2');
define('IH_CURRENT_VERSION', '5.1.3-beta1');

// -----
// Wait until an admin is logged in before seeing if any initialization steps need to be performed.
Expand Down Expand Up @@ -210,18 +210,6 @@
);
}

// -----
// Create a configuration item that will display the plugin's current version. Using 'INSERT IGNORE'
// here, just in case this configuration value already exists.
//
$db->Execute(
"INSERT IGNORE INTO " . TABLE_CONFIGURATION . "
(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)
VALUES
('IH version', 'IH_VERSION', '" . IH_CURRENT_VERSION . "', 'Displays the currently-installed version of <em>Image Handler</em>.', $cgi, 1000, now(), NULL, 'trim(')"
);
define('IH_VERSION', '0.0.0');

// -----
// Remove "legacy" Image Handler configuration items.
//
Expand All @@ -245,6 +233,21 @@
zen_register_admin_page('configImageHandler4', 'BOX_TOOLS_IMAGE_HANDLER', 'FILENAME_IMAGE_HANDLER', '', 'tools', 'Y', 14);
}
}

// -----
// On an initial install or an upgrade from an IH-version that (er) didn't record an 'IH_VERSION',
// create a configuration element that displays the plugin's current version and set that definition
// for follow-on upgrade processing.
//
if (!defined('IH_VERSION')) {
$db->Execute(
"INSERT INTO " . TABLE_CONFIGURATION . "
(configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function)
VALUES
('IH version', 'IH_VERSION', '" . IH_CURRENT_VERSION . "', 'Displays the currently-installed version of <em>Image Handler</em>.', $cgi, 1000, now(), NULL, 'trim(')"
);
define('IH_VERSION', (defined('IH_RESIZE')) ? '?.?.?' : '0.0.0');
}

// -----
// Update the configuration table to reflect the current version, if it's not already set.
Expand Down
8 changes: 7 additions & 1 deletion docs/image_handler/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<body>
<h1>Image Handler<sup>5</sup> for Zen Cart v1.5.5 (and later)</h1>
<h3>Version 5.1.2 by lat9</h3>
<h3>Version 5.1.3 by lat9</h3>
<p>Current Support Thread at Zen Cart Forums: <a href="https://www.zen-cart.com/showthread.php?222983-Image-Handler-5-(for-v1-5-5)-Support-Thread" target="_blank">https://www.zen-cart.com/showthread.php?222983-Image-Handler-5-(for-v1-5-5)-Support-Thread</a></p>

<p><strong>Notes:</strong></p>
Expand Down Expand Up @@ -413,6 +413,12 @@ <h2>Un-Install Instructions</h2>

<div id="changes">
<ul>
<li>v5.1.3-beta1, 2017-04-11:<ul>
<li>BUGFIX: Correct upgrade from IH versions that didn't include an <b>IH_VERSION</b> value.</li>
<li>The following files were changed (all in the <em>1_Installation_Files (v1.5.5)</em> directory):<ol>
<li>/YOUR_ADMIN/includes/init_includes/init_image_handler.php</li>
</ol></li>
</ul></li>
<li>v5.1.2, 2019-02-24:<ul>
<li>BUGFIX: Correct undefined <code>LARGE_IMAGE_WIDTH</code> and <code>_HEIGHT</code> constants.</li>
<li>BUGFIX: Correct <code>configuration_description</code> for small/medium/large image backgrounds.</li>
Expand Down

0 comments on commit d57de18

Please sign in to comment.