function loadExtension ($ext_name, $ext_mode = 'init', $ext_ver = '', $dry_run = false) {
// If this happens twice, we need the bug report from you, except for updates/tests
if ((isset($GLOBALS['loaded_extension'][$ext_name][$ext_mode])) && (!in_array($ext_mode, array('update', 'test')))) {
- debug_report_bug(__FUNCTION__ . '() is called twice: ext_name=' . $ext_name . ', ext_mode='. $ext_mode . ',ext_sqls=' . print_r(getExtensionSqls(), true) . ', ext_register_running=' . print_r($GLOBALS['ext_register_running'], true) . ', ext_running_updates=' . print_r($GLOBALS['ext_running_updates'], true));
+ debug_report_bug(__FUNCTION__, __LINE__, '() is called twice: ext_name=' . $ext_name . ', ext_mode='. $ext_mode . ',ext_sqls=' . print_r(getExtensionSqls(), true) . ', ext_register_running=' . print_r($GLOBALS['ext_register_running'], true) . ', ext_running_updates=' . print_r($GLOBALS['ext_running_updates'], true));
} // END - if
// Make sure this situation can only happen once
// In normal mode return a true on success
$ret = true;
} elseif (getExtensionDryRun() === true) {
- // In "dry-run" mode return array with all SQL commands
- $ret = getExtensionSqls();
+ // In "dry-run" mode do always return a true
+ $ret = true;
// Re-init queries and notes
- initExtensionSqls(true);
initExtensionNotes();
} else {
// Extension has been removed for updates, so all is fine!
// Empty extension name should be fixed!
if (empty($ext_name)) {
// Please report this bug!
- debug_report_bug(__FUNCTION__ . ': ext_name is empty which is not allowed here.');
+ debug_report_bug(__FUNCTION__, __LINE__, 'ext_name is empty which is not allowed here.');
} // END - if
// Extensions are all inactive during installation
$OUT = loadTemplate('admin_ext_sql_table', true, $content);
} elseif ((isExtensionInstalledAndNewer('sql_patches', '0.0.7')) && (getConfig('verbose_sql') == 'Y')) {
// No addional SQL commands to run
- $OUT = loadTemplate('admin_settings_saved', true, getMessage('ADMIN_NO_ADDITIONAL_SQLS'));
+ $OUT = loadTemplate('admin_settings_saved', true, '{--ADMIN_NO_ADDITIONAL_SQLS--}');
} // END - if
// Return output
// Did we find some extension?
if (empty($data['ext_name'])) {
// We should fix these all!
- debug_report_bug(__FUNCTION__ . ': ext_name is empty. ext_id=' . $ext_id);
+ debug_report_bug(__FUNCTION__, __LINE__, 'ext_name is empty. ext_id=' . $ext_id);
} // END - if
// Return the extension name
/* DEBUG:
if ((isset($updateDepends, $GLOBALS['ext_running_updates'][getCurrentExtensionName()])) && (in_array($updateDepends, getExtensionUpdatesRunning()))) {
// Double-adding isn't fine, too
- debug_report_bug(__FUNCTION__ . '() called twice: updateDepends=' . $updateDepends . ',currentExtension=' . getCurrentExtensionName());
+ debug_report_bug(__FUNCTION__, __LINE__, '() called twice: updateDepends=' . $updateDepends . ',currentExtension=' . getCurrentExtensionName());
} // END - if
*/
// Init update depency map automatically if not found
if (isExtensionUpdateDependenciesInitialized()) {
// We need these bug reports as well...
- debug_report_bug(__FUNCTION__ . '() is called twice: currName=' . getCurrentExtensionName());
+ debug_report_bug(__FUNCTION__, __LINE__, '() is called twice: currName=' . getCurrentExtensionName());
} // END - if
$GLOBALS['ext_update_depends'][getCurrentExtensionName()] = array();
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Registration in progress: ext_name=' . $ext_name . ' - ENTERED!');
if (isExtensionRegistrationRunning($ext_name)) {
// This is really bad and should not be quietly ignored
- debug_report_bug(__FUNCTION__ . '() already called! ext_name=' . $ext_name);
+ debug_report_bug(__FUNCTION__, __LINE__, '() already called! ext_name=' . $ext_name);
} // END - if
// Then add it!