function afterSave($arg) { parent::afterSave($arg); // Update root pages cache WildflowerRootPagesCache::update($this->findAllRoot()); }
Router::connect('/' . Configure::read('Wildflower.blogIndex') . '/feed', array('controller' => 'wild_posts', 'action' => 'feed')); // Ultra sexy short SEO friendly post URLs in form of http://my-domain/p/40-char-uuid Router::connect('/' . Configure::read('Wildflower.postsParent') . '/:slug', array('controller' => 'wild_posts', 'action' => 'view')); Router::connect('/' . Configure::read('Wildflower.blogIndex'), array('controller' => 'wild_posts', 'action' => 'index')); Router::connect('/' . Configure::read('Wildflower.blogIndex') . '/rss', array('controller' => 'wild_posts', 'action' => 'rss')); // Image thumbnails Router::connect('/wildflower/thumbnail/*', array('controller' => 'wild_assets', 'action' => 'thumbnail')); Router::connect('/wildflower/thumbnail_by_id/*', array('controller' => 'wild_assets', 'action' => 'thumbnail_by_id')); // Site search (pages & posts) Router::connect('/wildflower/search', array('controller' => 'wild_dashboards', 'action' => 'search')); // ACL Router::connect('/wf/acl', array('controller' => 'acl', 'action' => 'acl', 'index', 'prefix' => 'admin')); Router::connect('/wf/acl/*', array('controller' => 'acl', 'action' => 'acl', 'prefix' => 'admin')); // User registration Router::connect('/users/:action/*', array('controller' => 'wild_users')); WildflowerRootPagesCache::connect(); /** * Wildflower root pages routes cache API * * Pages without a parent are each passed to Route::connect(). * * @package wildflower */ class WildflowerRootPagesCache { static function connect() { $file = Configure::read('Wildflower.rootPageCache'); $rootPages = array(); if (file_exists($file)) { $content = file_get_contents($file);
function update_root_cache() { if (!isset($this->params['requested'])) { return $this->do404(); } $rootPages = $this->{$this->modelClass}->find('all', array('conditions' => 'parent_id IS NULL AND url <> \'/\'', 'recursive' => -1, 'fields' => array('id', 'url', 'slug'))); WildflowerRootPagesCache::write($rootPages); return $rootPages; }
function update_root_cache() { if (!isset($this->params['requested'])) { return $this->do404(); } // Get all pages without a parent except the home page and also all the home page children $homePageId = Configure::read('Wildflower.settings.home_page_id'); $rootPages = $this->{$this->modelClass}->find('all', array('conditions' => "parent_id IS NULL AND url <> '/' OR parent_id = {$homePageId}", 'recursive' => -1, 'fields' => array('id', 'url', 'slug'))); if (!Configure::read('Wildflower.disableRootPageCache')) { WildflowerRootPagesCache::write($rootPages); } return $rootPages; }