@@ -233,12 +233,12 @@ protected function resolveOptions(array $arguments, array $options): void {
233233
234234 // Internal flag to enforce DEMO mode. If not set, the demo mode will be
235235 // discovered automatically.
236- if (!is_null (Env::get (Config::IS_DEMO_MODE ))) {
237- $ this ->config ->set (Config::IS_DEMO_MODE , (bool ) Env::get (Config::IS_DEMO_MODE ));
236+ if (!is_null (Env::get (Config::IS_DEMO ))) {
237+ $ this ->config ->set (Config::IS_DEMO , (bool ) Env::get (Config::IS_DEMO ));
238238 }
239239
240240 // Internal flag to skip processing of the demo mode.
241- $ this ->config ->set (Config::DEMO_MODE_SKIP , (bool ) Env::get (Config::DEMO_MODE_SKIP , FALSE ));
241+ $ this ->config ->set (Config::IS_DEMO_DB_DOWNLOAD_SKIP , (bool ) Env::get (Config::IS_DEMO_DB_DOWNLOAD_SKIP , FALSE ));
242242 }
243243
244244 protected function prepareDestination (): array {
@@ -308,35 +308,40 @@ protected function copyFiles(): void {
308308 }
309309
310310 protected function handleDemo (): array |string {
311- if (empty ($ this ->config ->get (Config::IS_DEMO_MODE )) || !empty ($ this ->config ->get (Config::DEMO_MODE_SKIP ))) {
312- return ['Skipping demo database download. ' ];
311+ if (empty ($ this ->config ->get (Config::IS_DEMO ))) {
312+ return 'Not a demo mode. ' ;
313+ }
314+
315+ if (!empty ($ this ->config ->get (Config::IS_DEMO_DB_DOWNLOAD_SKIP ))) {
316+ return sprintf ('%s is set. Skipping demo database download. ' , Config::IS_DEMO_DB_DOWNLOAD_SKIP );
313317 }
314318
315319 // Reload variables from destination's .env.
316320 Env::putFromDotenv ($ this ->config ->getDst () . '/.env ' );
317321
318322 $ url = Env::get ('VORTEX_DB_DOWNLOAD_URL ' );
319323 if (empty ($ url )) {
320- return [ 'No database download URL provided. Skipping demo database download. ' ] ;
324+ return 'No database download URL provided. Skipping demo database download. ' ;
321325 }
322326
323327 $ data_dir = $ this ->config ->getDst () . DIRECTORY_SEPARATOR . Env::get ('VORTEX_DB_DIR ' , './.data ' );
324- $ file = Env::get ('VORTEX_DB_FILE ' , 'db.sql ' );
328+ $ db_file = Env::get ('VORTEX_DB_FILE ' , 'db.sql ' );
325329
326- if (file_exists ($ data_dir . DIRECTORY_SEPARATOR . $ file )) {
327- return [ 'Database dump file already exists. Skipping download. ' ] ;
330+ if (file_exists ($ data_dir . DIRECTORY_SEPARATOR . $ db_file )) {
331+ return 'Database dump file already exists. Skipping demo database download. ' ;
328332 }
329333
330334 $ messages = [];
331335 if (!file_exists ($ data_dir )) {
332336 $ data_dir = File::mkdir ($ data_dir );
333337 $ messages [] = sprintf ('Created data directory "%s". ' , $ data_dir );
334338 }
335- $ command = sprintf ('curl -s -L "%s" -o "%s/%s" ' , $ url , $ data_dir , $ file );
336339
340+ $ command = sprintf ('curl -s -L "%s" -o "%s/%s" ' , $ url , $ data_dir , $ db_file );
337341 if (passthru ($ command ) === FALSE ) {
338- throw new \RuntimeException (sprintf ('Unable to download demo database from "%s" . ' , $ url ));
342+ throw new \RuntimeException (sprintf ('Unable to download demo database from %s . ' , $ url ));
339343 }
344+
340345 $ messages [] = sprintf ('No database dump file was found in "%s" directory. ' , $ data_dir );
341346 $ messages [] = sprintf ('Downloaded demo database from %s. ' , $ url );
342347
0 commit comments