PHP: | '.$this->_checkPhpVersion().' | '; $this->_content .= '
---|---|
IonCube Loader: | '.$this->_checkIoncubeStatus().' | '; $this->_content .= '
' . $this->t('step1.permissions') . ': | '.$this->_checkDirStatus().' | '; $this->_content .= '
' . $this->t('failure'). '.
'; $this->_footer .= ''."\r\n"; } } private function _checkIoncubeStatus() { $version = ioncube_loader_version(); if (version_compare(self::MIN_IONCUBE_VERSION, $version) >= 0) { return $this->_wrapError($version . ' — ' . $this->t('step1.min_version'). ''); } else { return $this->_wrapSuccess($version); } } private function _checkDirStatus() { if (!is_writeable('./')){ $this->_stepStatus = false; return $this->_wrapError($this->t('step1.dir_isnt_writable')); } else { return $this->_wrapSuccess($this->t('step1.dir_is_writable')); } } private function _checkPhpVersion() { if (version_compare(phpversion(), '5.4') > 0) { return $this->_wrapSuccess(phpversion()); } else { $this->_stepStatus = false; return $this->_wrapError( phpversion() . ' — ' . $this->t('step1.php_error')); } } private function _wrapSuccess($text) { return '' . $this->t('failure'). '.
'; $this->_footer .= ''."\r\n"; } } private function _stepDowngrade() { $this->_title = $this->t('downgrade.title'); $this->_downloadPackage(6); $remove = array( 'lib/Keitaro/Json.php', 'application/redirects/AbstractRedirect.php', 'application/redirects/AbstractRedirect2.php', 'application/redirects/BaseRedirect.php', 'application/redirects/campaign.php', 'application/redirects/frame.php', 'application/redirects/http.php', 'application/redirects/stream.php', 'application/redirects/sub_id.php', 'application/macros/os.php', 'application/macros/AbstractMacros.php', 'application/macros/BaseMacros.php', 'application/macros/country_name.php', 'application/macros/country.php', 'application/macros/operator.php', 'application/macros/operator_name.php', 'application/macros/region.php', 'application/macros/region_name.php', 'application/macros/campaign_id.php', 'application/macros/random.php', ); foreach ($remove as $file) { if (file_exists($file)) { unlink($file); } } $this->_connect(); $sql = 'UPDATE ' . $this->_cnf['db']['prefix']. 'streams SET redirect_type = "group" WHERE redirect_type = "campaign"'; @mysql_query($sql); if ($this->_stepStatus) { $this->_content = $this->t('downgrade.content'); $this->_footer .= '' . $this->t('continue'). ''."\r\n"; } else { $this->_footer .= '' . $this->t('failure'). '.
'; $this->_footer .= ''."\r\n"; } } private function _downloadPackage($version) { @set_time_limit(180); $package = $this->_findPackage($version); $localPackage = 'package.pack'; if (!file_exists($localPackage)) { if (!ini_get('allow_url_fopen')){ if (function_exists('curl_init')) { $ch = curl_init($package); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, 0); $content = curl_exec($ch); if ($error = curl_error($ch)) { $this->_stepStatus = false; $this->_content .= 'ВНИМАНИЕ! Обязательно сделайте бекап текущей TDS и базы данных.
До завершения всех миграций в базе данных, TDS не будет принимать трафик. Поэтому рекомендуем остановить или куда-нибудь перенаправить трафик. Также, возможна потеря некоторых-то данных из статистики.
Успешность обновления сильно зависит от объемов базы данных. Максимально очистите статистику перед обновлением.
', ), 'upgrade' => array( 'title' => 'Обновление', 'content' => 'Обновление файлов завершено.
Удалите файл upgrader7.php
Затем авторизуйтесь в Keitaro, зайти на страницу "Обслуживание > Миграции" и запустить процесс миграции базы.
', ), 'downgrade' => array( 'title' => 'Откат', 'content' => 'Замена файлов завершена.
Пожалуйста, напишите нам на feedback@keitaro.io по какой причине вы вынуждены были сделать откат.
Не забудьте удалить файл upgrader7.php
', ), 'failure' => 'Обнаружена несовместимость', 'documentation' => 'Инструкция и решение проблем по обновлению на версию 7', 'do' => 'Выполнить', 'continue' => 'Продолжить', 'retry' => 'Повторить проверку' ), 'en' => array( 'main_title' => 'Keitaro 7 Update', 'step1' => array( 'title' => 'Compatibility check', 'php_error' => 'required version 5.4 or newer', 'min_version' => 'Required 4.6 or higher', 'permissions' => 'Writable permissions', 'dir_isnt_writable' => 'No allowed', 'dir_is_writable' => 'Allowed', 'operation' => 'What to do?', 'upgrade' => 'Update to Keitaro 7', 'downgrade' => 'Downgrade to Keitaro 6', 'warning' => 'WARNING! Make sure that you made a backup. You might want to downgrade.
TDS won\'t work until all migrations complete. Strongly suggest switching off traffic while updating.
', ), 'upgrade' => array( 'title' => 'Update', 'content' => 'Files updated.
Remove file upgrader7.php
.
Then sign in to Keitaro and go to page "Maintenance > Migrations". Press "Run migrations" there.
', ), 'downgrade' => array( 'title' => 'Downgrade', 'content' => 'Files restored.
Please tell us about the reason of downgrade to feedback@keitarotds.com
Do not forger to remove upgrader7.php
', ), 'failure' => 'Failure', 'documentation' => 'Instructions on update Keitaro 7.', 'do' => 'Continue', 'continue' => 'Continue', 'retry' => 'Retry' ) ); protected static $_language; protected static $_languages = array('ru', 'en'); const DEFAULT_LANGUAGE = 'ru'; public static function setPreferredLanguage($lang) { if (!in_array($lang, self::$_languages)) { throw new Exception('Language ' . $lang . ' not exists'); } setcookie('installer_lang', $lang); $_COOKIE['installer_lang'] = $lang; } public static function getPreferredLanguage() { if (isset($_COOKIE['installer_lang'])) { $lang = $_COOKIE['installer_lang']; } else { if (strstr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 'en')) { $lang = 'en'; } if (strstr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 'ru')) { $lang = 'ru'; } } if (!in_array($lang, self::$_languages)) { $lang = self::DEFAULT_LANGUAGE; } return $lang; } public static function get($key, $params = null) { $path = explode('.', $key); $data = self::$_data[self::getPreferredLanguage()]; $translation = self::_find($path, $data); if (!isset($translation)) { $translation = $key; } if ($params) { if (!is_array($params)) { $params = array($params); } $args = array_merge(array($translation), $params); $translation = call_user_func_array('sprintf', $args); } return $translation; } public static function t($key, $params = null) { return KLocale::get($key, $params); } protected static function _find($path, $data) { $key = array_shift($path); if (!isset($data[$key])) { return null; } if (count($path)) { return self::_find($path, $data[$key]); } return $data[$key]; } } $Installer = new Upgrader7(); $Installer->setTemplate(ob_get_contents()); ob_clean(); $Installer->dispatch();