Beispiel #1
0
 /**
  * Resets the menu cache for static pages on update and create of an entity
  *
  * @param string      $event  'create|delete|update'
  * @param string      $type   'object'
  * @param \ElggObject $entity the entity about to be removed
  *
  * @return void
  */
 public static function resetMenuCache($event, $type, \ElggObject $entity)
 {
     if (!$entity instanceof \StaticPage) {
         return;
     }
     $root_entity = $entity->getRootPage();
     if (empty($root_entity)) {
         return;
     }
     $file = new \ElggFile();
     $file->owner_guid = $root_entity->guid;
     $file->setFilename('static_menu_item_cache');
     if ($file->exists()) {
         $file->delete();
     }
 }