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


PHP WikiPage::doDeleteArticle方法代码示例

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


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

示例1: doDelete

 /**
  * Delete $page
  */
 protected function doDelete($page)
 {
     if ($page instanceof Title) {
         $page = new WikiPage($page);
     }
     if ($this->logActions) {
         print "Delete " . $page->getTitle() . " = " . $page->getId() . "\n";
     }
     $page->doDeleteArticle('-');
 }
开发者ID:hermannschwaerzlerUIBK,项目名称:IntraACL,代码行数:13,代码来源:evaluation.php

示例2: testImportForImportSource

 public function testImportForImportSource()
 {
     $this->doImport($this->importStreamSource);
     // Imported title
     $loremIpsum = Title::newFromText('Lorem ipsum');
     $this->assertSame($loremIpsum->getArticleID(), $loremIpsum->getArticleID(Title::GAID_FOR_UPDATE));
     $categoryLoremIpsum = Title::newFromText('Category:Lorem ipsum');
     $this->assertSame($categoryLoremIpsum->getArticleID(), $categoryLoremIpsum->getArticleID(Title::GAID_FOR_UPDATE));
     $page = new WikiPage($loremIpsum);
     $page->doDeleteArticle('import test: delete page');
     $page = new WikiPage($categoryLoremIpsum);
     $page->doDeleteArticle('import test: delete page');
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:13,代码来源:ImportLinkCacheIntegrationTest.php

示例3: createPage

 protected function createPage($page, $text, $model = null)
 {
     if (is_string($page)) {
         $page = Title::newFromText($page);
     }
     if ($page instanceof Title) {
         $page = new WikiPage($page);
     }
     if ($page->exists()) {
         $page->doDeleteArticle("done");
     }
     $page->doEdit($text, "testing", EDIT_NEW);
     return $page;
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:14,代码来源:RevisionStorageTest.php

示例4: run

 function run()
 {
     // Initialization
     $title = $this->title;
     // Other stuff
     $user = $this->getUser();
     $summary = $this->getSummary();
     $base = $this->getBase();
     $doer = User::newFromName($this->getPerformer());
     PageTranslationHooks::$allowTargetEdit = true;
     $error = '';
     $wikipage = new WikiPage($title);
     $ok = $wikipage->doDeleteArticle($summary, false, 0, true, $error, $user);
     if (!$ok) {
         $params = array('target' => $base, 'error' => $ok);
         $type = $this->getFull() ? 'deletefnok' : 'deletelnok';
         $entry = new ManualLogEntry('pagetranslation', $type);
         $entry->setPerformer($doer);
         $entry->setTarget($title);
         $entry->setParameters($params);
         $logid = $entry->insert();
         $entry->publish($logid);
     }
     PageTranslationHooks::$allowTargetEdit = false;
     $cache = wfGetCache(CACHE_DB);
     $pages = (array) $cache->get(wfMemcKey('pt-base', $base));
     $lastitem = array_pop($pages);
     if ($title->getPrefixedText() === $lastitem) {
         $cache->delete(wfMemcKey('pt-base', $base));
         $type = $this->getFull() ? 'deletefok' : 'deletelok';
         $entry = new ManualLogEntry('pagetranslation', $type);
         $entry->setPerformer($doer);
         $entry->setTarget(Title::newFromText($base));
         $logid = $entry->insert();
         $entry->publish($logid);
         $tpage = TranslatablePage::newFromTitle($title);
         $tpage->getTranslationPercentages(true);
         foreach ($tpage->getTranslationPages() as $page) {
             $page->invalidateCache();
         }
         $title->invalidateCache();
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:44,代码来源:TranslateDeleteJob.php

示例5: createPage

 protected function createPage($page, $text, $model = null)
 {
     if (is_string($page)) {
         if (!preg_match('/:/', $page) && ($model === null || $model === CONTENT_MODEL_WIKITEXT)) {
             $ns = $this->getDefaultWikitextNS();
             $page = MWNamespace::getCanonicalName($ns) . ':' . $page;
         }
         $page = Title::newFromText($page);
     }
     if ($page instanceof Title) {
         $page = new WikiPage($page);
     }
     if ($page->exists()) {
         $page->doDeleteArticle("done");
     }
     $content = ContentHandler::makeContent($text, $page->getTitle(), $model);
     $page->doEditContent($content, "testing", EDIT_NEW);
     return $page;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:19,代码来源:RevisionStorageTest.php

示例6: articleSaveComplete_SaveSD

 /**
  * This method is called after an article has been saved.
  * This is the server side of IntraACL protection toolbar,
  * allowing to modify page SD together with article save.
  *
  * No modifications are made if either:
  * - Page namespace is ACL
  * - User is anonymous
  * - Users don't have the right to modify page SD
  * - 'haloacl_protect_with' request value is invalid
  *   (valid are 'unprotected', or ID/name of predefined right or THIS page SD)
  *
  * @param WikiPage $article The article which was saved
  * @param User $user        The user who saved the article
  * @param string $text      The content of the article
  *
  * @return true
  */
 public static function articleSaveComplete_SaveSD($article, User $user, $text)
 {
     global $wgUser, $wgRequest, $haclgContLang;
     if ($user->isAnon()) {
         // Don't handle protection toolbar for anonymous users
         return true;
     }
     if ($article->getTitle()->getNamespace() == HACL_NS_ACL) {
         // Don't use protection toolbar for articles in the namespace ACL.
         // Note that embedded content protection toolbar is handled nevertheless.
         return true;
     }
     // Obtain user selection
     // hacl_protected_with == '<peType>:<peID>' or 'unprotected'
     $selectedSD = $wgRequest->getVal('hacl_protected_with');
     if ($selectedSD && $selectedSD != 'unprotected') {
         // Some SD is selected by the user
         // Ignore selection of invalid SDs
         $selectedSD = array_map('intval', explode('-', $selectedSD, 2));
         if (count($selectedSD) != 2) {
             $selectedSD = NULL;
         }
     }
     if (!$selectedSD) {
         return true;
     }
     if ($selectedSD == 'unprotected') {
         $selectedSD = NULL;
     }
     // Check if current SD must be modified
     if ($article->exists()) {
         $pageSD = IACLDefinition::getSDForPE(IACL::PE_PAGE, $article->getId());
         if ($pageSD && $selectedSD) {
             // Check if page's SD ID passed as selected
             if ($pageSD['pe_type'] == $selectedSD[0] && $pageSD['pe_id'] == $selectedSD[1]) {
                 return true;
             }
             // Check if page's SD is single inclusion and it is passed as selected
             if ($pageSD['single_child'] == $selectedSD) {
                 return true;
             }
         }
     }
     // Check if no protection selected and no protection exists
     if (!$selectedSD && !$pageSD) {
         return true;
     }
     // Check if other SD is a predefined right
     // FIXME Allow selecting non-PE_RIGHTs in quick acl toolbar?
     if ($selectedSD && $selectedSD[0] != IACL::PE_RIGHT) {
         return true;
     }
     // Check SD modification rights
     $pageSDName = IACLDefinition::nameOfSD(IACL::PE_PAGE, $article->getTitle());
     $etc = haclfDisableTitlePatch();
     $pageSDTitle = Title::newFromText($pageSDName);
     haclfRestoreTitlePatch($etc);
     if (!$pageSDTitle->userCan('edit')) {
         return true;
     }
     $newSDArticle = new WikiPage($pageSDTitle);
     if ($selectedSD) {
         // Create/modify page SD
         $selectedSDTitle = IACLDefinition::getSDTitle($selectedSD);
         $content = '{{#predefined right: ' . $selectedSDTitle->getText() . "}}\n" . '{{#manage rights: assigned to = User:' . $wgUser->getName() . "}}\n";
         $newSDArticle->doEdit($content, wfMsg('hacl_comment_protect_with', $selectedSDTitle->getFullText()));
     } else {
         // Remove page SD
         $newSDArticle->doDeleteArticle(wfMsg('hacl_comment_unprotect'));
     }
     // Continue hook processing
     return true;
 }
开发者ID:hermannschwaerzlerUIBK,项目名称:IntraACL,代码行数:91,代码来源:Toolbar.php

示例7: doDeleteArticle

 /**
  * @param $reason string
  * @param $suppress bool
  * @param $id int
  * @param $commit bool
  * @param $error string
  * @return bool
  */
 public function doDeleteArticle($reason, $suppress = false, $id = 0, $commit = true, &$error = '')
 {
     return $this->mPage->doDeleteArticle($reason, $suppress, $id, $commit, $error);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:12,代码来源:Article.php

示例8: deletePage

 public function deletePage(Title $title)
 {
     $page = new \WikiPage($title);
     $page->doDeleteArticle('SPL system test: delete page');
 }
开发者ID:transonlohk,项目名称:SubPageList,代码行数:5,代码来源:PageDeleter.php

示例9: testExists

 /**
  * @covers WikiPage::exists
  */
 public function testExists()
 {
     $page = $this->newPage("WikiPageTest_testExists");
     $this->assertFalse($page->exists());
     # -----------------
     $this->createPage($page, "some text", CONTENT_MODEL_WIKITEXT);
     $this->assertTrue($page->exists());
     $page = new WikiPage($page->getTitle());
     $this->assertTrue($page->exists());
     # -----------------
     $page->doDeleteArticle("done testing");
     $this->assertFalse($page->exists());
     $page = new WikiPage($page->getTitle());
     $this->assertFalse($page->exists());
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:18,代码来源:WikiPageTest.php

示例10: doDeleteComment

 /**
  * delete article with out any confirmation (used by wall)
  *
  * @access public
  *
  * @param $reason
  * @param bool $suppress
  *
  * @return bool
  */
 public function doDeleteComment($reason, $suppress = false)
 {
     $wikiPage = new WikiPage($this->mTitle);
     if ($wikiPage->doDeleteArticle($reason, $suppress)) {
         return true;
     }
     return false;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:ArticleComment.class.php

示例11: deleteArticle

 /**
  * @param WikiPage $article
  * @param $reason
  * @param bool $suppress
  * @param string $error
  * @return bool
  */
 private function deleteArticle($article, $reason, $suppress = false, &$error = '')
 {
     wfProfileIn(__METHOD__);
     global $wgUser;
     $id = $article->getTitle()->getArticleID(Title::GAID_FOR_UPDATE);
     if (wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason, &$error))) {
         if ($article->doDeleteArticle($reason, $suppress, $id)) {
             wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason, $id));
             wfProfileOut(__METHOD__);
             return true;
         }
     }
     wfProfileOut(__METHOD__);
     return false;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:22,代码来源:ACT.class.php


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