public function processSaveComplete($article, $user, $revision, $status) { wfProfileIn(__METHOD__); $this->mUser = $user; if (self::canEarnBadges($this->mUser)) { $this->mArticle = $article; $this->mRevision = $revision; if ($this->mArticle) { // logic should be processed only one time during one request if (!self::$mDone) { $this->mStatus = $status; $this->mTitle = $this->mArticle->getTitle(); $this->mUserCountersService = new AchUserCountersService($this->mUser->getID()); $this->mCounters = $this->mUserCountersService->getCounters(); $this->loadUserBadges(); $this->processAllNotInTrack(); $this->processAllInTrack(); $this->mUserCountersService->setCounters($this->mCounters); $this->mUserCountersService->save(); $this->processCountersForInTrack(); $this->saveBadges(); if (count($this->mNewBadges) > 0) { $this->calculateAndSaveScore(); } self::$mDone = true; } } } wfProfileOut(__METHOD__); }