require_once realpath(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'indexer.php'); require_once realpath(dirname(dirname(dirname(__DIR__))) . DS . 'libs' . DS . 'smarty' . DS . 'Autoloader.php'); Smarty_Autoloader::register(); use nzedb\ColorCLI; use nzedb\Tmux; use nzedb\db\Settings; use nzedb\utility\Misc; $pdo = new Settings(); $DIR = nZEDb_MISC; $smarty = new Smarty(); $dbname = DB_NAME; $cli = new ColorCLI(); if (isset($argv[1]) && ($argv[1] == "true" || $argv[1] == "safe")) { $restart = (new Tmux())->stopIfRunning(); system("cd {$DIR} && git pull"); if (Misc::hasCommand("php5")) { $PHP = "php5"; } else { $PHP = "php"; } echo $cli->header("Patching database - {$dbname}."); $safe = $argv[1] === "safe" ? true : false; system("{$PHP} " . nZEDb_ROOT . 'cli' . DS . "update_db.php true {$safe}"); // Remove folders from smarty. $cleared = $smarty->clearCompiledTemplate(); if ($cleared) { echo $cli->header("The smarty template cache has been cleaned for you"); } else { echo $cli->header("You should clear your smarty template cache at: " . SMARTY_DIR . "templates_c"); } if ($restart) {
protected function _backupDb() { if (Misc::hasCommand("php5")) { $PHP = "php5"; } else { $PHP = "php"; } system("{$PHP} " . nZEDb_MISC . 'testing' . DS . 'DB' . DS . $this->_DbSystem . 'dump_tables.php db dump'); $this->backedup = true; }