public static function onArticleSaveComplete($article, $user, $revision, $status) { wfProfileIn(__METHOD__); $insertedImages = Wikia::getVar('imageInserts'); $imageDeletes = Wikia::getVar('imageDeletes'); $changedImages = $imageDeletes; foreach ($insertedImages as $img) { $changedImages[$img['il_to']] = true; } $sendTrackEvent = false; foreach ($changedImages as $imageDBName => $dummy) { $title = Title::newFromDBkey($imageDBName); if (!empty($title)) { $mq = new self($title); $mq->unsetCache(); $sendTrackEvent = true; } } // send track event if embed change if ($sendTrackEvent) { Track::event('embed_change'); } wfProfileOut(__METHOD__); return true; }
/** * Track an event * * @param User $user User account the event is affecting * @param string $action The type of close account event, can be one of * request-closure, request-reactivation, account-reactivated, * account-closed * @return void */ public function track(User $user, $action) { global $wgUser, $wgDevelEnvironment; // Make sure the right user is set for the user ID that will be collected // when called from the maintenance script $oldUser = $wgUser; $wgUser = $user; Track::event('trackingevent', ['ga_action' => 'submit', 'ga_category' => 'closemyaccount', 'ga_label' => $action, 'beacon' => !empty($wgDevelEnvironment) ? 'ThisIsFake' : wfGetBeaconId()]); $wgUser = $oldUser; }
/** * perform search * @param WikiaSearchConfig $searchConfig * @return WikiaSearchResultSet */ public function doSearch(WikiaSearchConfig $searchConfig) { wfProfileIn(__METHOD__); if ($searchConfig->getGroupResults() == true) { $searchConfig->setLength(self::GROUP_RESULTS_GROUPINGS_LIMIT)->setIsInterWiki(true)->setStart((int) $searchConfig->getLength() * ((int) $searchConfig->getPage() - 1)); } else { $searchConfig->setStart(($searchConfig->getPage() - 1) * $searchConfig->getLength()); } try { $result = $this->client->select($this->getSelectQuery($searchConfig)); } catch (Exception $e) { Wikia::log(__METHOD__, 'Querying Solr First Time', $e); $searchConfig->setSkipBoostFunctions(true); try { $result = $this->client->select($this->getSelectQuery($searchConfig)); } catch (Exception $e) { Wikia::log(__METHOD__, 'Querying Solr With No Boost Functions', $e); $result = F::build('Solarium_Result_Select_Empty'); } } $results = F::build('WikiaSearchResultSet', array($result, $searchConfig)); $searchConfig->setResults($results)->setResultsFound($results->getResultsFound()); if ($searchConfig->getPage() == 1) { $resultCount = $results->getResultsFound(); Track::event(!empty($resultCount) ? 'search_start' : 'search_start_nomatch', array('sterm' => $searchConfig->getQuery(), 'rver' => self::RELEVANCY_FUNCTION_ID, 'stype' => $searchConfig->getCityId() == 0 ? 'inter' : 'intra')); } wfProfileOut(__METHOD__); return $results; }
/** * Track an event with a given label with user-sign-up category * @param string $label * @param string $action optional, 'submit' by default */ public static function track($label, $action = 'submit') { \Track::event('trackingevent', ['ga_action' => $action, 'ga_category' => 'user-sign-up', 'ga_label' => $label, 'beacon' => !empty(F::app()->wg->DevelEnvironment) ? 'ThisIsFake' : wfGetBeaconId()]); }
/** * Track an event with a given label with category 'user-sign-up' and action 'request' * * @param string $label */ protected function track($label) { \Track::event('trackingevent', ['ga_category' => 'user-sign-up', 'ga_action' => 'request', 'ga_label' => $label, 'beacon' => !empty($this->wg->DevelEnvironment) ? 'ThisIsFake' : wfGetBeaconId()]); }