/**
  * Build routes for the app.
  *
  * Allows other plugins to register routes to be used in the app and builds
  * the routes from the database.
  */
 private static function __buildRoutes()
 {
     App::uses('ClassRegistry', 'Utility');
     EventCore::trigger(new StdClass(), 'setupRoutes');
     if (InfinitasPlugin::infinitasInstalled()) {
         $routes = ClassRegistry::init('Routes.Route')->getRoutes();
         if (!empty($routes)) {
             foreach ($routes as $route) {
                 if (false) {
                     debugRoute($route);
                     continue;
                 }
                 call_user_func_array(array('InfinitasRouter', 'connect'), $route['Route']);
             }
         }
         if (!defined('INFINITAS_ROUTE_HASH')) {
             define('INFINITAS_ROUTE_HASH', md5(serialize($routes)));
         }
     }
 }
Exemple #2
0
if (!file_exists(APP . 'config' . DS . 'database.php')) {
    Configure::write('Session.save', 'php');
    Router::connect('/', array('plugin' => 'installer', 'controller' => 'install', 'action' => 'index'));
} else {
    $routes = Cache::read('routes', 'core');
    if (!$routes) {
        $routes = Classregistry::init('Management.Route')->getRoutes();
        if (empty($routes)) {
            //something is broken
            // @todo -c Implement .some error message or something
        }
    }
    if (!empty($routes)) {
        foreach ($routes as $route) {
            if (false) {
                debugRoute($route);
                continue;
            }
            Router::connect($route['Route']['url'], $route['Route']['values'], $route['Route']['regex']);
        }
    }
}
/**
 * having issues with routes ?
 *
 * @todo this can be removed after stable.
 *
 * @param mixed $route
 * @return null echo's out the route.
 */
function debugRoute($route)