} // END - if
// Load the extension and maybe found language and function files.
-function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0', $dry_run = false) {
+function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $dry_run = false) {
// Loading an extension in same mode, but not test/update, twice is not
// good, so is the extension $ext_name already loaded in mode $ext_mode?
if ((isset($GLOBALS['loaded_extension'][$ext_name][$ext_mode])) && (!in_array($ext_mode, array('update', 'test')))) {
setCurrentExtensionVersion($ext_ver);
} else {
// Set it to 0.0 by default
- setCurrentExtensionVersion('0.0');
+ setCurrentExtensionVersion('0.0.0');
// Is the extension installed?
if ((isExtensionInstalled($ext_name)) && ($ext_mode != 'register')) {
} // END - if
// In all but test-mode we need these messages to debug! Please report all (together, e.g.)
- if (($ext_mode != 'test') && (getCurrentExtensionVersion() == '0.0')) {
+ if (($ext_mode != 'test') && (getCurrentExtensionVersion() == '0.0.0')) {
// Abort here, this must now always be set!
debug_report_bug(__FUNCTION__, __LINE__, 'Extension version is empty, setting to 0.0. ext_name=' . $ext_name . ', ext_mode=' . $ext_mode . ', dry_run=' . intval($dry_run));
} // END - if
// Does this extension exists?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName());
- if (loadExtension(getCurrentExtensionName(), 'register', '0.0', isExtensionDryRun())) {
+ if (loadExtension(getCurrentExtensionName(), 'register', '0.0.0', isExtensionDryRun())) {
// Set current extension name again
setCurrentExtensionName($ext_name);
// Load extension in detected mode
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name[' . $ext_id . ']=' . getCurrentExtensionName() . ',load_mode=' . $load_mode);
- loadExtension(getCurrentExtensionName(), $load_mode, '0.0', false);
+ loadExtension(getCurrentExtensionName(), $load_mode, '0.0.0', false);
// Init these SQLs
initSqls();
// Check if version is updated
//* DEBUG: */ debugOutput(getCurrentExtensionName() . '/' . $ext_name . ':' . getThisExtensionVersion() . '/' . $ext_ver . '/' . intval(is_array($history)));
if (((getThisExtensionVersion() != $ext_ver) || (isExtensionDryRun())) && (is_array($history))) {
- // Search for starting point
- $start = array_search($ext_ver, $history);
+ // Search for starting point (-1 for making 0.0 -> 0.0.0 switch work)
+ $start = -1;
+ if ($ext_ver != '0.0') {
+ $start = array_search($ext_ver, $history);
+ } // END - if
// And load SQL queries in order of version history
for ($idx = ($start + 1); $idx < count($history); $idx++) {
}
// Output verbose SQL table for extension
-function addExtensionVerboseSqlTable ($title = '', $dashed = '', $switch = false, $width = '100%') {
+function addExtensionVerboseSqlTable ($title = '{--ADMIN_SQLS_EXECUTED_ON_REMOVAL--}', $dashed = '', $switch = false, $width = '100%') {
// Empty title?
if (empty($title)) {
- // Then fix it to default
- $title = '{--ADMIN_SQLS_EXECUTED_ON_REMOVAL--}';
+ // Then abort here
+ debug_report_bug(__FUNCTION__, __LINE__, 'title is empty.');
} // END - if
// Init variables
// Is do we have verbose output enabled?
if ((!isExtensionActive('sql_patches')) || (isVerboseSqlEnabled())) {
// Update notes found?
- if (isExtensionUpdateNoteSet($ext_ver)) {
+ if ((isExtensionUpdateNoteSet($ext_ver)) && ($ext_ver != '0.0.0')) {
// Update notes found
$content = array(
'ver' => $ext_ver,
// Reset them
setExtensionUpdateNotes('', $ext_ver);
- } elseif (in_array($ext_ver, array('0.0', '0.0.0'))) {
- // Initial release
- $content = array(
- 'ver' => $ext_ver,
- 'notes' => '{--INITIAL_RELEASE--}'
- );
+ } elseif ($ext_ver == '0.0.0') {
+ // Is the extension productive?
+ if (isExtensionProductive(getCurrentExtensionName())) {
+ // Initial release
+ $content = array(
+ 'ver' => $ext_ver,
+ 'notes' => '{--INITIAL_RELEASE--}'
+ );
+ } else {
+ // Not productive
+ $content = array(
+ 'ver' => $ext_ver,
+ 'notes' => '{--DEVELOPER_RELEASE--}'
+ );
+ }
} else {
// No update notes found
$content = array(