function three_o_four_handle_onObjectUpdated($object) { if ($object instanceof ConfigOption) { if ($object->values['name'] == 'theme') { ThreeOFourCore::removeCacheEntryByPattern('*'); } } if ($object instanceof User) { ThreeOFourCacheInvalidationHelper::removeUserList(0, $object->values['company_id']); // remove everything for this user because the theme might has changed. // Todo: Figure out whether the theme really has changed ThreeOFourCacheInvalidationHelper::removeEntriesByUser($object->values['id']); } if ($object instanceof Category) { switch ($object->values['module']) { case 'pages': ThreeOFourCacheInvalidationHelper::removePageList($object->values['project_id']); break; case 'files': ThreeOFourCacheInvalidationHelper::removeFileList($object->values['project_id']); break; case 'tickets': ThreeOFourCacheInvalidationHelper::removeTicketList($object->values['project_id']); break; case 'discussions': ThreeOFourCacheInvalidationHelper::removeDiscussionList($object->values['project_id']); break; default: break; } } if (class_exists('Page') && $object instanceof Page) { ThreeOFourCacheInvalidationHelper::removePage($page); ThreeOFourCacheInvalidationHelper::removePageList($object->values['project_id']); } if (class_exists('Milestone') && $object instanceof Milestone) { ThreeOFourCacheInvalidationHelper::removeMilestone($object); ThreeOFourCacheInvalidationHelper::removeMilestoneList($object->values['project_id']); } if (class_exists('File') && $object instanceof File) { ThreeOFourCacheInvalidationHelper::removeFile($object); ThreeOFourCacheInvalidationHelper::removeFileList($object->values['project_id']); } if (class_exists('Ticket') && $object instanceof Ticket) { ThreeOFourCacheInvalidationHelper::removeTicket($object); ThreeOFourCacheInvalidationHelper::removeTicketList($object->values['project_id']); } if (class_exists('Discussion') && $object instanceof Discussion) { ThreeOFourCacheInvalidationHelper::removeDiscussion($object); ThreeOFourCacheInvalidationHelper::removeDiscussionList($object->values['project_id']); } }
public static function removeDiscussion($discussion) { ThreeOFourCore::removeCacheEntryByPattern('u\\d+_projects-' . $discussion->values['project_id'] . '-discussions-' . $discussion->values['id']); }