コード例 #1
0
 static function getMarkPatrolledLink()
 {
     global $wgRequest, $wgUser;
     // Append a [Mark as Patrolled] link in certain cases
     $markPatrolledLink = '';
     $rcid = $wgRequest->getInt('rcid');
     $fromRC = $wgRequest->getInt('fromrc');
     if ($wgUser && $rcid > 0 && $fromRC && $wgUser->isAllowed('patrol')) {
         $rc = RecentChange::newFromId($rcid);
         if ($rc) {
             $oldRevId = $rc->getAttribute('rc_last_oldid');
             $newRevId = $rc->getAttribute('rc_this_oldid');
             $diff = new DifferenceEngine(null, $oldRevId, $newRevId);
             if ($diff->loadRevisionData()) {
                 $markPatrolledLink = $diff->markPatrolledLink();
             } else {
                 throw new MWException("wikiHow internal error: we know there is an rcid ({$rcid}) and newrevid ({$newRevId}), but couldn't find the revision");
             }
         }
     }
     return $markPatrolledLink;
 }