private function findPath($optionalWindowsPath = null) { //try to obtain the direct path usgin OS utils if (substr(PHP_OS, 0, 3) != 'WIN') { $whereIsResult = ShellCommand::create('whereis')->addArg($this->getExecutableName())->execute(); $whereIsResult = end(explode(" ", $whereIsResult, 2)); if ($whereIsResult) { $chunks = explode(DIRECTORY_SEPARATOR, $whereIsResult); if ($this->getExecutableName() == array_pop($chunks)) { $this->setPath(join(DIRECTORY_SEPARATOR, $chunks)); return; } } } if ($optionalWindowsPath) { $this->setPath($optionalWindowsPath); } }
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')); }