5353use OCP \Http \Client \IClientService ;
5454use OCP \IConfig ;
5555use OCP \ITempManager ;
56+ use OCP \Migration \IOutput ;
5657use phpseclib \File \X509 ;
5758use Psr \Log \LoggerInterface ;
5859
@@ -536,7 +537,10 @@ public function installAppBundle(Bundle $bundle) {
536537 * working ownCloud at the end instead of an aborted update.
537538 * @return array Array of error messages (appid => Exception)
538539 */
539- public static function installShippedApps ($ softErrors = false ) {
540+ public static function installShippedApps ($ softErrors = false , ?IOutput $ output = null ) {
541+ if ($ output instanceof IOutput) {
542+ $ output ->debug ('Installing shipped apps ' );
543+ }
540544 $ appManager = \OC ::$ server ->getAppManager ();
541545 $ config = \OC ::$ server ->getConfig ();
542546 $ errors = [];
@@ -551,7 +555,7 @@ public static function installShippedApps($softErrors = false) {
551555 && $ config ->getAppValue ($ filename , 'enabled ' ) !== 'no ' ) {
552556 if ($ softErrors ) {
553557 try {
554- Installer::installShippedApp ($ filename );
558+ Installer::installShippedApp ($ filename, $ output );
555559 } catch (HintException $ e ) {
556560 if ($ e ->getPrevious () instanceof TableExistsException) {
557561 $ errors [$ filename ] = $ e ;
@@ -560,7 +564,7 @@ public static function installShippedApps($softErrors = false) {
560564 throw $ e ;
561565 }
562566 } else {
563- Installer::installShippedApp ($ filename );
567+ Installer::installShippedApp ($ filename, $ output );
564568 }
565569 $ config ->setAppValue ($ filename , 'enabled ' , 'yes ' );
566570 }
@@ -578,16 +582,22 @@ public static function installShippedApps($softErrors = false) {
578582 /**
579583 * install an app already placed in the app folder
580584 * @param string $app id of the app to install
581- * @return integer
585+ * @return string
582586 */
583- public static function installShippedApp ($ app ) {
587+ public static function installShippedApp ($ app , ?IOutput $ output = null ) {
588+ if ($ output instanceof IOutput) {
589+ $ output ->debug ('Installing ' . $ app );
590+ }
584591 //install the database
585592 $ appPath = OC_App::getAppPath ($ app );
586593 \OC_App::registerAutoloading ($ app , $ appPath );
587594
588595 $ config = \OC ::$ server ->getConfig ();
589596
590597 $ ms = new MigrationService ($ app , \OC ::$ server ->get (Connection::class));
598+ if ($ output instanceof IOutput) {
599+ $ ms ->setOutput ($ output );
600+ }
591601 $ previousVersion = $ config ->getAppValue ($ app , 'installed_version ' , false );
592602 $ ms ->migrate ('latest ' , !$ previousVersion );
593603
@@ -598,6 +608,9 @@ public static function installShippedApp($app) {
598608 if (is_null ($ info )) {
599609 return false ;
600610 }
611+ if ($ output instanceof IOutput) {
612+ $ output ->debug ('Registering tasks of ' . $ app );
613+ }
601614 \OC_App::setupBackgroundJobs ($ info ['background-jobs ' ]);
602615
603616 OC_App::executeRepairSteps ($ app , $ info ['repair-steps ' ]['install ' ]);
0 commit comments