@@ -149,33 +149,30 @@ protected function execute(InputInterface $input, OutputInterface $output) {
149149 // If a dump file wasn't found or not specified, do a fresh site install
150150 if (empty ($ this ->filename ) || !$ this ->fileExists ($ this ->filename )) {
151151 //@todo Use drupal site:install instead of Drush.
152- $ command = sprintf (
153- 'cd %s && ' .
154- 'chmod 777 ../default && ' .
155- 'chmod 777 settings.php && ' .
156- 'drush si -y %s %s && ' .
157- 'drush cset "system.site" uuid "$(drush cget system.site uuid --source=sync --format=list)" -y ' ,
158- $ this ->shellPath ($ this ->getSiteRoot ()),
159- $ this ->profile ,
160- $ options
161- );
162152 $ this ->io ->comment ('Installing site ' );
153+ // Site install.
154+ $ commands [] = sprintf ('cd %s ' , $ this ->shellPath ($ this ->getSiteRoot ()));
155+ // Install site.
156+ $ commands [] = sprintf ('drush si -y %s %s ' , $ this ->profile , $ options );
157+ // Set site UUID from config.
158+ $ commands [] = 'drush cset "system.site" uuid "$(drush cget system.site uuid --source=sync --format=list)" -y ' ;
163159 }
164160 else {
161+ $ this ->io ->comment ('Importing dump ' );
162+
165163 if (is_null ($ input ->getOption ('db-name ' ))) {
166164 $ input ->setOption ('db-name ' , $ this ->siteName );
167165 }
168- $ command = sprintf (
169- 'cd %s; ' .
170- 'drush sql-create %s -y; ' .
171- 'drush sql-cli < %s; ' ,
172- $ this ->getSiteRoot (),
173- $ input ->getOption ('db-name ' ),
174- $ this ->filename
175- );
176- $ this ->io ->comment ('Importing dump ' );
166+
167+ $ commands [] = sprintf ('cd %s ' , $ this ->shellPath ($ this ->getSiteRoot ()));
168+ // Create DB;
169+ $ commands [] = sprintf ('drush sql-create %s -y ' , $ input ->getOption ('db-name ' ));
170+ // Import dump;
171+ $ commands [] = sprintf ('drush sql-cli < %s ' , $ this ->filename );
177172 }
178173
174+ $ command = implode (' && ' , $ commands );
175+
179176 $ this ->io ->commentBlock ($ command );
180177
181178 // Run.
0 commit comments