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


PHP WikiPage::doUpdateRestrictions方法代码示例

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


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

示例1: protectMessageInPrNamespaces

 /**
  * Protects a message entry in the PRAd namespace.
  * The protection lasts for infinity and acts for group
  * @ref $wgPromoterProtectGroup
  *
  * This really is intended only for use on the original source language
  * because those messages are set via the PR UI; not the translate UI.
  *
  * @param WikiPage $page Page containing the message to protect
  * @param User     $user User doing the protection (ie: the last one to edit the page)
  */
 protected function protectMessageInPrNamespaces($page, $user)
 {
     global $wgPromoterProtectGroup;
     if (!$page->getTitle()->getRestrictions('edit')) {
         $var = false;
         $page->doUpdateRestrictions(array('edit' => $wgPromoterProtectGroup, 'move' => $wgPromoterProtectGroup), array('edit' => 'infinity', 'move' => 'infinity'), $var, 'Auto protected by Promoter -- Only edit via Special:Promoter.', $user);
     }
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-Promoter,代码行数:19,代码来源:AdMessage.php

示例2: updateRestrictions

	/**
	 * @param $limit array
	 * @param $reason string
	 * @param $cascade int
	 * @param $expiry array
	 * @return bool
	 */
	public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
		return $this->mPage->doUpdateRestrictions(
			$limit,
			$expiry,
			$cascade,
			$reason,
			$this->getContext()->getUser()
		);
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:16,代码来源:Article.php

示例3: doUpdateRestrictions

 /**
  * @param $limit array
  * @param $expiry array
  * @param $cascade bool
  * @param $reason string
  * @param $user User
  * @return Status
  */
 public function doUpdateRestrictions(array $limit, array $expiry, &$cascade, $reason, User $user)
 {
     return $this->mPage->doUpdateRestrictions($limit, $expiry, $cascade, $reason, $user);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:Article.php

示例4: flag_to_semi_protect

 protected function flag_to_semi_protect(User $user, $reason)
 {
     global $wgFlaggedRevsNamespaces;
     $this->output("Semi-protecting all flag-protected pages...\n");
     if (!$wgFlaggedRevsNamespaces) {
         $this->output("\$wgFlaggedRevsNamespaces is empty.\n");
         return;
     }
     $db = wfGetDB(DB_MASTER);
     $start = $db->selectField('flaggedpage_config', 'MIN(fpc_page_id)', false, __FUNCTION__);
     $end = $db->selectField('flaggedpage_config', 'MAX(fpc_page_id)', false, __FUNCTION__);
     if (is_null($start) || is_null($end)) {
         $this->output("...flaggedpage_config table seems to be empty.\n");
         return;
     }
     # Do remaining chunk
     $end += $this->mBatchSize - 1;
     $blockStart = $start;
     $blockEnd = $start + $this->mBatchSize - 1;
     $count = 0;
     while ($blockEnd <= $end) {
         $this->output("...doing fpc_page_id from {$blockStart} to {$blockEnd}\n");
         $res = $db->select(array('flaggedpage_config', 'page'), array('fpc_page_id', 'fpc_level', 'fpc_expiry'), array("fpc_page_id BETWEEN {$blockStart} AND {$blockEnd}", 'page_namespace' => $wgFlaggedRevsNamespaces, 'page_id = fpc_page_id', "fpc_level != ''"), __FUNCTION__);
         # Go through and protect each page...
         foreach ($res as $row) {
             $title = Title::newFromId($row->fpc_page_id);
             if ($title->isProtected('edit')) {
                 continue;
                 // page already has edit protection - skip it
             }
             # Flagged protection settings
             $frLimit = trim($row->fpc_level);
             $frExpiry = $row->fpc_expiry === $db->getInfinity() ? 'infinity' : wfTimestamp(TS_MW, $row->fpc_expiry);
             # Build the new protection settings
             $cascade = 0;
             $limit = $expiry = array();
             $desc = array();
             // for output
             foreach ($title->getRestrictionTypes() as $type) {
                 # Get existing restrictions for this action
                 $oldLimit = $title->getRestrictions($type);
                 // array
                 $oldExpiry = $title->getRestrictionExpiry($type);
                 // MW_TS
                 # Move or Edit rights - take highest of (flag,type) settings
                 if ($type == 'edit' || $type == 'move') {
                     # Sysop flag-protect -> full protect
                     if ($frLimit == 'sysop' || in_array('sysop', $oldLimit)) {
                         $newLimit = 'sysop';
                         # Reviewer/autoconfirmed flag-protect -> semi-protect
                     } else {
                         $newLimit = 'autoconfirmed';
                     }
                     # Take highest expiry of (flag,type) settings
                     $newExpiry = !$oldLimit || $frExpiry >= $oldExpiry ? $frExpiry : $oldExpiry;
                     # Otherwise - maintain original limits
                 } else {
                     $newLimit = $oldLimit;
                     $newExpiry = $oldExpiry;
                 }
                 $limit[$type] = $newLimit;
                 $expiry[$type] = $newExpiry;
                 $desc[] = "{$type}={$newLimit}: {$newExpiry}";
             }
             $db->begin();
             $article = new WikiPage($title);
             $ok = $article->doUpdateRestrictions($limit, $reason, $cascade, $expiry, $user);
             if ($ok) {
                 $count++;
             } else {
                 $this->output("Could not protect: " . $title->getPrefixedText() . "\n");
             }
             $db->commit();
         }
         $db->freeResult($res);
         $blockStart += $this->mBatchSize - 1;
         $blockEnd += $this->mBatchSize - 1;
         wfWaitForSlaves(5);
     }
     $this->output("Protection of all flag-protected pages complete ... {$count} pages\n");
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:81,代码来源:flagToSemiProtect.php


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