예제 #1
0
 /**
  * @covers MassMessage::followRedirect
  */
 public function testFollowRedirect()
 {
     $title = Title::newfromtext('R1');
     self::updatePage($title, '#REDIRECT [[R2]]');
     $title2 = Title::newfromtext('R2');
     self::updatePage($title2, 'foo');
     $this->assertEquals($title2->getFullText(), MassMessage::followRedirect($title)->getFullText());
     $this->assertEquals($title2->getFullText(), MassMessage::followRedirect($title2)->getFullText());
 }
예제 #2
0
 /**
  * Parse and normalize the spamlist
  *
  * @param $title string
  * @return Title|string string will be a error message key
  */
 protected function getSpamlist($title)
 {
     $spamlist = Title::newFromText($title);
     if ($spamlist === null || !$spamlist->exists()) {
         return 'massmessage-spamlist-doesnotexist';
     } else {
         // Page exists, follow a redirect if possible
         $target = MassMessage::followRedirect($spamlist);
         if ($target === null || !$target->exists()) {
             return 'massmessage-spamlist-doesnotexist';
             // Interwiki redirect or non-existent page.
         } else {
             $spamlist = $target;
         }
     }
     return $spamlist;
 }