Example #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;
 }
Example #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;
 }
Example #3
0
         if (!$error) {
             defined('IA_SALT') || define('IA_SALT', $salt);
             $iaUsers = iaHelper::loadCoreClass('users', 'core');
             $iaUsers->changePassword(array('id' => 1), iaHelper::getPost('admin_password'), false);
             iaHelper::cleanUpCacheContents();
             $iaTemplate->install(iaTemplate::SETUP_INITIAL);
             // writing it to the system log
             $iaLog = iaHelper::loadCoreClass('log', 'core');
             $iaLog->write(iaLog::ACTION_INSTALL, array('type' => 'app'));
         }
         if (!$error && $builtinPlugins) {
             $pluginsFolder = IA_HOME . 'plugins' . IA_DS;
             foreach ($builtinPlugins as $pluginName) {
                 $installationFile = file_get_contents($pluginsFolder . $pluginName . IA_DS . iaHelper::INSTALLATION_FILE_NAME);
                 if ($installationFile !== false) {
                     $iaExtrasInstaller = iaHelper::loadCoreClass('extra');
                     $iaExtrasInstaller->setXml($installationFile);
                     $iaExtrasInstaller->parse();
                     if (!$iaExtrasInstaller->getNotes()) {
                         $result = $iaExtrasInstaller->install();
                     }
                 }
             }
         }
     }
     $template = iaHelper::getPost('tmpl', $template);
 }
 $iaOutput->errorList = $errorList;
 $iaOutput->template = $template;
 $iaOutput->templates = $templates;
 break;
     }
     $patchParser = new iaPatchParser($patchFileContent);
     $patch = $patchParser->patch;
     if ($patch['info']['version_from'] != str_replace('.', '', IA_VERSION)) {
         throw new Exception('Patch is not applicable to your version of Subrion CMS.');
     }
     $patchApplier = new iaPatchApplier(IA_HOME, array('host' => INTELLI_DBHOST . ':' . INTELLI_DBPORT, 'database' => INTELLI_DBNAME, 'user' => INTELLI_DBUSER, 'password' => INTELLI_DBPASS, 'prefix' => INTELLI_DBPREFIX), in_array('force-mode', $options));
     $patchApplier->process($patch, $_SESSION['upgrade_to']);
     $textLog = $patchApplier->getLog();
     $logFile = 'upgrade-log-' . $patch['info']['version_to'] . '_' . date('d-m-y-Hi') . '.txt';
     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();
 }
Example #5
0
require_once 'ia.helper.php';
require_once 'ia.output.php';
$modulesPath = IA_INSTALL . 'modules' . IA_DS;
if (is_dir($modulesPath)) {
    if ($directory = opendir($modulesPath)) {
        while ($file = readdir($directory)) {
            $pos = strpos($file, 'module.');
            if ($pos !== false && $pos == 0) {
                list(, $mod, ) = explode('.', $file);
                switch ($mod) {
                    case 'install':
                        $modules[] = $mod;
                        break;
                    case 'upgrade':
                        if (iaHelper::isScriptInstalled()) {
                            $iaUsers = iaHelper::loadCoreClass('users', 'core');
                            if ($mod == $module || iaUsers::hasIdentity() && iaUsers::MEMBERSHIP_ADMINISTRATOR == iaUsers::getIdentity()->usergroup_id) {
                                $modules[] = $mod;
                            }
                        }
                        break;
                    default:
                        $modules[] = $mod;
                }
            }
        }
        closedir($directory);
    }
}
if (empty($modules)) {
    header('HTTP/1.0 403');