6060use OCP \Defaults ;
6161use OCP \IGroup ;
6262use OCP \IL10N ;
63+ use OCP \Migration \IOutput ;
6364use OCP \Security \ISecureRandom ;
6465use Psr \Log \LoggerInterface ;
6566
@@ -272,10 +273,11 @@ public function getSystemInfo($allowAllDatabases = false) {
272273 }
273274
274275 /**
275- * @param $options
276+ * @param array{dbtype: string, dbuser: string, dbpass: ?string, dbname: string, dbhost: string, adminlogin: string, adminpass: string, adminemail: ?string, directory: string, dbtablespace?: string} $options
277+ * @param ?IOutput $output
276278 * @return array
277279 */
278- public function install ($ options ) {
280+ public function install ($ options, ? IOutput $ output = null ) {
279281 $ l = $ this ->l10n ;
280282
281283 $ error = [];
@@ -349,6 +351,7 @@ public function install($options) {
349351
350352 $ this ->config ->setValues ($ newConfigValues );
351353
354+ $ this ->outputDebug ($ output , 'Configuring database ' );
352355 $ dbSetup ->initialize ($ options );
353356 try {
354357 $ dbSetup ->setupDatabase ($ username );
@@ -367,9 +370,11 @@ public function install($options) {
367370 ];
368371 return $ error ;
369372 }
373+
374+ $ this ->outputDebug ($ output , 'Run server migrations ' );
370375 try {
371376 // apply necessary migrations
372- $ dbSetup ->runMigrations ();
377+ $ dbSetup ->runMigrations ($ output );
373378 } catch (Exception $ e ) {
374379 $ error [] = [
375380 'error ' => 'Error while trying to initialise the database: ' . $ e ->getMessage (),
@@ -379,6 +384,7 @@ public function install($options) {
379384 return $ error ;
380385 }
381386
387+ $ this ->outputDebug ($ output , 'Create admin user ' );
382388 //create the user and group
383389 $ user = null ;
384390 try {
@@ -407,16 +413,19 @@ public function install($options) {
407413 }
408414
409415 // Install shipped apps and specified app bundles
410- Installer::installShippedApps ();
416+ $ this ->outputDebug ($ output , 'Install default apps ' );
417+ Installer::installShippedApps (false , $ output );
411418
412419 // create empty file in data dir, so we can later find
413420 // out that this is indeed an ownCloud data directory
421+ $ this ->outputDebug ($ output , 'Setup data directory ' );
414422 file_put_contents ($ config ->getSystemValueString ('datadirectory ' , \OC ::$ SERVERROOT . '/data ' ) . '/.ocdata ' , '' );
415423
416424 // Update .htaccess files
417425 self ::updateHtaccess ();
418426 self ::protectDataDirectory ();
419427
428+ $ this ->outputDebug ($ output , 'Install background jobs ' );
420429 self ::installBackgroundJobs ();
421430
422431 //and we are done
@@ -616,4 +625,10 @@ public function shouldRemoveCanInstallFile() {
616625 public function canInstallFileExists () {
617626 return is_file (\OC ::$ configDir .'/CAN_INSTALL ' );
618627 }
628+
629+ protected function outputDebug (?IOutput $ output , string $ message ): void {
630+ if ($ output instanceof IOutput) {
631+ $ output ->debug ($ message );
632+ }
633+ }
619634}
0 commit comments