systemConfig['Database']['DBCollation']) {
- // it is CREATE TABLE statement -> add collation
- $sql .= ' COLLATE \''.$this->systemConfig['Database']['DBCollation'].'\'';
- }
-
- $this->Conn->Query($sql);
- if ($this->Conn->getErrorCode() != 0) {
- $this->errorMessage = 'Error: ('.$this->Conn->getErrorCode().') '.$this->Conn->getErrorMsg().'
Database Query:'.htmlspecialchars($sql).'
';
- $this->LastQueryNum = $i+1;
- return false;
- }
- }
- return true;
- }
-
- function ImportLanguage($lang_file)
- {
- $lang_file = FULL_PATH.$lang_file.'.lang';
- if (!file_exists($lang_file)) {
- return ;
- }
-
- $lang_xml =& $this->Application->recallObjectP('LangXML', null, Array(), false); // false - don't use temp tables
- $lang_xml->Parse($lang_file, '|0|1|2|', '');
- }
-
- /**
* Returns modules list found in modules folder
*
* @return Array
@@ -859,34 +1030,19 @@
}
// this is folder in MODULES_PATH directory
if (file_exists($folder_path.'/install.php') && file_exists($folder_path.'/install/install_schema.sql')) {
- $modules[] = $sub_folder;
+ $install_order = trim( file_get_contents($folder_path . '/install/install_order.txt') );
+ $modules[$install_order] = $sub_folder;
}
}
}
}
+ // allows to control module install order
+ ksort($modules, SORT_NUMERIC);
return $modules;
}
/**
- * Converts module version in format X.Y.Z to signle integer
- *
- * @param string $version
- * @return int
- */
- function ConvertModuleVersion($version)
- {
- $parts = explode('.', $version);
-
- $bin = '';
- foreach ($parts as $part) {
- $bin .= str_pad(decbin($part), 8, '0', STR_PAD_LEFT);
- }
-
- return bindec($bin);
- }
-
- /**
* Returns list of modules, that can be upgraded
*
*/
@@ -909,11 +1065,11 @@
}
$to_version = end($regs[1]);
- $this_version = $this->ConvertModuleVersion($module_info['Version']);
- if ($this->ConvertModuleVersion($to_version) > $this_version) {
+ $this_version = $this->toolkit->ConvertModuleVersion($module_info['Version']);
+ if ($this->toolkit->ConvertModuleVersion($to_version) > $this_version) {
// destination version is greather then current
foreach ($regs[1] as $version) {
- if ($this->ConvertModuleVersion($version) > $this_version) {
+ if ($this->toolkit->ConvertModuleVersion($version) > $this_version) {
$from_version = $version;
break;
}
@@ -924,7 +1080,7 @@
'ToVersion' => $to_version,
);
- $ret[$module_name] = array_merge_recursive2($module_info, $version_info);
+ $ret[ strtolower($module_name) ] = array_merge_recursive2($module_info, $version_info);
}
}
@@ -1091,80 +1247,6 @@
return $ret;
}
- function ParseConfig($parse_section = false)
- {
- if (!file_exists($this->INIFile)) {
- return Array();
- }
-
- if( file_exists($this->INIFile) && !is_readable($this->INIFile) ) {
- die('Could Not Open Ini File');
- }
-
- $contents = file($this->INIFile);
-
- $retval = Array();
- $section = '';
- $ln = 1;
- $resave = false;
- foreach ($contents as $line) {
- if ($ln == 1 && $line != '<'.'?'.'php die() ?'.">\n") {
- $resave = true;
- }
-
- $ln++;
- $line = trim($line);
- $line = eregi_replace(';[.]*','',$line);
- if (strlen($line) > 0) {
- //echo $line . " - ";
- if(eregi('^[[a-z]+]$',str_replace(' ', '', $line))) {
- //echo 'section';
- $section = mb_substr($line, 1, (mb_strlen($line) - 2));
- if ($parse_section) {
- $retval[$section] = array();
- }
- continue;
- } elseif (eregi('=',$line)) {
- //echo 'main element';
- list ($key, $val) = explode(' = ', $line);
- if (!$parse_section) {
- $retval[trim($key)] = str_replace('"', '', $val);
- }
- else {
- $retval[$section][trim($key)] = str_replace('"', '', $val);
- }
- }
- }
- }
-
- if ($resave) {
- $fp = fopen($this->INIFile, 'w');
- reset($contents);
- fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
- foreach ($contents as $line) {
- fwrite($fp,"$line");
- }
- fclose($fp);
- }
-
- return $retval;
- }
-
- function SaveConfig()
- {
- $fp = fopen($this->INIFile, 'w');
- fwrite($fp,'<'.'?'.'php die() ?'.">\n\n");
-
- foreach ($this->systemConfig as $section_name => $section_data) {
- fwrite($fp, '['.$section_name."]\n");
- foreach ($section_data as $key => $value) {
- fwrite($fp, $key.' = "'.$value.'"'."\n");
- }
- fwrite($fp, "\n");
- }
- fclose($fp);
- }
-
/**
* Installation error handler for sql errors
*
@@ -1197,11 +1279,4 @@
}
}
}
-
- /*function print_pre($s)
- {
- echo '', print_r($s, true). '
';
- }*/
-
-
?>
\ No newline at end of file