Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / drush / drush / src / Sql / SqlPgsql.php
index 95804c94f3b418af8a6a7da2161db1cbb745f166..3759332c0d7adaf5373006f7fc90cac9612b691c 100644 (file)
@@ -41,10 +41,10 @@ class SqlPgsql extends SqlBase
 
     public function command()
     {
-        $environment = "";
+        $environment = drush_is_windows() ? "SET " : "";
         $pw_file = $this->createPasswordFile();
         if (isset($pw_file)) {
-            $environment = "PGPASSFILE={$pw_file} ";
+            $environment .= "PGPASSFILE={$pw_file} ";
         }
         return "{$environment}psql -q";
     }
@@ -136,14 +136,14 @@ class SqlPgsql extends SqlBase
         $exec = "{$environment}pg_dump ";
         // Unlike psql, pg_dump does not take a '--dbname=' before the database name.
         $extra = str_replace('--dbname=', ' ', $this->creds());
-        if (isset($data_only)) {
+        if ($data_only) {
             $extra .= ' --data-only';
         }
-        if ($option = $this->getOption('extra-dump', $this->queryExtra)) {
+        if ($option = $this->getOption('extra-dump')) {
             $extra .= " $option";
         }
         $exec .= $extra;
-        $exec .= (!isset($create_db) && !isset($data_only) ? ' --clean' : '');
+        $exec .= (!$create_db && !$data_only ? ' --clean' : '');
 
         if (!empty($tables)) {
             foreach ($tables as $table) {
@@ -162,7 +162,7 @@ class SqlPgsql extends SqlBase
                     $schemaonlies[] = "--table=$table";
                 }
                 $exec .= " && pg_dump --schema-only " . implode(' ', $schemaonlies) . $extra;
-                $exec .= (!isset($create_db) && !isset($data_only) ? ' --clean' : '');
+                $exec .= (!$create_db && !$data_only ? ' --clean' : '');
             }
         }
         return $parens ? "($exec)" : $exec;