*
* @param $item String
*/
- private function setItemLoaded( $item ) {
+ protected function setItemLoaded( $item ) {
if ( is_array( $this->mLoadedItems ) ) {
$this->mLoadedItems[$item] = true;
}
}
/**
- * Return the talk page(s) this user has new messages on.
- * @return Array of String page URLs
+ * Return the revision and link for the oldest new talk page message for
+ * this user.
+ * Note: This function was designed to accomodate multiple talk pages, but
+ * currently only returns a single link and revision.
+ * @return Array
*/
public function getNewMessageLinks() {
$talks = array();
return array( array( 'wiki' => wfWikiID(), 'link' => $utp->getLocalURL(), 'rev' => $rev ) );
}
+ /**
+ * Get the revision ID for the oldest new talk page message for this user
+ * @return Integer or null if there are no new messages
+ */
+ public function getNewMessageRevisionId() {
+ $newMessageRevisionId = null;
+ $newMessageLinks = $this->getNewMessageLinks();
+ if ( $newMessageLinks ) {
+ // Note: getNewMessageLinks() never returns more than a single link
+ // and it is always for the same wiki, but we double-check here in
+ // case that changes some time in the future.
+ if ( count( $newMessageLinks ) === 1
+ && $newMessageLinks[0]['wiki'] === wfWikiID()
+ && $newMessageLinks[0]['rev']
+ ) {
+ $newMessageRevision = $newMessageLinks[0]['rev'];
+ $newMessageRevisionId = $newMessageRevision->getId();
+ }
+ }
+ return $newMessageRevisionId;
+ }
+
/**
* Internal uncached check for new messages
*
*/
public function useNPPatrol() {
global $wgUseRCPatrol, $wgUseNPPatrol;
- return( ( $wgUseRCPatrol || $wgUseNPPatrol ) && ( $this->isAllowedAny( 'patrol', 'patrolmarks' ) ) );
+ return ( ( $wgUseRCPatrol || $wgUseNPPatrol ) && ( $this->isAllowedAny( 'patrol', 'patrolmarks' ) ) );
}
/**
}
if ( !$loaded ) {
throw new MWException( __METHOD__ . ": hit a key conflict attempting " .
- "to insert a user row, but then it doesn't exist when we select it!" );
+ "to insert user '{$this->mName}' row, but it was not present in select!" );
}
return Status::newFatal( 'userexists' );
}
* @param &$expiration \mixed Accepts the expiration time
* @return String New token
*/
- private function confirmationToken( &$expiration ) {
+ protected function confirmationToken( &$expiration ) {
global $wgUserEmailConfirmationTokenExpiry;
$now = time();
$expires = $now + $wgUserEmailConfirmationTokenExpiry;
* @param string $token Accepts the email confirmation token
* @return String New token URL
*/
- private function confirmationTokenUrl( $token ) {
+ protected function confirmationTokenUrl( $token ) {
return $this->getTokenUrl( 'ConfirmEmail', $token );
}
* @param string $token Accepts the email confirmation token
* @return String New token URL
*/
- private function invalidationTokenUrl( $token ) {
+ protected function invalidationTokenUrl( $token ) {
return $this->getTokenUrl( 'InvalidateEmail', $token );
}
*
* @return array Array of HTML attributes suitable for feeding to
* Html::element(), directly or indirectly. (Don't feed to Xml::*()!
- * That will potentially output invalid XHTML 1.0 Transitional, and will
- * get confused by the boolean attribute syntax used.)
+ * That will get confused by the boolean attribute syntax used.)
*/
public static function passwordChangeInputAttribs() {
global $wgMinimalPasswordLength;