Exemple #1
0
if (isset($options['password'])) {
    $params['password'] = $options['password'];
}
if (isset($options['h'])) {
    $params['host'] = $options['h'];
}
if (isset($options['host'])) {
    $params['host'] = $options['host'];
}
if (isset($options['P'])) {
    $params['port'] = $options['P'];
}
if (isset($options['port'])) {
    $params['port'] = $options['port'];
}
$updateRunner = new ScriptsRunner();
$updateRunner->init($ignoreErrors, $params);
// create version_management table
$updateRunner->runSqlScript(dirname(__FILE__) . DIRECTORY_SEPARATOR . "create_version_mng_table.sql");
if (!$skipDB) {
    $sqlDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "sql";
    $updateRunner->runSqlScripts($sqlDir);
}
if (!$skipScripts) {
    $phpDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "scripts";
    $updateRunner->runPhpScripts($phpDir);
}
exit(0);
class ScriptsRunner
{
    private $dbParams = array();
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "bootstrap.php";
//define('KALTURA_ROOT_PATH', realpath(dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR.".."));
//define('KALTURA_INFRA_PATH', KALTURA_ROOT_PATH.DIRECTORY_SEPARATOR."infra");
//require_once(KALTURA_INFRA_PATH.DIRECTORY_SEPARATOR."kConf.php");
ini_set("memory_limit", "512M");
error_reporting(E_ALL);
//require_once(KALTURA_INFRA_PATH.DIRECTORY_SEPARATOR."KAutoloader.php");
KAutoloader::addClassPath(KAutoloader::buildPath(KALTURA_ROOT_PATH, "vendor", "ZendFramework", "*"));
KAutoloader::register();
$code = array();
$ignoreErrors = false;
if ($argc > 1 && $argv[1] == 'ignore') {
    $ignoreErrors = true;
}
$cwd = OsUtils::getCurrentDir();
$updateRunner = new ScriptsRunner();
$updateRunner->init($ignoreErrors);
// create version_management table
$updateRunner->runSqlScript($cwd . DIRECTORY_SEPARATOR . "create_version_mng_table.sql");
$sqlDir = $cwd . DIRECTORY_SEPARATOR . "sql";
$updateRunner->runSqlScripts($sqlDir);
$phpDir = $cwd . DIRECTORY_SEPARATOR . "scripts";
$updateRunner->runPhpScripts($phpDir);
class ScriptsRunner
{
    private $dbParams = array();
    private $version;
    private $alreadyRun;
    private $ignoreErrors;
    public function init($ignore)
    {