@@ -29,6 +29,11 @@ class RouteModel extends Object
29
29
*/
30
30
public $ cacheDuration = 3600 ;
31
31
32
+ /**
33
+ * @var array list of module IDs that will be excluded
34
+ */
35
+ public $ excludeModules = [];
36
+
32
37
/**
33
38
* @var \yii\rbac\ManagerInterface
34
39
*/
@@ -156,29 +161,31 @@ public function invalidate()
156
161
*/
157
162
protected function getRouteRecursive ($ module , &$ result )
158
163
{
159
- $ token = "Get Route of ' " . get_class ($ module ) . "' with id ' " . $ module ->uniqueId . "' " ;
160
- Yii::beginProfile ($ token , __METHOD__ );
164
+ if (!in_array ($ module ->id , $ this ->excludeModules )) {
165
+ $ token = "Get Route of ' " . get_class ($ module ) . "' with id ' " . $ module ->uniqueId . "' " ;
166
+ Yii::beginProfile ($ token , __METHOD__ );
167
+
168
+ try {
169
+ foreach ($ module ->getModules () as $ id => $ child ) {
170
+ if (($ child = $ module ->getModule ($ id )) !== null ) {
171
+ $ this ->getRouteRecursive ($ child , $ result );
172
+ }
173
+ }
161
174
162
- try {
163
- foreach ($ module ->getModules () as $ id => $ child ) {
164
- if (($ child = $ module ->getModule ($ id )) !== null ) {
165
- $ this ->getRouteRecursive ($ child , $ result );
175
+ foreach ($ module ->controllerMap as $ id => $ type ) {
176
+ $ this ->getControllerActions ($ type , $ id , $ module , $ result );
166
177
}
167
- }
168
178
169
- foreach ($ module ->controllerMap as $ id => $ type ) {
170
- $ this ->getControllerActions ($ type , $ id , $ module , $ result );
179
+ $ namespace = trim ($ module ->controllerNamespace , '\\' ) . '\\' ;
180
+ $ this ->getControllerFiles ($ module , $ namespace , '' , $ result );
181
+ $ all = '/ ' . ltrim ($ module ->uniqueId . '/* ' , '/ ' );
182
+ $ result [$ all ] = $ all ;
183
+ } catch (\Exception $ exc ) {
184
+ Yii::error ($ exc ->getMessage (), __METHOD__ );
171
185
}
172
186
173
- $ namespace = trim ($ module ->controllerNamespace , '\\' ) . '\\' ;
174
- $ this ->getControllerFiles ($ module , $ namespace , '' , $ result );
175
- $ all = '/ ' . ltrim ($ module ->uniqueId . '/* ' , '/ ' );
176
- $ result [$ all ] = $ all ;
177
- } catch (\Exception $ exc ) {
178
- Yii::error ($ exc ->getMessage (), __METHOD__ );
187
+ Yii::endProfile ($ token , __METHOD__ );
179
188
}
180
-
181
- Yii::endProfile ($ token , __METHOD__ );
182
189
}
183
190
184
191
/**
0 commit comments