@@ -140,9 +140,14 @@ public function loadRoutes($app = null) {
140140 if ($ this ->loaded ) {
141141 return ;
142142 }
143+ $ this ->eventLogger ->start ('route:load: ' . $ requestedApp , 'Loading Routes for ' . $ requestedApp );
143144 if (is_null ($ app )) {
144145 $ this ->loaded = true ;
145146 $ routingFiles = $ this ->getRoutingFiles ();
147+
148+ foreach (\OC_App::getEnabledApps () as $ enabledApp ) {
149+ $ this ->loadAttributeRoutes ($ enabledApp );
150+ }
146151 } else {
147152 if (isset ($ this ->loadedApps [$ app ])) {
148153 return ;
@@ -154,21 +159,9 @@ public function loadRoutes($app = null) {
154159 } else {
155160 $ routingFiles = [];
156161 }
157- }
158- $ this ->eventLogger ->start ('route:load: ' . $ requestedApp , 'Loading Routes for ' . $ requestedApp );
159-
160- if ($ requestedApp !== null && in_array ($ requestedApp , \OC_App::getEnabledApps ())) {
161- $ routes = $ this ->getAttributeRoutes ($ requestedApp );
162- if (count ($ routes ) > 0 ) {
163- $ this ->useCollection ($ requestedApp );
164- $ this ->setupRoutes ($ routes , $ requestedApp );
165- $ collection = $ this ->getCollection ($ requestedApp );
166- $ this ->root ->addCollection ($ collection );
167162
168- // Also add the OCS collection
169- $ collection = $ this ->getCollection ($ requestedApp . '.ocs ' );
170- $ collection ->addPrefix ('/ocsapp ' );
171- $ this ->root ->addCollection ($ collection );
163+ if (in_array ($ app , \OC_App::getEnabledApps ())) {
164+ $ this ->loadAttributeRoutes ($ app );
172165 }
173166 }
174167
@@ -442,6 +435,23 @@ protected function fixLegacyRootName(string $routeName): string {
442435 return $ routeName ;
443436 }
444437
438+ private function loadAttributeRoutes (string $ app ): void {
439+ $ routes = $ this ->getAttributeRoutes ($ app );
440+ if (count ($ routes ) === 0 ) {
441+ return ;
442+ }
443+
444+ $ this ->useCollection ($ app );
445+ $ this ->setupRoutes ($ routes , $ app );
446+ $ collection = $ this ->getCollection ($ app );
447+ $ this ->root ->addCollection ($ collection );
448+
449+ // Also add the OCS collection
450+ $ collection = $ this ->getCollection ($ app . '.ocs ' );
451+ $ collection ->addPrefix ('/ocsapp ' );
452+ $ this ->root ->addCollection ($ collection );
453+ }
454+
445455 /**
446456 * @throws ReflectionException
447457 */
0 commit comments