@@ -281,30 +281,39 @@ function getPrefix() {
281
281
$ admin = '' ;
282
282
$ prefixes = Configure::read ('Routing.prefixes ' );
283
283
if (!empty ($ prefixes )) {
284
+ if ($ this ->interactive ) {
285
+ $ this ->out ();
286
+ $ this ->out (__ ('You have more than one routing prefix configured ' , true ));
287
+ }
284
288
if (count ($ prefixes ) == 1 ) {
285
289
return $ prefixes [0 ] . '_ ' ;
286
290
}
287
291
$ options = array ();
288
292
foreach ($ prefixes as $ i => $ prefix ) {
289
293
$ options [] = $ i + 1 ;
290
- $ this ->out ($ i + 1 . '. ' . $ prefix );
294
+ if ($ this ->interactive ) {
295
+ $ this ->out ($ i + 1 . '. ' . $ prefix );
296
+ }
291
297
}
292
298
$ selection = $ this ->in (__ ('Please choose a prefix to bake with. ' , true ), $ options , 1 );
293
299
return $ prefixes [$ selection - 1 ] . '_ ' ;
294
300
}
295
-
296
- $ this ->out ('You need to enable Configure::write( \'Routing.prefixes \',array( \'admin \')) in /app/config/core.php to use prefix routing. ' );
297
- $ this ->out (__ ('What would you like the prefix route to be? ' , true ));
298
- $ this ->out (__ ('Example: www.example.com/admin/controller ' , true ));
299
- while ($ admin == '' ) {
300
- $ admin = $ this ->in (__ ("What would you like the prefix route to be? " , true ), null , 'admin ' );
301
- }
302
- if ($ this ->cakeAdmin ($ admin ) !== true ) {
303
- $ this ->out (__ ('Unable to write to /app/config/core.php. ' , true ));
301
+ if ($ this ->interactive ) {
302
+ $ this ->hr ();
304
303
$ this ->out ('You need to enable Configure::write( \'Routing.prefixes \',array( \'admin \')) in /app/config/core.php to use prefix routing. ' );
305
- $ this ->_stop ();
304
+ $ this ->out (__ ('What would you like the prefix route to be? ' , true ));
305
+ $ this ->out (__ ('Example: www.example.com/admin/controller ' , true ));
306
+ while ($ admin == '' ) {
307
+ $ admin = $ this ->in (__ ("Enter a routing prefix: " , true ), null , 'admin ' );
308
+ }
309
+ if ($ this ->cakeAdmin ($ admin ) !== true ) {
310
+ $ this ->out (__ ('Unable to write to /app/config/core.php. ' , true ));
311
+ $ this ->out ('You need to enable Configure::write( \'Routing.prefixes \',array( \'admin \')) in /app/config/core.php to use prefix routing. ' );
312
+ $ this ->_stop ();
313
+ }
314
+ return $ admin . '_ ' ;
306
315
}
307
- return $ admin . ' _ ' ;
316
+ return ' ' ;
308
317
}
309
318
310
319
/**
0 commit comments