+ /**
+ * 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() ) {
+ $newMessageRevision = $newMessageLinks[0]['rev'];
+ $newMessageRevisionId = $newMessageRevision->getId();
+ } else {
+ throw new MWException( "Unexpected values from User::getNewMessageLinks()" );
+ }
+ }
+ return $newMessageRevisionId;
+ }
+