/**
  * @author Federico "Lox" Lucignano <*****@*****.**>
  * Performs action for cleaning up temporary data at the very end of a process
  */
 public function cleanup()
 {
     //remove phalanx user block
     if ($this->mPhalanxBlockId) {
         $ret = PhalanxHelper::removeFilter($this->mPhalanxBlockId, false);
         if ($ret['error'] == true) {
             $this->addLog("Error removing Phalanx user block with ID {$this->mPhalanxBlockId}");
         } else {
             $this->addLog("Phalanx user block with ID {$this->mPhalanxBlockId} has been removed");
         }
     }
     if ($this->mFakeUserId) {
         $this->addLog("Cleaning up process data in user option renameData for ID {$this->mFakeUserId}");
         $fakeUser = User::newFromId($this->mFakeUserId);
         $fakeUser->setOption('renameData', self::RENAME_TAG . '=' . $this->mNewUsername);
         $fakeUser->saveSettings();
         $fakeUser->saveToCache();
     }
     //TODO: Add a hook
     $hookName = 'UserRename::Cleanup';
     $this->addLog("Broadcasting hook: {$hookName}");
     wfRunHooks($hookName, array($this->mRequestorId, $this->mRequestorName, $this->mUserId, $this->mOldUsername, $this->mNewUsername));
     $tasks = array();
     if (isset($this->mGlobalTask)) {
         $tasks[] = $this->mGlobalTask->getID();
     }
     if (isset($this->mLogTask)) {
         $tasks[] = $this->mLogTask->getID();
     }
     $this->addMainLog("finish", RenameUserLogFormatter::finish($this->mRequestorName, $this->mOldUsername, $this->mNewUsername, $this->mReason, $tasks));
 }
Exemplo n.º 2
0
 /**
  * @author Federico "Lox" Lucignano <*****@*****.**>
  * Performs action for cleaning up temporary data at the very end of a process
  */
 public function cleanup()
 {
     if ($this->mFakeUserId) {
         $this->addLog("Cleaning up process data in user option renameData for ID {$this->mFakeUserId}");
         $fakeUser = User::newFromId($this->mFakeUserId);
         $fakeUser->setGlobalAttribute('renameData', self::RENAME_TAG . '=' . $this->mNewUsername);
         $fakeUser->saveSettings();
         $fakeUser->saveToCache();
     }
     //TODO: Add a hook
     $hookName = 'UserRename::Cleanup';
     $this->addLog("Broadcasting hook: {$hookName}");
     wfRunHooks($hookName, array($this->mRequestorId, $this->mRequestorName, $this->mUserId, $this->mOldUsername, $this->mNewUsername));
     $tasks = array();
     if (isset($this->mGlobalTask)) {
         $tasks[] = $this->mGlobalTask->getID();
     }
     if (isset($this->mLogTask)) {
         $tasks[] = $this->mLogTask->getID();
     }
     $this->addMainLog("finish", RenameUserLogFormatter::finish($this->mRequestorName, $this->mOldUsername, $this->mNewUsername, $this->mReason, $tasks));
 }