Exemple #1
0
Zend_Session::start();
$logger = Zend_Log::factory(array(array('writerName' => 'Stream', 'writerParams' => array('stream' => LOGS_PATH . '/testing.log'), 'filterName' => 'Priority', 'filterParams' => array('priority' => Zend_Log::DEBUG))));
Zend_Registry::set('logger', $logger);
// get the config properties
$configGlobal = new Zend_Config_Ini(APPLICATION_CONFIG, 'global', true);
$configGlobal->environment = 'testing';
Zend_Registry::set('configGlobal', $configGlobal);
$config = new Zend_Config_Ini(APPLICATION_CONFIG, 'testing');
Zend_Registry::set('config', $config);
// get database type
// for now only supporting MySQL, PostgreSQL, and SQLite
// get the database type from the existing config files
$testConfigDir = BASE_PATH . '/tests/configs/';
$dbTypes = getSqlDbTypes($testConfigDir);
foreach ($dbTypes as $dbType) {
    try {
        echo 'Dropping and installing tables for database type: ' . $dbType . PHP_EOL;
        $dbAdapter = loadDbAdapter($testConfigDir, $dbType);
        dropTables($dbAdapter, $dbType);
        require_once BASE_PATH . '/core/controllers/components/UtilityComponent.php';
        $utilityComponent = new UtilityComponent();
        installCore($dbAdapter, $dbType, $utilityComponent);
        createDefaultAssetstore();
        installModules($utilityComponent);
        releaseLock($dbType);
    } catch (Zend_Exception $ze) {
        echo $ze->getMessage();
        exit(1);
    }
}
exit(0);
Exemple #2
0
}
if (isset($opt['clear-cache'])) {
    // clear cache
    $f = $opt['clear-cache'];
    $re = clearCache($dir, $f);
} else {
    // install modules
    $modules = [];
    // core
    $m_core = 'core';
    if (isset($opt['m-core'])) {
        if (!boolval($opt['m-core'])) {
            $m_core = '';
        }
    }
    if ($m_core) {
        array_push($modules, $m_core);
    }
    $modules = checkModules($opt, $modules);
    $re = installModules($modules, $dir);
    if ($re === 0) {
        echo "Install successfully!\n";
        // unmask
        $out = [];
        exec('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'maskphp.php' . " -d {$dir} --unmask", $out);
        foreach ($out as $l) {
            echo "{$l}\n";
        }
    }
}
exit($re);