function __construct($key, $archive = 0) { $this->app = F::app(); switch ($key) { case 'edit': $this->mKey = self::EDIT_CATEGORY; $this->mEventType = self::EDIT_CATEGORY_INT; break; case 'create': $this->mKey = self::CREATEPAGE_CATEGORY; $this->mEventType = self::CREATEPAGE_CATEGORY_INT; break; case 'delete': $this->mKey = self::DELETE_CATEGORY; $this->mEventType = self::DELETE_CATEGORY_INT; break; case 'undelete': $this->mKey = self::UNDELETE_CATEGORY; $this->mEventType = self::UNDELETE_CATEGORY_INT; break; } $this->setCityId($this->app->wg->CityId); $this->setServerName($this->app->wg->Server); $this->setIp($this->app->wg->Request->getIP()); $this->setHostname(wfHostname()); $this->setBeaconId(wfGetBeaconId()); $this->setArchive($archive); $this->setLanguage(); $this->setCategory(); }
/** * Setup instance of EmailsStorageEntry * * @param int $sourceId type of source (see EmailsStorage class for constants with sources definition) */ public function __construct(WikiaApp $app, $sourceId) { $this->app = $app; $this->setSourceId($sourceId); // set default values $this->setCityId($this->app->wg->CityId); $this->setUserId($this->app->wg->User->getId()); $this->setBeaconId(wfGetBeaconId()); }
/** * storeData -- push data frame to Stomp * * @param String $type * @author Piotr Molski (MoLi) * @access private * */ private function send_log() { wfProfileIn(__METHOD__); try { $data = json_encode(array('cityId' => $this->mCityId, 'pageId' => $this->mPageId, 'revId' => $this->mRevId, 'logId' => $this->mLogId, 'serverName' => $this->mServerName, 'archive' => $this->mArchive, 'hostname' => wfHostname(), 'beaconId' => wfGetBeaconId())); WScribeClient::singleton($this->mKey)->send($data); } catch (TException $e) { Wikia::log(__METHOD__, 'scribeClient exception', $e->getMessage()); } wfProfileOut(__METHOD__); }
/** * Initialize performance experiments when MediaWiki starts the engine * * @param \Title $title * @param \Article $article * @param \OutputPage $output * @param \User $user * @param \WebRequest $request * @param \MediaWiki $wiki * @return bool it's a hook */ static function onAfterInitialize($title, $article, $output, $user, $request, $wiki) { global $wgAbPerformanceTestingExperiments; wfDebug(sprintf("%s - checking experiments (with beacon ID set to '%s')...\n", __METHOD__, wfGetBeaconId())); // loop through all registered experiments and run those matching criteria foreach ($wgAbPerformanceTestingExperiments as $experimentName => $experimentConfig) { if (Experiment::isEnabled($experimentConfig)) { self::startExperiment($experimentName, $experimentConfig); // leave now, we handle only a single experiment at a time now return true; } } 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; }
public function getCacheKey() { $huntId = $this->getHuntId(); if (empty($huntId)) { return false; } $userId = F::app()->wg->user->getId(); return wfSharedMemcKey('ScavengerHuntUserProgress', $userId, $userId > 0 ? 0 : wfGetBeaconId()); }
/** * 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()]); }
function __construct() { $this->mBeaconId = wfGetBeaconId(); }