public function processCleanUp() { $configs = OW::getConfig()->getValues('cacheextreme'); //clean template cache if ($configs['template_cache']) { OW_ViewRenderer::getInstance()->clearCompiledTpl(); } //clean db backend cache if ($configs['backend_cache']) { OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL); } //clean themes static contents cache if ($configs['theme_static']) { OW::getThemeManager()->getThemeService()->processAllThemes(); } //clean plugins static contents cache if ($configs['plugin_static']) { $pluginService = BOL_PluginService::getInstance(); $activePlugins = $pluginService->findActivePlugins(); /* @var $pluginDto BOL_Plugin */ foreach ($activePlugins as $pluginDto) { $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (file_exists($staticDir)) { UTIL_File::removeDir($staticDir); } mkdir($staticDir); chmod($staticDir, 0777); UTIL_File::copyDir($pluginStaticDir, $staticDir); } } } }
public function addLink($userId, $href, $title, $description, $thumbnailUrl, $text = null, $addToFeed = true) { if (!$this->isActive()) { return null; } OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT)); $service = LinkService::getInstance(); $url = mb_ereg_match('^http(s)?:\\/\\/', $href) ? $href : 'http://' . $href; $link = new Link(); $eventParams = array('action' => LinkService::PRIVACY_ACTION_VIEW_LINKS, 'ownerId' => OW::getUser()->getId()); $privacy = OW::getEventManager()->getInstance()->call('plugin.privacy.get_privacy', $eventParams); if (!empty($privacy)) { $link->setPrivacy($privacy); } $link->setUserId($userId); $link->setTimestamp(time()); $link->setUrl($url); $link->setDescription(strip_tags($description)); $title = empty($title) ? $text : $title; $link->setTitle(strip_tags($title)); $service->save($link); if ($addToFeed) { $content = array("format" => null, "vars" => array("status" => $text)); if (!empty($thumbnailUrl)) { $content["format"] = "image_content"; $content["vars"]["image"] = $thumbnailUrl; $content["vars"]["thumbnail"] = $thumbnailUrl; } //Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'links', 'entityType' => 'link', 'entityId' => $link->getId(), 'userId' => $link->getUserId()), array("content" => $content)); OW::getEventManager()->trigger($event); } return $link->id; }
/** * Application init actions. */ public function init() { // $this->urlHostRedirect(); // //printVar(10);exit; $this->userAutoLogin(); // setting default time zone date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone')); // OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel'); // OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument'); // // // router init - need to set current page uri and base url $router = OW::getRouter(); $router->setBaseUrl(OW_URL_HOME . 'api/'); $uri = OW::getRequest()->getRequestUri(); // before setting in router need to remove get params if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $router->setUri($uri); $router->setDefaultRoute(new OW_ApiDefaultRoute()); $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } OW::getResponse()->setDocument($this->newDocument()); }
public function delete(Link $dto) { BOL_CommentService::getInstance()->deleteEntityComments('link', $dto->getId()); BOL_TagService::getInstance()->deleteEntityTags($dto->getId(), 'link'); BOL_VoteService::getInstance()->deleteEntityItemVotes($dto->getId(), 'link'); BOL_FlagService::getInstance()->deleteByTypeAndEntityId('link', $dto->getId()); OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT)); OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'link', 'entityId' => $dto->getId()))); $this->dao->delete($dto); }
protected function clearCache() { $tagsToClear = $this->getClearCacheTags(); if ($tagsToClear) { OW::getCacheManager()->clean($tagsToClear); } }
public function onUnregisterUser(OW_Event $event) { $params = $event->getParams(); if (empty($params['deleteContent'])) { return; } OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT)); $userId = $params['userId']; $count = (int) $this->service->countUserPost($userId); if ($count == 0) { return; } $list = $this->service->findUserPostList($userId, 0, $count); foreach ($list as $post) { $this->service->delete($post); } }
public function clearUserListQueryCache(OW_Event $event) { $params = $event->getParams(); $userId = (int) $params['userId']; OW::getCacheManager()->clean(array(BOL_UserDao::CACHE_TAG_ALL_USER_LIST)); }
protected function clearCache() { OW::getCacheManager()->clean(array(BOL_ThemeDao::CACHE_TAG_PAGE_LOAD_THEME)); }
public function clearCache() { OW::getCacheManager()->clean(array(LinkDao::CACHE_TAG_LINK_COUNT)); }
if (!isset($_GET['ow-light-cron']) && !OW::getConfig()->getValue('base', 'cron_is_configured')) { if (OW::getConfig()->configExists('base', 'cron_is_configured')) { OW::getConfig()->saveConfig('base', 'cron_is_configured', 1); } else { OW::getConfig()->addConfig('base', 'cron_is_configured', 1); } } OW::getRouter()->setBaseUrl(OW_URL_HOME); OW::getPluginManager()->initPlugins(); $event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT); OW::getEventManager()->trigger($event); //init cache manager $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } OW::getThemeManager()->initDefaultTheme(); // setting current theme $activeThemeName = OW::getConfig()->getValue('base', 'selectedTheme'); if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) { OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName))); } $plugins = BOL_PluginService::getInstance()->findActivePlugins(); foreach ($plugins as $plugin) { /* @var $plugin BOL_Plugin */ $pluginRootDir = OW::getPluginManager()->getPlugin($plugin->getKey())->getRootDir(); if (file_exists($pluginRootDir . DS . 'cron.php')) { include $pluginRootDir . DS . 'cron.php'; $className = strtoupper($plugin->getKey()) . '_Cron';
/** * @return OW_CacheManager */ private function getCacheManager() { return OW::getCacheManager(); }
protected function clearCache() { OW::getCacheManager()->clean(array(FRIENDS_BOL_FriendshipDao::CACHE_TAG_FRIENDS_COUNT, FRIENDS_BOL_FriendshipDao::CACHE_TAG_FRIEND_ID_LIST)); }
public function clearCache() { OW::getCacheManager()->clean(array(NEWSFEED_BOL_ActionDao::CACHE_TAG_ALL, NEWSFEED_BOL_ActionDao::CACHE_TAG_INDEX, NEWSFEED_BOL_ActionDao::CACHE_TAG_USER, NEWSFEED_BOL_ActionDao::CACHE_TAG_FEED)); }
public function updateBlogsPrivacy($userId, $privacy) { $count = $this->countUserPost($userId); $entities = PostService::getInstance()->findUserPostList($userId, 0, $count); $entityIds = array(); foreach ($entities as $post) { $entityIds[] = $post->getId(); } $status = $privacy == 'everybody' ? true : false; $event = new OW_Event('base.update_entity_items_status', array('entityType' => 'blog-post', 'entityIds' => $entityIds, 'status' => $status)); OW::getEventManager()->trigger($event); $this->dao->updateBlogsPrivacy($userId, $privacy); OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT)); }
protected function clearCache() { OW::getCacheManager()->clean(array(self::CACHE_TAG_ADS_BANNERS)); }
public function onUserEventClearQueryCache(OW_Event $event) { OW::getCacheManager()->clean(array(FRIENDS_BOL_FriendshipDao::CACHE_TAG_FRIENDS_COUNT, FRIENDS_BOL_FriendshipDao::CACHE_TAG_FRIEND_ID_LIST)); }
/** * Application init actions. */ public function init() { require_once OW_DIR_SYSTEM_PLUGIN . 'base' . DS . 'classes' . DS . 'json_err_output.php'; OW_ErrorManager::getInstance()->setErrorOutput(new BASE_CLASS_JsonErrOutput()); $authToken = empty($_SERVER["HTTP_API_AUTH_TOKEN"]) ? null : $_SERVER["HTTP_API_AUTH_TOKEN"]; OW_Auth::getInstance()->setAuthenticator(new OW_TokenAuthenticator($authToken)); if (!empty($_SERVER["HTTP_API_LANGUAGE"])) { $languageDto = BOL_LanguageService::getInstance()->findByTag($_SERVER["HTTP_API_LANGUAGE"]); if (!empty($languageDto) && $languageDto->status == "active") { BOL_LanguageService::getInstance()->setCurrentLanguage($languageDto); } } // setting default time zone date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone')); // OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel'); // OW::getRequestHandler()->setStaticPageAttributes('BASE_CTRL_StaticDocument'); // // // router init - need to set current page uri and base url $router = OW::getRouter(); $router->setBaseUrl(OW_URL_HOME . 'api/'); $uri = OW::getRequest()->getRequestUri(); // before setting in router need to remove get params if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $router->setUri($uri); $router->setDefaultRoute(new OW_ApiDefaultRoute()); OW::getPluginManager()->initPlugins(); $event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT); OW::getEventManager()->trigger($event); $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } OW::getResponse()->setDocument($this->newDocument()); if (OW::getUser()->isAuthenticated()) { BOL_UserService::getInstance()->updateActivityStamp(OW::getUser()->getId(), $this->getContext()); } }
function eventx_on_change_user_status(OW_Event $event) { $params = $event->getParams(); $eventId = !empty($params['eventId']) ? $params['eventId'] : null; $userId = !empty($params['userId']) ? $params['userId'] : null; if (!isset($eventId)) { return; } OW::getCacheManager()->clean(array(EVENTX_BOL_EventUserDao::CACHE_TAG_EVENTX_USER_LIST . $eventId)); if (!isset($userId)) { return; } $eventDto = EVENTX_BOL_EventService::getInstance()->findEvent($eventId); $eventUser = EVENTX_BOL_EventService::getInstance()->findEventUser($eventId, $userId); if (empty($eventDto) || empty($eventUser)) { return; } if ($eventUser->getStatus() == EVENTX_BOL_EventService::USER_STATUS_YES && $eventDto->getWhoCanView() == EVENTX_BOL_EventService::CAN_VIEW_ANYBODY) { $userName = BOL_UserService::getInstance()->getDisplayName($eventDto->getUserId()); $userUrl = BOL_UserService::getInstance()->getUserUrl($eventDto->getUserId()); $userEmbed = '<a href="' . $userUrl . '">' . $userName . '</a>'; OW::getEventManager()->trigger(new OW_Event('feed.activity', array('activityType' => 'event-join', 'activityId' => $eventUser->getId(), 'entityId' => $eventDto->getId(), 'entityType' => 'eventx', 'userId' => $eventUser->getUserId(), 'pluginKey' => 'eventx'), array('eventId' => $eventDto->getId(), 'userId' => $eventUser->getUserId(), 'eventUserId' => $eventUser->getId(), 'string' => OW::getLanguage()->text('eventx', 'feed_actiovity_attend_string', array('user' => $userEmbed)), 'feature' => array()))); } }
protected function clearCache() { OW::getCacheManager()->clean(array(ADS_BOL_BannerDao::CACHE_TAG_ADS_BANNERS)); }
public function deleteConversation(OW_Event $event) { $params = $event->getParams(); $dto = $params['conversationDto']; /* @var $dto MAILBOX_BOL_Conversation */ if ($dto) { OW::getCacheManager()->clean(array(MAILBOX_BOL_ConversationDao::CACHE_TAG_USER_CONVERSATION_COUNT . $dto->initiatorId)); OW::getCacheManager()->clean(array(MAILBOX_BOL_ConversationDao::CACHE_TAG_USER_CONVERSATION_COUNT . $dto->interlocutorId)); } }
public function process($ctrl) { OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT)); $service = PostService::getInstance(); /* @var $postDao PostService */ $data = $this->getValues(); $data['title'] = UTIL_HtmlTag::stripJs($data['title']); $postIsNotPublished = $this->post->getStatus() == 2; $text = UTIL_HtmlTag::sanitize($data['post']); /* @var $post Post */ $this->post->setTitle($data['title']); $this->post->setPost($text); $this->post->setIsDraft($_POST['command'] == 'draft'); $isCreate = empty($this->post->id); if ($isCreate) { $this->post->setTimestamp(time()); //Required to make #698 and #822 work together if ($_POST['command'] == 'draft') { $this->post->setIsDraft(2); } BOL_AuthorizationService::getInstance()->trackAction('blogs', 'add_blog'); } else { //If post is not new and saved as draft, remove their item from newsfeed if ($_POST['command'] == 'draft') { OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'blog-post', 'entityId' => $this->post->id))); } else { if ($postIsNotPublished) { // Update timestamp if post was published for the first time $this->post->setTimestamp(time()); } } } $service->save($this->post); $tags = array(); if (intval($this->post->getId()) > 0) { $tags = $data['tf']; foreach ($tags as $id => $tag) { $tags[$id] = UTIL_HtmlTag::stripTags($tag); } } $tagService = BOL_TagService::getInstance(); $tagService->updateEntityTags($this->post->getId(), 'blog-post', $tags); if ($this->post->isDraft()) { $tagService->setEntityStatus('blog-post', $this->post->getId(), false); if ($isCreate) { OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'create_draft_success_msg')); } else { OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'edit_draft_success_msg')); } } else { $tagService->setEntityStatus('blog-post', $this->post->getId(), true); //Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'blogs', 'entityType' => 'blog-post', 'entityId' => $this->post->getId(), 'userId' => $this->post->getAuthorId())); OW::getEventManager()->trigger($event); if ($isCreate) { OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'create_success_msg')); OW::getEventManager()->trigger(new OW_Event(PostService::EVENT_AFTER_ADD, array('postId' => $this->post->getId()))); } else { OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'edit_success_msg')); OW::getEventManager()->trigger(new OW_Event(PostService::EVENT_AFTER_EDIT, array('postId' => $this->post->getId()))); } $ctrl->redirect(OW::getRouter()->urlForRoute('post', array('id' => $this->post->getId()))); } }
public function deleteExpiredCache() { OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_OLD); }
/** * Application init actions. */ public function init() { // router init - need to set current page uri and base url $router = OW::getRouter(); $router->setBaseUrl(OW_URL_HOME); $this->urlHostRedirect(); OW_Auth::getInstance()->setAuthenticator(new OW_SessionAuthenticator()); $this->userAutoLogin(); // setting default time zone date_default_timezone_set(OW::getConfig()->getValue('base', 'site_timezone')); // synchronize the db's time zone OW::getDbo()->setTimezone(); // OW::getRequestHandler()->setIndexPageAttributes('BASE_CTRL_ComponentPanel'); OW::getRequestHandler()->setStaticPageAttributes('BASE_MCTRL_BaseDocument', 'staticDocument'); $uri = OW::getRequest()->getRequestUri(); // before setting in router need to remove get params if (strstr($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } $router->setUri($uri); $defaultRoute = new OW_DefaultRoute(); //$defaultRoute->setControllerNamePrefix('MCTRL'); $router->setDefaultRoute($defaultRoute); $navService = BOL_NavigationService::getInstance(); // // // try to find static document with current uri // $document = $navService->findStaticDocument($uri); // // if ( $document !== null ) // { // $this->documentKey = $document->getKey(); // } OW::getPluginManager()->initPlugins(); $event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT); OW::getEventManager()->trigger($event); $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } $this->devActions(); OW::getThemeManager()->initDefaultTheme(true); // setting current theme $activeThemeName = OW::getEventManager()->call('base.get_active_theme_name'); $activeThemeName = $activeThemeName ? $activeThemeName : OW::getConfig()->getValue('base', 'selectedTheme'); if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) { OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName), true)); } // adding static document routes $staticDocs = $navService->findAllMobileStaticDocuments(); $staticPageDispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes(); /* @var $value BOL_Document */ foreach ($staticDocs as $value) { OW::getRouter()->addRoute(new OW_Route($value->getKey(), $value->getUri(), $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $value->getKey())))); // TODO refactor - hotfix for TOS page if (UTIL_String::removeFirstAndLastSlashes($value->getUri()) == 'terms-of-use') { OW::getRequestHandler()->addCatchAllRequestsExclude('base.members_only', $staticPageDispatchAttrs['controller'], $staticPageDispatchAttrs['action'], array('documentKey' => $value->getKey())); } } //adding index page route $item = BOL_NavigationService::getInstance()->findFirstLocal(OW::getUser()->isAuthenticated() ? BOL_NavigationService::VISIBLE_FOR_MEMBER : BOL_NavigationService::VISIBLE_FOR_GUEST, OW_Navigation::MOBILE_TOP); if ($item !== null) { if ($item->getRoutePath()) { $route = OW::getRouter()->getRoute($item->getRoutePath()); $ddispatchAttrs = $route->getDispatchAttrs(); } else { $ddispatchAttrs = OW::getRequestHandler()->getStaticPageAttributes(); } $router->addRoute(new OW_Route('base_default_index', '/', $ddispatchAttrs['controller'], $ddispatchAttrs['action'], array('documentKey' => array(OW_Route::PARAM_OPTION_HIDDEN_VAR => $item->getDocumentKey())))); $this->indexMenuItem = $item; OW::getEventManager()->bind(OW_EventManager::ON_AFTER_REQUEST_HANDLE, array($this, 'activateMenuItem')); } else { $router->addRoute(new OW_Route('base_default_index', '/', 'BASE_MCTRL_WidgetPanel', 'index')); } if (!OW::getRequest()->isAjax()) { OW::getResponse()->setDocument($this->newDocument()); OW::getDocument()->setMasterPage(new OW_MobileMasterPage()); OW::getResponse()->setHeader(OW_Response::HD_CNT_TYPE, OW::getDocument()->getMime() . '; charset=' . OW::getDocument()->getCharset()); } else { OW::getResponse()->setDocument(new OW_AjaxDocument()); } /* additional actions */ if (OW::getUser()->isAuthenticated()) { BOL_UserService::getInstance()->updateActivityStamp(OW::getUser()->getId(), $this->getContext()); } // adding global template vars $currentThemeImagesDir = OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl(); $viewRenderer = OW_ViewRenderer::getInstance(); $viewRenderer->assignVar('themeImagesUrl', $currentThemeImagesDir); $viewRenderer->assignVar('siteName', OW::getConfig()->getValue('base', 'site_name')); $viewRenderer->assignVar('siteTagline', OW::getConfig()->getValue('base', 'site_tagline')); $viewRenderer->assignVar('siteUrl', OW_URL_HOME); $viewRenderer->assignVar('isAuthenticated', OW::getUser()->isAuthenticated()); $viewRenderer->assignVar('bottomPoweredByLink', '<a href="http://www.oxwall.org/" target="_blank" title="Powered by Oxwall Community Software"><img src="' . $currentThemeImagesDir . 'powered-by-oxwall.png" alt="Oxwall Community Software" /></a>'); $viewRenderer->assignVar('adminDashboardIframeUrl', "http://static.oxwall.org/spotlight/?platform=oxwall&platform-version=" . OW::getConfig()->getValue('base', 'soft_version') . "&platform-build=" . OW::getConfig()->getValue('base', 'soft_build')); if (function_exists('ow_service_actions')) { call_user_func('ow_service_actions'); } $this->handleHttps(); }
public function findSiteFeed($limit = null, $startTime = null, $formats = null) { $limitStr = ''; if (!empty($limit)) { $limitStr = "LIMIT " . intval($limit[0]) . ", " . intval($limit[1]); } $cacheStartTime = OW::getCacheManager()->load('newsfeed.site_cache_time'); if ($cacheStartTime === null) { OW::getCacheManager()->save($startTime, 'newsfeed.site_cache_time', array(self::CACHE_TAG_ALL, self::CACHE_TAG_INDEX), self::CACHE_LIFETIME); } else { $startTime = $cacheStartTime; } $activityDao = NEWSFEED_BOL_ActivityDao::getInstance(); $queryParts = BOL_UserDao::getInstance()->getUserQueryFilter("cactivity", "userId", array("method" => "NEWSFEED_BOL_ActionDao::findSiteFeedCount")); if ($formats !== null) { $queryParts["where"] .= " AND action.format IN ( '" . implode("','", $formats) . "' )"; } $query = 'SELECT action.id FROM ' . $this->getTableName() . ' action INNER JOIN ' . $activityDao->getTableName() . ' activity ON action.id = activity.actionId INNER JOIN ' . $activityDao->getTableName() . ' cactivity ON action.id = cactivity.actionId ' . $queryParts["join"] . ' WHERE ' . $queryParts["where"] . ' AND (cactivity.status=:s AND cactivity.activityType=:ac AND cactivity.privacy=:peb AND cactivity.visibility & :v) AND (activity.status=:s AND activity.privacy=:peb AND activity.visibility & :v AND activity.timeStamp < :st) GROUP BY action.id ORDER BY MAX(activity.timeStamp) DESC ' . $limitStr; $idList = $this->dbo->queryForColumnList($query, array('v' => NEWSFEED_BOL_Service::VISIBILITY_SITE, 's' => NEWSFEED_BOL_Service::ACTION_STATUS_ACTIVE, 'st' => empty($startTime) ? time() : $startTime, 'peb' => NEWSFEED_BOL_Service::PRIVACY_EVERYBODY, 'ac' => NEWSFEED_BOL_Service::SYSTEM_ACTIVITY_CREATE), self::CACHE_LIFETIME, array(self::CACHE_TAG_ALL, self::CACHE_TAG_INDEX)); return $this->findOrderedListByIdList($idList); }
/** * Deletes conversation * * @param array $conversationsId * @param int $userId * @throws InvalidArgumentException * * return int */ public function deleteConversation(array $conversationsId, $userId) { if (empty($userId)) { throw new InvalidArgumentException("Not numeric params were provided! Numbers are expected!"); } if (empty($conversationsId) || !is_array($conversationsId)) { throw new InvalidArgumentException("Wrong parameter conversationsId!"); } $userId = (int) $userId; $conversations = $this->conversationDao->findByIdList($conversationsId); $count = 0; foreach ($conversations as $key => $value) { $conversation =& $conversations[$key]; $deletedBy = MAILBOX_BOL_ConversationDao::DELETED_NONE; switch ($userId) { case $conversation->initiatorId: $deletedBy = MAILBOX_BOL_ConversationDao::DELETED_INITIATOR; break; case $conversation->interlocutorId: $deletedBy = MAILBOX_BOL_ConversationDao::DELETED_INTERLOCUTOR; break; } $conversation->deleted = (int) $conversation->deleted | $deletedBy; if ($conversation->deleted == MAILBOX_BOL_ConversationDao::DELETED_ALL) { $this->conversationDao->deleteById($conversation->id); $this->deleteAttachmentsByConversationList(array($conversation->id)); $event = new OW_Event(self::EVENT_DELETE_CONVERSATION, array('conversationDto' => $conversation)); OW::getEventManager()->trigger($event); } else { $this->conversationDao->save($conversation); // clear query cache switch ($userId) { case $conversation->initiatorId: OW::getCacheManager()->clean(array(MAILBOX_BOL_ConversationDao::CACHE_TAG_USER_CONVERSATION_COUNT . $conversation->initiatorId)); break; case $conversation->interlocutorId: OW::getCacheManager()->clean(array(MAILBOX_BOL_ConversationDao::CACHE_TAG_USER_CONVERSATION_COUNT . $conversation->interlocutorId)); break; } } if ($this->conversationDao->getAffectedRows() > 0) { $count++; OW::getCacheManager()->clean(array(MAILBOX_BOL_ConversationDao::CACHE_TAG_USER_CONVERSATION_COUNT . $userId)); } } return $count; }
protected function updateCachedEntities($options) { $options = intval($options); if ($options === 1 || $options & 1 << 1) { OW_ViewRenderer::getInstance()->clearCompiledTpl(); } if ($options === 1 || $options & 1 << 2) { BOL_ThemeService::getInstance()->updateThemeList(); BOL_ThemeService::getInstance()->processAllThemes(); if (OW::getConfig()->configExists('base', 'cachedEntitiesPostfix')) { OW::getConfig()->saveConfig('base', 'cachedEntitiesPostfix', uniqid()); } $event = new OW_Event('base.update_cache_entities'); OW::getEventManager()->trigger($event); } if ($options === 1 || $options & 1 << 3) { BOL_LanguageService::getInstance()->generateCacheForAllActiveLanguages(); } if ($options === 1 || $options & 1 << 4) { OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL); } if (($options === 1 || $options & 1 << 5) && !defined('OW_PLUGIN_XP')) { $pluginService = BOL_PluginService::getInstance(); $activePlugins = $pluginService->findActivePlugins(); /* @var $pluginDto BOL_Plugin */ foreach ($activePlugins as $pluginDto) { $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (!file_exists($staticDir)) { mkdir($staticDir); chmod($staticDir, 0777); } UTIL_File::copyDir($pluginStaticDir, $staticDir); } } } }
public function clearCache() { OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT)); }
protected function clearCache() { OW::getCacheManager()->clean(array(BOL_MenuItemDao::CACHE_TAG_MENU_TYPE_LIST)); }
protected function clearCache() { OW::getCacheManager()->clean(array(BOL_AuthorizationActionDao::CACHE_TAG_AUTHORIZATION)); }
protected function clearCache() { OW::getCacheManager()->clean(array(BOL_UserBlockDao::CACHE_TAG_BLOCKED_USER)); }