21 return 'Upgrade path folder is not defined';
39 return file_get_contents (
$sFile);
45 return 'Upgrade path folder is not defined';
53 return 'Upgrade path folder is not defined';
65 return 'Upgrade path folder is not defined';
73 return 'Upgrade path folder is not defined';
81 $aModule = $this->oDb->getRow (
"SELECT * FROM `sys_modules` WHERE `uri` = '$sModule' LIMIT 1");
85 'from' => array (
'[db_prefix]'),
86 'to' => array (
$aModule[
'db_prefix']),
90 $mixedResult = $this->oDb->executeSQL (
$sFile, $aReplace);
92 if (
true === $mixedResult)
95 if (!is_array($mixedResult))
99 foreach ($mixedResult
as $a)
100 $s .=
"<b>{$a['query']}</b>: {$a['error']} <br />";
107 return 'Upgrade path folder is not defined';
110 foreach ($aLangs
as $sLang) {
127 $iLanguageId = (int)$this->oDb->getOne(
"SELECT `ID` FROM `sys_localization_languages` WHERE `Name`='$sLang' LIMIT 1");
132 $aModule = $this->oDb->getRow (
"SELECT * FROM `sys_modules` WHERE `uri` = '$sModule' LIMIT 1");
136 $sModuleConfigFile = CH_DIRECTORY_PATH_MODULES .
$aModule[
'path'] .
'install/config.php';
137 require ($sModuleConfigFile);
138 $iCategoryId = $this->oDb->getOne (
"SELECT `ID` FROM `sys_localization_categories` WHERE `Name`='" .
$aConfig[
'language_category'] .
"' LIMIT 1");
139 if (!$iCategoryId &&
$aConfig[
'language_category']) {
140 if ($this->oDb->query (
"INSERT INTO `sys_localization_categories` SET `Name`='" .
$aConfig[
'language_category'] .
"'"))
141 $iCategoryId = $this->oDb->lastId();
143 return "Can not determine or create language category ID";
150 $aLangKey = $this->oDb->getRow(
"SELECT `ID`, `IDCategory` FROM `sys_localization_keys` WHERE `Key`='" . $this->oDb->escape($sKey) .
"' LIMIT 1");
151 $iLangKeyId = isset($aLangKey[
'ID']) && (int)$aLangKey[
'ID'] ? (
int)$aLangKey[
'ID'] :
false;
153 if (!$this->oDb->query(
"INSERT INTO `sys_localization_keys`(`IDCategory`, `Key`) VALUES('$iCategoryId', '" . $this->oDb->escape($sKey) .
"')"))
155 $iLangKeyId = $this->oDb->lastId();
157 $iLangKeyCat = isset($aLangKey[
'IDCategory']) && (int)$aLangKey[
'IDCategory'] ? (
int)$aLangKey[
'IDCategory'] : 0;
158 if ($iLangKeyCat != $iCategoryId)
159 $this->oDb->query(
"UPDATE `sys_localization_keys` SET `IDCategory` = '$iCategoryId' WHERE `Key` = '" . $this->oDb->escape($sKey) .
"' LIMIT 1");
161 $this->oDb->res(
"DELETE FROM `sys_localization_strings` WHERE `IDKey` = '$iLangKeyId' AND `IDLanguage` = '$iLanguageId'");
162 $this->oDb->res(
"INSERT INTO `sys_localization_strings`(`IDKey`, `IDLanguage`, `String`) VALUES('$iLangKeyId', '$iLanguageId', '" . $this->oDb->escape($sValue) .
"')");
172 if (!($h = opendir($sDir)))
176 while (
false !== (
$sFile = readdir($h))) {
180 if ($sLang != $this->oDb->getOne(
"SELECT `Name` FROM `sys_localization_languages` WHERE `Name` = '$sLang' LIMIT 1"))
200 while (
false !== (
$sModule = readdir($h))) {
203 if (
$sModule != $this->oDb->getOne(
"SELECT `uri` FROM `sys_modules` WHERE `uri` = '$sModule' LIMIT 1"))
219 if (!preg_match(
'/^[A-Za-z0-9\.\-]+$/',
$sFolder) || !file_exists($sFullPath))
220 return 'Upgrade path was not found';
237 while (
false !== (
$sFolder = readdir($h))) {