示例#1
0
 protected function _prepareDbDump()
 {
     if (file_exists($this->_dumpFilePath) && filesize($this->_dumpFilePath) > 0) {
         return true;
     }
     $iaDbControl = iaHelper::loadCoreClass('dbcontrol');
     $tablesList = $iaDbControl->getTables();
     if (empty($tablesList)) {
         $this->messages[] = 'Could not get the list of DB tables to dump.';
         return false;
     }
     $sqlDump = '';
     foreach ($tablesList as $tableName) {
         $sqlDump .= $iaDbControl->makeFullBackup($tableName, true);
     }
     $result = (bool) file_put_contents($this->_dumpFilePath, $sqlDump);
     $result || ($this->messages[] = 'Could not write DB dump file.');
     return $result;
 }
示例#2
0
 protected function _prepareDbDump()
 {
     if (file_exists($this->_dumpFilePath) && filesize($this->_dumpFilePath) > 0) {
         return true;
     }
     $iaDbControl = iaHelper::loadCoreClass('dbcontrol');
     $tablesList = $iaDbControl->getTables();
     if (empty($tablesList)) {
         $this->messages[] = 'Could not get the list of DB tables to dump.';
         return false;
     }
     $sqlDump = '';
     $onlyStructureExceptions = array('online');
     foreach ($tablesList as $tableName) {
         $sqlDump .= $iaDbControl->makeStructureBackup($tableName, true) . PHP_EOL;
         in_array(str_replace(INTELLI_DBPREFIX, '', $tableName), $onlyStructureExceptions) || ($sqlDump .= $iaDbControl->makeDataBackup($tableName) . PHP_EOL);
         $sqlDump .= PHP_EOL;
     }
     $result = (bool) file_put_contents($this->_dumpFilePath, $sqlDump);
     $result || ($this->messages[] = 'Could not write DB dump file.');
     return $result;
 }
示例#3
0
        $iaOutput->errorList = $errorList;
        $iaOutput->template = $template;
        $iaOutput->templates = $templates;
        break;
    case 'download':
        if (class_exists('iaCore')) {
            iaCore::instance()->iaView->set('nodebug', true);
        }
        header('Content-Type: text/x-delimtext; name="config.inc.php"');
        header('Content-disposition: attachment; filename="config.inc.php"');
        echo get_magic_quotes_gpc() ? stripslashes($_POST['config_content']) : $_POST['config_content'];
        exit;
    case 'plugins':
        if (iaHelper::isAjaxRequest()) {
            if (isset($_POST['plugin']) && $_POST['plugin']) {
                echo iaHelper::installRemotePlugin($_POST['plugin']) ? 'installed successfully' : 'installation is not performed';
                exit;
            }
        } else {
            if ($plugins = iaHelper::getRemotePluginsList(IA_VERSION)) {
                $iaOutput->plugins = $plugins;
            } else {
                $message = 'Could not get the list of plugins.';
            }
        }
        break;
    default:
        return;
}
$iaOutput->error = $error;
$iaOutput->message = $message;
示例#4
0
 protected function _processExtras(array $entries)
 {
     foreach ($entries as $entry) {
         $friendlyName = ucfirst($entry['name']);
         if ($entry['type'] == self::EXTRA_TYPE_PLUGIN) {
             iaHelper::installRemotePlugin($entry['name']) ? $this->_logInfo('Installation of :name is successfully completed.', self::LOG_SUCCESS, array('name' => $friendlyName)) : $this->_logInfo('Unable to install :name due to errors.', self::LOG_ERROR, array('name' => $friendlyName));
         } else {
             $this->_logInfo('Installation of ":name" requested. Ignored since installation of this type is not currently implemented.', self::LOG_ALERT, array('name' => $friendlyName));
         }
     }
 }
