function make($file) { $cmd = new ShellCommand($this->executable, $this->winDir); $dbc = $this->getDBConnector(); //force,skip possible errors $cmd->addArg(new ShellArg("-f")); $cmd->addArg(new ShellArg('-u', $dbc->getUser())); $cmd->addArg(new ShellArg('--password', $dbc->getPassword(), '=')); $cmd->addArg(new ShellArg('-D', $dbc->getDbName())); $cmd->addArg(new ShellArg('-h', $dbc->getHost())); $cmd->addArg(new ShellArg("-q")); $cmd->addArg(new ShellArg("-s")); $cmd->addArg(new ShellArg(' < ', $file)); $cmd->execute(PathResolver::getInstance()->getLogDir($this, $dbc->getDriver()->getName() . "." . $dbc->getName() . '.log')); }
function make($storeStructure, $storeData) { $cmd = ShellCommand::create($this->executable, $this->winDir); $dbc = $this->getDBConnector(); if ($storeData && !$storeStructure) { $cmd->addArg(ShellArg::create("--data-only")); } if ($storeStructure && !$storeData) { $cmd->addArg(ShellArg::create("--schema-only")); } $cmd->addArg(ShellArg::create("--clean")); //--column-inserts //$cmd->AddArg("-D"); //target file $cmd->addArg(ShellArg::create("-f", $this->getTarget())); //--format=format $cmd->addArg(ShellArg::create('-F', 'p')); $cmd->addArg(ShellArg::create("--no-owner")); $cmd->addArg(ShellArg::create("--no-privileges")); //connection settings if ($dbc->getHost()) { $cmd->addArg(ShellArg::create('-h', $dbc->getHost())); } //dbname $cmd->addArg(ShellArg::create()->setValue($dbc->getDbName())); if (substr(PHP_OS, 0, 3) == 'WIN') { putenv('PGUSER='******'PGPASSWORD='******'env'); $env->addArg(ShellArg::create()->setValue('PGUSER='******'PGPASSWORD='******'.log')); }
function make($file) { $cmd = new ShellCommand($this->executable, $this->winDir); $dbc = $this->getDBConnector(); if ($dbc->getHost()) { $cmd->AddArg("-h", $dbc->getHost()); } $cmd->addArg(new ShellArg($dbc->getDbName())); $cmd->addArg(new ShellArg(' < ', $file)); //we are to use local envvars because our magic dances with proc_open and writing //the password directly to the pipe failed if (substr(PHP_OS, 0, 3) == 'WIN') { putenv('PGUSER='******'PGPASSWORD='******'env'); $env->addArg(ShellArg::create()->setValue('PGUSER='******'PGPASSWORD='******'.log')); }