Example #1
0
 /**
  * Get the temporary prepared edit stash key for a user
  *
  * This key can be used for caching prepared edits provided:
  *   - a) The $user was used for PST options
  *   - b) The parser output was made from the PST using cannonical matching options
  *
  * @param Title $title
  * @param Content $content
  * @param User $user User to get parser options from
  * @return string
  */
 protected static function getStashKey(Title $title, Content $content, User $user)
 {
     $hash = sha1(implode(':', array($content->getModel(), $content->getDefaultFormat(), sha1($content->serialize($content->getDefaultFormat())), $user->getId() ?: md5($user->getName()), $user->getId() ? $user->getTouched() : '-')));
     return wfMemcKey('prepared-edit', md5($title->getPrefixedDBkey()), $hash);
 }
 /**
  * Prepares array of user fields needed to be passed by API
  * @param User $oUser
  * @return array
  */
 public function prepareUserParams(\User $oUser)
 {
     $aUserParams = ['user_id' => $oUser->getId(), 'user_name' => $oUser->getName(), 'user_real_name' => $oUser->getRealName(), 'user_email' => $oUser->getEmail(), 'user_email_authenticated' => $oUser->getEmailAuthenticationTimestamp(), 'user_registration' => $oUser->getRegistration(), 'user_editcount' => (int) $oUser->getEditCount(), 'user_touched' => $oUser->getTouched()];
     return $aUserParams;
 }