X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fextensions.php;h=5f3a704895bc1a7588896fdbecb018a6e5c2158b;hp=5eb14f67ad7f43e8aaa1163807ee7a20897780ce;hb=98077af43126dd7c274fe57f6ea0494e906e8943;hpb=de5ae633b5cafff852eb6d58505d609c87c5a803
diff --git a/inc/extensions.php b/inc/extensions.php
index 5eb14f67ad..5f3a704895 100644
--- a/inc/extensions.php
+++ b/inc/extensions.php
@@ -238,6 +238,9 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
// Try to register the extension
//* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().":ext_update=".$ext_update.",taskId=".$task."
\n";
$test = REGISTER_EXTENSION($ext_update, $task, $dry_run, false);
+
+ // Reset extension name
+ EXT_SET_CURR_NAME($ext_name);
//* DEBUG: */ print __FUNCTION__."[".__LINE__."]:currName=".EXT_GET_CURR_NAME().':'; var_dump($test);
} // END - if
} elseif ($ext_ver != EXT_GET_VERSION()) {
@@ -289,7 +292,7 @@ function REGISTER_EXTENSION ($ext_name, $task_id, $dry_run = false, $logout = tr
// Register extension
//* DEBUG: */ print __FUNCTION__."[".__LINE__."]:insert=".EXT_GET_CURR_NAME().'/'.EXT_GET_VERSION()." - INSERT!
\n";
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_extensions` (ext_name, ext_active, ext_version) VALUES ('%s','%s','%s')",
- array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
+ array(EXT_GET_CURR_NAME(), EXT_GET_ALWAYS_ACTIVE(), EXT_GET_VERSION()), __FUNCTION__, __LINE__);
// Remove cache file(s) if extension is active
runFilterChain('post_extension_installed', array('ext_name' => EXT_GET_CURR_NAME(), 'task_id' => $task_id));
@@ -545,21 +548,38 @@ function EXTENSION_UPDATE ($ext_name, $ext_ver, $dry_run = false) {
// And load SQL queries in order of version history
for ($idx = ($start + 1); $idx < count($history); $idx++) {
+ // Set current extension name
+ //* DEBUG: */ print __FUNCTION__.'['.__LINE__.':] ext_name='.$ext_name.'
';
+ EXT_SET_CURR_NAME($ext_name);
+
// Set extension version
$GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()] = $history[$idx];
// Load again...
LOAD_EXTENSION(EXT_GET_CURR_NAME(), 'update', $GLOBALS['cache_array']['update_ver'][EXT_GET_CURR_NAME()], $dry_run);
- if (EXT_GET_UPDATE_DEPENDS() != '') {
- // Is the extension there?
- if (GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()) != '') {
- // Update another extension first!
- $test = EXTENSION_UPDATE(EXT_GET_UPDATE_DEPENDS(), GET_EXT_VERSION(EXT_GET_UPDATE_DEPENDS()), $dry_run);
- } else {
- // Register new extension
- $test = REGISTER_EXTENSION(EXT_GET_UPDATE_DEPENDS(), 0, $dry_run, false);
- }
+ // Get all depencies
+ $depencies = EXT_GET_UPDATE_DEPENDS();
+
+ // Nothing to apply?
+ if (count($depencies) > 0) {
+ // Apply all extension depencies
+ foreach ($depencies as $ext_depend) {
+ // Set it as current
+ EXT_SET_CURR_NAME($ext_depend);
+
+ // Is the extension there?
+ if (GET_EXT_VERSION($ext_depend) != '') {
+ // Update another extension first!
+ $test = EXTENSION_UPDATE($ext_depend, GET_EXT_VERSION($ext_depend), $dry_run);
+ } else {
+ // Register new extension
+ $test = REGISTER_EXTENSION($ext_depend, 0, $dry_run, false);
+ }
+ } // END - foreach
+
+ // Set name back
+ EXT_SET_CURR_NAME($ext_name);
} // END - if
// Add notes