public function delete($key) { $db = $this->getSpecialsDB(DB_MASTER); $result = $db->delete(self::TABLE_NAME, [self::DB_KEY_FIELD => $key], __METHOD__); WikiaDataAccess::cachePurge($this->getMemcacheKey($key)); return $result; }
public function saveWikiaStatsInWF() { $statsValues = $this->request->getVal('statsValues'); if ($this->wg->User->isAllowed('wikifactory')) { WikiaDataAccess::cachePurge($this->getStatsMemcacheKey()); WikiaStatsModel::setWikiaStatsInWF($statsValues); } else { throw new PermissionsException('wikifactory'); } }
/** * Purge the cache for articles related to a given thread * @param int $threadId */ public static function purgeCache($threadId) { $relatedPages = new WallRelatedPages(); $ids = $relatedPages->getMessagesRelatedArticleIds($threadId, 'order_index', DB_MASTER); foreach ($ids as $id) { $key = wfMemcKey(__CLASS__, 'getData', $id); WikiaDataAccess::cachePurge($key); // VOLDEV-46: Update module by purging page, not via AJAX $wikiaPage = WikiPage::newFromID($id); if ($wikiaPage) { $wikiaPage->doPurge(); } else { self::logError("Found a null related wikipage on thread purge", ["articleID" => $id, "threadID" => $threadId]); } } }
public function add($type, $feed, $user) { switch ($type) { case WH_EDIT: case WH_NEW: // wall the wall action goes through this point. wfRunHooks('WallAction', array($type, $feed->data->parent_id, $feed->data->title_id)); $this->addNewOrEdit($type, $feed, $user); break; case WH_ARCHIVE: case WH_DELETE: case WH_REOPEN: case WH_REMOVE: case WH_RESTORE: // wall the wall action goes through this point. wfRunHooks('WallAction', array($type, $feed->data->parent_id, $feed->data->message_id)); $this->addStatChangeAction($type, $feed, $user); break; } WikiaDataAccess::cachePurge($this->getLastPostsMemcKey()); }
private static function purgeCacheDependingOnCats($title, $reason = null) { $app = F::app(); $purged = false; wfDebugLog(__CLASS__, __METHOD__ . 'fetching categories from MASTER'); $categories = self::getCategoriesFromTitle($title, true); if (self::hasCssUpdatesCat($categories)) { wfDebugLog(__CLASS__, __METHOD__ . $reason); WikiaDataAccess::cachePurge(wfSharedMemcKey(SpecialCssModel::MEMC_KEY, $app->wg->DBname)); $purged = true; } return $purged; }
public function purgeLastMessage() { $key = wfMemcKey(__CLASS__, '-thread-lastreply-key', $this->mThreadId); WikiaDataAccess::cachePurge($key); }
public static function onCuratedContentSave($sections) { WikiaDataAccess::cachePurge(MercuryApiController::curatedContentDataMemcKey()); foreach ($sections as $section) { WikiaDataAccess::cachePurge(MercuryApiController::curatedContentDataMemcKey($section['title'])); } return true; }
public function createDefaultBoard() { wfProfileIn(__METHOD__); $app = F::App(); if (!$this->hasAtLeast(NS_WIKIA_FORUM_BOARD, 0)) { WikiaDataAccess::cachePurge(wfMemcKey('Forum_hasAtLeast', NS_WIKIA_FORUM_BOARD, 0)); /* the wgUser swap is the only way to create page as other user then current */ $tmpUser = $app->wg->User; $app->wg->User = User::newFromName(Forum::AUTOCREATE_USER); for ($i = 1; $i <= 5; $i++) { $body = wfMessage('forum-autoboard-body-' . $i, $app->wg->Sitename)->inContentLanguage()->text(); $title = wfMessage('forum-autoboard-title-' . $i, $app->wg->Sitename)->inContentLanguage()->text(); $this->createBoard($title, $body, true); } $app->wg->User = $tmpUser; wfProfileOut(__METHOD__); return true; } wfProfileOut(__METHOD__); return false; }
/** * Update Restricted wiki list if necessary * * @param $city_id integer Wiki id in wikicities * @param $is_restricted bool True if wiki is restricted */ public static function updateRestrictedWikis($city_id, $is_restricted) { $changed = false; $restrictedWikis = self::getRestrictedWikisIds(); if ($is_restricted) { if (!in_array($city_id, $restrictedWikis)) { $restrictedWikis[] = $city_id; $changed = true; } } else { if (($index = array_search($city_id, $restrictedWikis)) !== false) { unset($restrictedWikis[$index]); $changed = true; } } if ($changed) { self::saveRestrictedWikisDB($restrictedWikis); WikiaDataAccess::cachePurge(self::getRestrictedWikisKey()); } }
/** * @param User $user * @param $group * @return bool true, it's a hook * @throws DBUnexpectedError */ static function removeGlobalGroup(User $user, $group) { global $wgWikiaGlobalUserGroups; if (!in_array($group, $wgWikiaGlobalUserGroups)) { return true; } $dbw = self::getDB(DB_MASTER); $dbw->delete('user_groups', ['ug_user' => $user->getID(), 'ug_group' => $group], __METHOD__); // Remember that the user was in this group $dbw->insert('user_former_groups', ['ufg_user' => $user->getID(), 'ufg_group' => $group], __METHOD__, ['IGNORE']); WikiaDataAccess::cachePurge(self::getMemcKey($user)); wfRunHooks('AfterUserRemoveGlobalGroup', [$user, $group]); // return true to let the User class clean up any residual staff rights stored locally return true; }
/** * Save data about hub slots displayed on wikia homepage in hubs section. * After save memcache is purged to get fresh data on wikia homepage. * * @param $hubSlotsValues data containing hub wiki id, description and links * @param $corporateId corporate wiki id * @param $lang language code */ public function saveHubSlotsToWF($hubSlotsValues, $corporateId, $lang, $varName = 'wgWikiaHomePageHubsSlots') { $status = WikiFactory::setVarByName($varName, $corporateId, $hubSlotsValues); if ($status) { WikiaDataAccess::cachePurge($this->getHubSlotsMemcacheKey($lang)); } return $status; }
static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId) { WikiaDataAccess::cachePurge(wfMemcKey(self::$memcKey)); return true; }
/** * Clear the information cached by getBanInformation * * @param int $wikiID * @param int $userID */ public static function clearBanInfoCache($wikiID, $userID) { $key = self::getBanInfoCacheKey($wikiID, $userID); WikiaDataAccess::cachePurge($key); }
private function purgeWikiaHomepageHubs() { $lang = $this->wg->ContLang->getCode(); WikiaDataAccess::cachePurge(WikiaHomePageHelper::getHubSlotsMemcacheKey($lang)); $this->getHubsServicesHelper()->purgeHomePageVarnish($lang); }
public static function purgeChatUsersCache() { WikiaDataAccess::cachePurge(self::getChatUsersMemcKey()); }
/** * Clears the cache created by the getVideoList method. As such this takes the same request parameters * as that method. */ public function clearVideoListCache() { $params = $this->getVideoListParams(); $cacheKey = $this->getVideoListCacheKey($params); \WikiaDataAccess::cachePurge($cacheKey); $this->response->setData(['status' => 'ok', 'msg' => '']); }
private function purgeCountsCache($userId) { WikiaDataAccess::cachePurge($this->getCountsCacheKey($userId)); }