./inc/extensions/ext-rallye.php:94: // @TODO Fix config_rallye_prices to list_rallye_prices
./inc/extensions/ext-yoomedia.php:121: // @TODO Can this be moved into a database table?
./inc/extensions/ext-yoomedia.php:54:// @TODO Only deprecated when 'ext-network' is ready! setExtensionDeprecated('Y');
-./inc/extensions-functions.php:2012:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
-./inc/extensions-functions.php:421: // @TODO This redirect is still needed to register sql_patches! Please try to avoid it
-./inc/extensions-functions.php:437:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
-./inc/extensions-functions.php:577: // @TODO Extension is loaded, what next?
+./inc/extensions-functions.php:2038:// @TODO This should be rewrittten to allow, more development states, e.g. 'planing','alpha','beta','beta2','stable'
+./inc/extensions-functions.php:424: // @TODO This redirect is still needed to register sql_patches! Please try to avoid it
+./inc/extensions-functions.php:440:// @TODO Change from ext_id to ext_name (not just even the variable! ;-) )
+./inc/extensions-functions.php:580: // @TODO Extension is loaded, what next?
./inc/filter/bonus_filter.php:56: // @TODO This query isn't right, it will only update if the user was for a longer time away!
./inc/filter/cache_filter.php:94: // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
./inc/filter/forced_filter.php:73: // @TODO This part is unfinished
./inc/functions.php:1082: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
./inc/functions.php:1168: // @TODO Are these convertions still required?
./inc/functions.php:1189:// @TODO Rewrite this function to use readFromFile() and writeToFile()
-./inc/functions.php:1810: // @TODO Find a way to cache this
-./inc/functions.php:1915: // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2119: // @TODO Rename column data_type to e.g. mail_status
+./inc/functions.php:1712: // @TODO Find a way to cache this
+./inc/functions.php:1817: // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2021: // @TODO Rename column data_type to e.g. mail_status
./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
./inc/header.php:66:// @TODO Find a way to not use direct module comparison
./inc/install-functions.php:91: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0);
./inc/modules/member/what-unconfirmed.php:169: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
./inc/modules/member/what-unconfirmed.php:234: // @TODO This 'userid' cannot be saved because of encapsulated EL code
./inc/modules/order.php:78: // @TODO Unused: 2,4
-./inc/mysql-manager.php:1424: // @TODO Rewrite these lines to a filter
-./inc/mysql-manager.php:1448: // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1704: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1421: // @TODO Rewrite these lines to a filter
+./inc/mysql-manager.php:1445: // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1701: // @TODO Rewrite this to a filter
./inc/mysql-manager.php:390: // @TODO Try to rewrite this to one or more functions
./inc/mysql-manager.php:44:// @TODO Can we cache this?
./inc/purge/purge-inact.php:55: // @TODO Rewrite these if() blocks to a filter
./inc/template-functions.php:285: // @TODO Remove these sanity checks if all is fine
./inc/template-functions.php:598:// @TODO $simple/$constants are deprecated
./inc/template-functions.php:696: // @TODO $userid is deprecated and should be removed from loadEmailTemplate() and replaced with $content[userid] in all templates
-./inc/wrapper-functions.php:2916: // @TODO Find a way to not use direct module comparison
+./inc/wrapper-functions.php:2956: // @TODO Find a way to not use direct module comparison
./inc/wrapper-functions.php:494:// @TODO Do some more sanity check here
./inc/xml-functions.php:208: // @TODO Handle characters
./mailid.php:102: // @TODO Rewrite this to a filter
} // END - if
// Load the extension and maybe found language and function files.
-function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $isDryRun = false) {
+function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $isDryRun = false, $previousExtension = NULL) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',ext_mode=' . $ext_mode . ',ext_ver=' . $ext_ver . ',isDryRun=' . intval($isDryRun) . ' - ENTERED!');
// 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?
// Make sure this situation can only happen once
$GLOBALS['loaded_extension'][$ext_name][$ext_mode] = true;
+ // Remember previous extension here
+ $GLOBALS['previous_extension'][$ext_name] = $previousExtension;
+
// Set extension mode
setExtensionMode($ext_mode);
}
// Registers an extension and possible update dependencies
-function registerExtension ($ext_name, $taskId, $isDryRun = false, $ignoreUpdates = false) {
+function registerExtension ($ext_name, $taskId, $isDryRun = false, $ignoreUpdates = false, $previousExtension = NULL) {
// Set current extension name
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',taskId=' . intval($taskId) . ',isDryRun=' . intval($isDryRun) . ',ignoreUpdates=' . intval($ignoreUpdates) . ' - ENTERED!');
setCurrentExtensionName($ext_name);
// Is it still zero?
if ((is_null($taskId)) || ($taskId == '0')) {
// Then request a bug report
- reportBug(__FUNCTION__, __LINE__, sprintf("%s: task_id is still zero after determineExtensionTaskId(%s)",
+ reportBug(__FUNCTION__, __LINE__, sprintf("%s: task_id is still zero after determineExtensionTaskId/createNewExtensionTask(%s)",
__FUNCTION__,
getCurrentExtensionName()
));
// Does this extension exists?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ' - CALLING loadExtension() ...');
- if (loadExtension(getCurrentExtensionName(), 'register', '0.0.0', isExtensionDryRun())) {
+ if (loadExtension(getCurrentExtensionName(), 'register', '0.0.0', isExtensionDryRun(), $previousExtension)) {
// Set current extension name again
setCurrentExtensionName($ext_name);
foreach ($history as $ext_ver) {
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . getCurrentExtensionName() . ', ext_ver=' . $ext_ver);
// Load extension in update mode
- loadExtension(getCurrentExtensionName(), 'update', $ext_ver, isExtensionDryRun());
+ loadExtension(getCurrentExtensionName(), 'update', $ext_ver, isExtensionDryRun(), $previousExtension);
// Add update notes to our output
addExtensionNotes($ext_ver);
// Check if extension is not installed and not already in registration procedure and if loading it wents finally fine...
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . $ext_name . ',isExtensionRegistrationRunning(' . $ext_update . ')=' . intval(isExtensionRegistrationRunning($ext_update)));
- if ((!isExtensionInstalled($ext_update)) && (!isExtensionRegistrationRunning($ext_update)) && (loadExtension($ext_update, 'test', '', isExtensionDryRun()))) {
+ if ((!isExtensionInstalled($ext_update)) && (!isExtensionRegistrationRunning($ext_update)) && (loadExtension($ext_update, 'test', '', isExtensionDryRun(), $previousExtension))) {
// Set current extension name again
setCurrentExtensionName($ext_name);
if (($updateTaskId > 0) || (isInstallationPhase())) {
// Try to register the extension
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'currName=' . getCurrentExtensionName() . ',ext_update=' . $ext_update . ',updateTaskId=' . $updateTaskId . ',isExtensionDryRun()=' . intval(isExtensionDryRun()));
- $processResult = registerExtension($ext_update, $updateTaskId, isExtensionDryRun(), true);
+ $processResult = registerExtension($ext_update, $updateTaskId, isExtensionDryRun(), true, $ext_name);
// Reset extension name
setCurrentExtensionName($ext_name);
$GLOBALS['ext_sqls'][getCurrentExtensionName()][getCurrentExtensionVersion()] = array();
} // END - if
+ // Is the SQL statement empty?
+ if (empty($sql)) {
+ /*
+ * Abort here as this may happen if getExtensionMode() is 'activate' or
+ * 'deactivate'. This means that for 'mode' are no SQL statements
+ * specified.
+ */
+ return;
+ } // END - if
+
// Add it
- //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . getCurrentExtensionName() . ',ext_version=' . getCurrentExtensionVersion() . ',sql=' . $sql);
+ /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'ext_name=' . getCurrentExtensionName() . ',ext_version=' . getCurrentExtensionVersion() . ',sql=' . $sql);
array_push($GLOBALS['ext_sqls'][getCurrentExtensionName()][getCurrentExtensionVersion()], $sql);
}
// Register a filter
registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'TESTER_USER_REGISTRATION_ADD_SQL_COLUMNS', false, true, isExtensionDryRun());
- // This depends on ext-register
- addExtensionDependency('register');
-
// Update notes (these will be set as task text!)
setExtensionUpdateNotes("Filter zum Hinzufügen von SQL-Spalten für die Mitgliederanmeldung hinzugefügt.");
break;
$add = '';
// Is the extension equal or newer 0.8.9?
- if ((getExtensionMode() == 'register') || (getExtensionMode() == 'update') || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
+ if (((isInstallationPhase()) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (isExtensionInstalledAndNewer('sql_patches', '0.8.9'))) {
// Then add provider
$add = " AND `account_provider`='EXTENSION'";
} // END - if
// Is the 'subject' there?
if (((!ifSqlTableExists('points_data')) && ((getExtensionMode() == 'register') || (getExtensionMode() == 'update'))) || (countSumTotalData($subject, 'points_data', 'id', 'subject', true, $add) == 0)) {
- // Not found so add an SQL query
+ // Not found so:
+ if (isset($GLOBALS['previous_extension'][getCurrentExtensionName()])) {
+ $dummy = $GLOBALS['previous_extension'][getCurrentExtensionName()];
+ reportBug(__FUNCTION__, __LINE__, 'previous_extension[' . gettype($dummy) . ']=' . $dummy . ',getCurrentExtensionName()=' . getCurrentExtensionName() . ' - Under development, please report this!');
+ } // END - if
+
+ // ... add an SQL query
addExtensionSql(sprintf("INSERT INTO `{?_MYSQL_PREFIX?}_points_data` (`subject`,`column_name`,`locked_mode`,`payment_method`) VALUES ('%s','%s','%s','%s')",
$subject,
$columnName,
return floatval($floatString);
}
+/**
+ * Searches a multi-dimensional array (as used in many places) for given
+ * key/value pair as taken from user comments from PHP documentation website.
+ *
+ * @param $array An array with one or more dimensions
+ * @param $key Key to look for
+ * @param $valur Value to look for
+ * @return $results Resulted array or empty array if $array is no array
+ * @author sunelbe<at>gmail<dot>com
+ * @link http://de.php.net/manual/en/function.array-search.php#110120
+ */
+function search_array ($array, $key, $value) {
+ // Init array result
+ $results = array();
+
+ // Is $array really an array?
+ if (is_array($array)) {
+ // Does key and value match?
+ if (isset($array[$key]) && $array[$key] == $value) {
+ // Then add it as result
+ $results[] = $array;
+ } // END - if
+
+ // Search for whole array
+ foreach ($array as $subArray) {
+ // Search recursive and merge again
+ $results = merge_array($results, search_array($subArray, $key, $value));
+ } // END - foreach
+ } // END - if
+
+ // Return resulting array
+ return $results;
+}
+
// Generates a YES/NO option list from given default
function generateYesNoOptions ($defaultValue = '') {
// Generate it