示例#5
0
 public static function installRemotePlugin($pluginName)
 {
     $result = false;
     if ($pluginName) {
         $downloadPath = self::_composePath(array(IA_HOME, 'tmp', 'plugins'));
         if (!is_dir($downloadPath)) {
             mkdir($downloadPath);
         }
         $savePath = $downloadPath . $pluginName . '.plugin';
         if (!self::getRemoteContent(sprintf(self::PLUGINS_DOWNLOAD_SOURCE, $pluginName, IA_VERSION), $savePath)) {
             return false;
         }
         if (is_file($savePath)) {
             $extrasFolder = self::_composePath(array(IA_HOME, 'plugins'));
             if (is_writable($extrasFolder)) {
                 $pluginFolder = self::_composePath(array($extrasFolder, $pluginName));
                 if (is_dir($pluginFolder)) {
                     self::cleanUpDirectoryContents($pluginFolder);
                 } else {
                     mkdir($pluginFolder);
                 }
                 require_once self::_composePath(array(IA_HOME, 'includes', 'utils')) . 'pclzip.lib.php';
                 $zipSource = new PclZip($savePath);
                 if ($zipSource->extract(PCLZIP_OPT_PATH, $extrasFolder . $pluginName)) {
                     $installationFile = file_get_contents($pluginFolder . self::INSTALLATION_FILE_NAME);
                     if ($installationFile !== false) {
                         $iaExtra = self::loadCoreClass('extra');
                         $iaExtra->setXml($installationFile);
                         $iaExtra->parse();
                         if (!$iaExtra->getNotes()) {
                             $result = $iaExtra->install();
                         }
                     }
                 }
             }
             iaHelper::cleanUpDirectoryContents(IA_HOME . 'tmp' . IA_DS);
         }
     }
     return $result;
 }
示例#6
0
         if ($fh = fopen(IA_HOME . 'uploads' . IA_DS . $logFile, 'wt')) {
             fwrite($fh, $textLog);
             fclose($fh);
         }
         // log this event
         $iaLog = iaHelper::loadCoreClass('log', 'core');
         $iaLog->write(iaLog::ACTION_UPGRADE, array('type' => 'app', 'from' => IA_VERSION, 'to' => $_SESSION['upgrade_to'], 'file' => $logFile));
         //
         // processing the upgrade log to show nicely
         $textLog = htmlspecialchars($textLog);
         $textLog = str_replace(array(PHP_EOL, 'INFO', 'SUCCESS', 'ERROR', 'ALERT'), array('', '<p>', '<p><span class="label label-success">SUCCESS</span>', '<p><span class="label label-danger">ERROR</span>', '<p><span class="label label-warning">ALERT</span>'), $textLog);
         //
         $iaOutput->log = $textLog;
         // clean up cache files
         $tempFolder = IA_HOME . 'tmp' . IA_DS;
         iaHelper::cleanUpDirectoryContents($tempFolder);
         unset($_SESSION['upgrade_to']);
     } catch (Exception $e) {
         @unlink(IA_HOME . 'tmp' . IA_DS . 'patch.iap');
         $iaOutput->message = $e->getMessage();
     }
     break;
 case 'rollback':
     $iaOutput->steps = array('check' => 'Upgrade Wizard', 'rollback' => 'Rollback');
     $fileList = glob(IA_HOME . 'backup/backup_*_*.zip');
     $backups = array();
     if ($fileList) {
         foreach ($fileList as $fileName) {
             $fileName = basename($fileName);
             $array = explode('_', $fileName);
             if (3 == count($array)) {
示例#7
0
    exit('Forbidden.');
}
if (1 == count($modules)) {
    $module = $modules[0];
}
if ('welcome' == $module) {
    $url = URL_HOME . 'install' . IA_URL_DELIMITER;
    $url .= iaHelper::isScriptInstalled() ? 'upgrade' : 'install';
    $url .= IA_URL_DELIMITER;
    header('Location: ' . $url);
    exit;
}
if (!file_exists(IA_HOME . 'includes' . IA_DS . 'config.inc.php')) {
    // disallow upgrade module if no config file exists
    $modules = array_diff($modules, array('upgrade'));
    // set active module
    $module = 'install';
}
$iaOutput = new iaOutput(IA_INSTALL . 'templates/');
$iaOutput->module = $module;
$iaOutput->modules = $modules;
$iaOutput->step = $step;
require $modulesPath . 'module.' . $module . '.php';
if (!iaHelper::isAjaxRequest()) {
    if ($iaOutput->isRenderable($template = $module . '.' . $step)) {
        echo $iaOutput->render($template);
    } else {
        header('HTTP/1.0 500');
        die('Internal Server Error.');
    }
}