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')); }