@@ -55,6 +55,7 @@ class AppSettingsController extends Controller {
5555
5656 /** @var array */
5757 private $ allApps = [];
58+ private bool $ appstoreEnabled = true ;
5859
5960 private IAppData $ appData ;
6061
@@ -80,6 +81,7 @@ public function __construct(
8081 ) {
8182 parent ::__construct ($ appName , $ request );
8283 $ this ->appData = $ appDataFactory ->get ('appstore ' );
84+ $ this ->appstoreEnabled = $ this ->config ->getSystemValueBool ('appstoreenabled ' , true );
8385 }
8486
8587 /**
@@ -90,10 +92,10 @@ public function __construct(
9092 #[NoCSRFRequired]
9193 public function viewApps (): TemplateResponse {
9294 $ this ->navigationManager ->setActiveEntry ('core_apps ' );
93-
94- $ this ->initialState ->provideInitialState ('appstoreEnabled ' , $ this ->config -> getSystemValueBool ( ' appstoreenabled ' , true ) );
95+
96+ $ this ->initialState ->provideInitialState ('appstoreEnabled ' , $ this ->appstoreEnabled );
9597 $ this ->initialState ->provideInitialState ('appstoreBundles ' , $ this ->getBundles ());
96- $ this ->initialState ->provideInitialState ('appstoreUpdateCount ' , count ($ this ->getAppsWithUpdates ()));
98+ $ this ->initialState ->provideInitialState ('appstoreUpdateCount ' , $ this -> appstoreEnabled ? count ($ this ->getAppsWithUpdates ()) : 0 );
9799 $ this ->initialState ->provideInitialState ('isAllInOne ' , filter_var (getenv ('THIS_IS_AIO ' ), FILTER_VALIDATE_BOOL ));
98100
99101 $ groups = array_map (static fn (IGroup $ group ): array => [
@@ -256,6 +258,7 @@ private function cleanUpImageCache(ISimpleFolder $folder, string $etag): void {
256258 private function getAppsWithUpdates () {
257259 $ appClass = new \OC_App ();
258260 $ apps = $ appClass ->listAllApps ();
261+
259262 foreach ($ apps as $ key => $ app ) {
260263 $ newVersion = $ this ->installer ->isUpdateAvailable ($ app ['id ' ]);
261264 if ($ newVersion === false ) {
@@ -385,9 +388,11 @@ public function listApps(): JSONResponse {
385388 $ appData ['releases ' ] = $ appstoreData ['releases ' ];
386389 }
387390
388- $ newVersion = $ this ->installer ->isUpdateAvailable ($ appData ['id ' ]);
389- if ($ newVersion ) {
390- $ appData ['update ' ] = $ newVersion ;
391+ if ($ this ->appstoreEnabled ) {
392+ $ newVersion = $ this ->installer ->isUpdateAvailable ($ appData ['id ' ]);
393+ if ($ newVersion ) {
394+ $ appData ['update ' ] = $ newVersion ;
395+ }
391396 }
392397
393398 // fix groups to be an array
0 commit comments