当前位置: 首页>>代码示例>>PHP>>正文


PHP WikiPage::doRollback方法代码示例

本文整理汇总了PHP中WikiPage::doRollback方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiPage::doRollback方法的具体用法?PHP WikiPage::doRollback怎么用?PHP WikiPage::doRollback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WikiPage的用法示例。


在下文中一共展示了WikiPage::doRollback方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doRollback

 /**
  * @param $fromP
  * @param $summary
  * @param $token
  * @param $bot
  * @param $resultDetails
  * @param $user User
  * @return array
  */
 public function doRollback($fromP, $summary, $token, $bot, &$resultDetails, User $user = null)
 {
     $user = is_null($user) ? $this->getContext()->getUser() : $user;
     return $this->mPage->doRollback($fromP, $summary, $token, $bot, $resultDetails, $user);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:14,代码来源:Article.php

示例2: doRollback

 /**
  * @param $fromP
  * @param $summary
  * @param $token
  * @param $bot
  * @param $resultDetails
  * @param $user User
  * @return array
  */
 public function doRollback($fromP, $summary, $token, $bot, &$resultDetails, User $user = null)
 {
     global $wgUser;
     $user = is_null($user) ? $wgUser : $user;
     return $this->mPage->doRollback($fromP, $summary, $token, $bot, $resultDetails, $user);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:Article.php

示例3: testDoRollbackFailureSameContent

 /**
  * @covers WikiPage::doRollback
  */
 public function testDoRollbackFailureSameContent()
 {
     $admin = new User();
     $admin->setName("Admin");
     $admin->addGroup("sysop");
     #XXX: make the test user a sysop...
     $text = "one";
     $page = $this->newPage("WikiPageTest_testDoRollback");
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle(), CONTENT_MODEL_WIKITEXT), "section one", EDIT_NEW, false, $admin);
     $rev1 = $page->getRevision();
     $user1 = new User();
     $user1->setName("127.0.1.11");
     $user1->addGroup("sysop");
     #XXX: make the test user a sysop...
     $text .= "\n\ntwo";
     $page = new WikiPage($page->getTitle());
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle(), CONTENT_MODEL_WIKITEXT), "adding section two", 0, false, $user1);
     # now, do a the rollback from the same user was doing the edit before
     $resultDetails = array();
     $token = $user1->getEditToken(array($page->getTitle()->getPrefixedText(), $user1->getName()), null);
     $errors = $page->doRollback($user1->getName(), "testing revert same user", $token, false, $resultDetails, $admin);
     $this->assertEquals(array(), $errors, "Rollback failed same user");
     # now, try the rollback
     $resultDetails = array();
     $token = $admin->getEditToken(array($page->getTitle()->getPrefixedText(), $user1->getName()), null);
     $errors = $page->doRollback($user1->getName(), "testing revert", $token, false, $resultDetails, $admin);
     $this->assertEquals(array(array('alreadyrolled', 'WikiPageTest testDoRollback', '127.0.1.11', 'Admin')), $errors, "Rollback not failed");
     $page = new WikiPage($page->getTitle());
     $this->assertEquals($rev1->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision");
     $this->assertEquals("one", $page->getContent()->getNativeData());
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:34,代码来源:WikiPageTest.php

示例4: testDoRollback

 /**
  * @todo FIXME: the above rollback test is better, but it keeps failing in jenkins for some reason.
  */
 public function testDoRollback()
 {
     $admin = new User();
     $admin->setName("Admin");
     $text = "one";
     $page = $this->newPage("WikiPageTest_testDoRollback");
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle(), CONTENT_MODEL_WIKITEXT), "section one", EDIT_NEW, false, $admin);
     $rev1 = $page->getRevision();
     $user1 = new User();
     $user1->setName("127.0.1.11");
     $text .= "\n\ntwo";
     $page = new WikiPage($page->getTitle());
     $page->doEditContent(ContentHandler::makeContent($text, $page->getTitle(), CONTENT_MODEL_WIKITEXT), "adding section two", 0, false, $user1);
     # now, try the rollback
     $admin->addGroup("sysop");
     #XXX: make the test user a sysop...
     $token = $admin->getEditToken(array($page->getTitle()->getPrefixedText(), $user1->getName()), null);
     $errors = $page->doRollback($user1->getName(), "testing revert", $token, false, $details, $admin);
     if ($errors) {
         $this->fail("Rollback failed:\n" . print_r($errors, true) . ";\n" . print_r($details, true));
     }
     $page = new WikiPage($page->getTitle());
     $this->assertEquals($rev1->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision");
     $this->assertEquals("one", $page->getContent()->getNativeData());
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:28,代码来源:WikiPageTest.php


注:本文中的WikiPage::doRollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。