$file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
// Does this extension exists?
- if (file_exists($file) && is_readable($file))
+ if (FILE_READABLE($file))
{
// Extension was found so we can load it in registration mode
require($file);
$file = sprintf("%sinc/extensions/ext-%s.php", PATH, $EXT_UPDATE_DEPENDS);
// Check for required file
- if (file_exists($file) && is_readable($file))
+ if (FILE_READABLE($file))
{
// File exists so let's load it
$VER_BACKUP = $EXT_VERSION;
global $cacheInstance;
$SQLs = array();
+ // By default no SQL has been executed
+ $sqlRan = false;
+
// This shall never do a non-admin user!
if (!IS_ADMIN()) return false;
if (empty($ext_name)) return false;
// Load extension in detected mode
+ //* DEBUG: */ echo __FUNCTION__.":ext_name[{$id}]={$ext_name}<br />\n";
$file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
- if (file_exists($file) && is_readable($file)) require($file);
+ if (FILE_READABLE($file)) {
+ // Load the include
+ require($file);
+ }
+ //* DEBUG: */ echo __FUNCTION__.":SQLs::count=".count($SQLs)."<br />\n";
if ((is_array($SQLs) && (sizeof($SQLs) > 0))) {
// Run SQL commands...
foreach ($SQLs as $sql) {
// Is there still an SQL query?
if (!empty($sql)) {
// Do we have an "ALTER TABLE" command?
+ //* DEBUG: */ echo __FUNCTION__.":SQL={$SQL}<br />\n";
if (substr(strtolower($sql), 0, 11) == "alter table") {
// Analyse the alteration command
SQL_ALTER_TABLE($sql, __FILE__, __LINE__);
// Run regular SQL command
$result = SQL_QUERY($sql, __FILE__, __LINE__, false);
}
+
+ // An SQL has been executed
+ $sqlRan = true;
} // END - if
} // END - foreach
array($id), __FILE__, __LINE__);
} // END - if
+ //* DEBUG: */ echo __FUNCTION__.":mode={$EXT_LOAD_MODE}<br />\n";
+
// Remove cache file(s) if extension is active
- if ((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) {
+ if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1) && ($EXT_LOAD_MODE == "remove")) || ($sqlRan === true))) {
//* DEBUG: */ echo __LINE__.": DESTROY!<br />\n";
// Remove cache files
if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy();
// Extension's file name will also be checked
$file = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
- if ((!file_exists($file)) && (!is_readable($file))) return false;
+ if (!FILE_READABLE($file)) return false;
//* DEBUG: */ echo "*".$ext_name."(".count($cacheArray).")<br />";
// Not active is the default
(
$active == "Y"
) && (
- file_exists($inc)
- ) && (
- is_readable($inc)
+ FILE_READABLE($inc)
)
);
}
// Extensions are all inactive during installation
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return "";
+ //* DEBUG: */ echo __FUNCTION__.": ext_name={$ext_name}<br />\n";
// Is the cache written?
if (!empty($cacheArray['extensions']['ext_version'][$ext_name])) {
// Load data from cache
+ //* DEBUG: */ echo __FUNCTION__.": CACHE!<br />\n";
$ret = $cacheArray['extensions']['ext_version'][$ext_name];
// Count cache hits
// Set cache
$cacheArray['extensions']['ext_version'][$ext_name] = $ret;
}
+
+ // Return result
+ //* DEBUG: */ echo __FUNCTION__.": ret={$ret}<br />\n";
return $ret;
}
//