X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FRevision.php;h=b3b971b17acc52b4852292cb6da0b2d4b75ba0ee;hb=368cc2e28d5cffcddb504af9e94eacba6612df52;hp=47626a22b3fd1ed143884bef17948d5cfd5b4744;hpb=709c614382c199b7d3c5fc5bdbd285d8d3a5f339;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Revision.php b/includes/Revision.php index 47626a22b3..b3b971b17a 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -867,24 +867,37 @@ class Revision implements IDBAccessObject { } /** - * @return Integer rcid of the unpatrolled row, zero if there isn't one + * @return integer rcid of the unpatrolled row, zero if there isn't one */ public function isUnpatrolled() { if ( $this->mUnpatrolled !== null ) { return $this->mUnpatrolled; } + $rc = $this->getRecentChange(); + if ( $rc && $rc->getAttribute( 'rc_patrolled' ) == 0 ) { + $this->mUnpatrolled = $rc->getAttribute( 'rc_id' ); + } else { + $this->mUnpatrolled = 0; + } + return $this->mUnpatrolled; + } + + /** + * Get the RC object belonging to the current revision, if there's one + * + * @since 1.22 + * @return RecentChange|null + */ + public function getRecentChange() { $dbr = wfGetDB( DB_SLAVE ); - $this->mUnpatrolled = $dbr->selectField( 'recentchanges', - 'rc_id', - array( // Add redundant user,timestamp condition so we can use the existing index + return RecentChange::newFromConds( + array( 'rc_user_text' => $this->getRawUserText(), 'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ), - 'rc_this_oldid' => $this->getId(), - 'rc_patrolled' => 0 + 'rc_this_oldid' => $this->getId() ), __METHOD__ ); - return (int)$this->mUnpatrolled; } /**