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


PHP SquidUpdate::newSimplePurge方法代码示例

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


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

示例1: doPurge

	/**
	 * Perform the actions of a page purging
	 * @return bool
	 */
	public function doPurge() {
		global $wgUseSquid;

		if ( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
			return false;
		}

		// Invalidate the cache
		$this->mTitle->invalidateCache();

		if ( $wgUseSquid ) {
			// Commit the transaction before the purge is sent
			$dbw = wfGetDB( DB_MASTER );
			$dbw->commit( __METHOD__ );

			// Send purge
			$update = SquidUpdate::newSimplePurge( $this->mTitle );
			$update->doUpdate();
		}

		if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
			// @todo move this logic to MessageCache

			if ( $this->exists() ) {
				// NOTE: use transclusion text for messages.
				//       This is consistent with  MessageCache::getMsgFromNamespace()

				$content = $this->getContent();
				$text = $content === null ? null : $content->getWikitextForTransclusion();

				if ( $text === null ) {
					$text = false;
				}
			} else {
				$text = false;
			}

			MessageCache::singleton()->replace( $this->mTitle->getDBkey(), $text );
		}
		return true;
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:45,代码来源:WikiPage.php

示例2: doPurge

 /**
  * Perform the actions of a page purging
  */
 public function doPurge()
 {
     global $wgUseSquid;
     if (!wfRunHooks('ArticlePurge', array(&$this))) {
         return false;
     }
     // Invalidate the cache
     $this->mTitle->invalidateCache();
     $this->clear();
     if ($wgUseSquid) {
         // Commit the transaction before the purge is sent
         $dbw = wfGetDB(DB_MASTER);
         $dbw->commit();
         // Send purge
         $update = SquidUpdate::newSimplePurge($this->mTitle);
         $update->doUpdate();
     }
     if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
         if ($this->getId() == 0) {
             $text = false;
         } else {
             $text = $this->getRawText();
         }
         MessageCache::singleton()->replace($this->mTitle->getDBkey(), $text);
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:29,代码来源:WikiPage.php

示例3: doPurge

 /**
  * Perform the actions of a page purging
  */
 public function doPurge()
 {
     global $wgUseSquid;
     // Invalidate the cache
     $this->mTitle->invalidateCache();
     if ($wgUseSquid) {
         // Commit the transaction before the purge is sent
         $dbw = wfGetDB(DB_MASTER);
         $dbw->commit();
         // Send purge
         $update = SquidUpdate::newSimplePurge($this->mTitle);
         $update->doUpdate();
     }
     if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
         global $wgMessageCache;
         if ($this->getID() == 0) {
             $text = false;
         } else {
             $text = $this->getRawText();
         }
         $wgMessageCache->replace($this->mTitle->getDBkey(), $text);
     }
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:26,代码来源:Article.php

示例4: doPurge

 /**
  * Perform the actions of a page purging
  * @return bool
  */
 public function doPurge()
 {
     if (!Hooks::run('ArticlePurge', array(&$this))) {
         return false;
     }
     $title = $this->mTitle;
     wfGetDB(DB_MASTER)->onTransactionIdle(function () use($title) {
         global $wgUseSquid;
         // Invalidate the cache in auto-commit mode
         $title->invalidateCache();
         if ($wgUseSquid) {
             // Send purge now that page_touched update was committed above
             $update = SquidUpdate::newSimplePurge($title);
             $update->doUpdate();
         }
     });
     if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
         // @todo move this logic to MessageCache
         if ($this->exists()) {
             // NOTE: use transclusion text for messages.
             //       This is consistent with  MessageCache::getMsgFromNamespace()
             $content = $this->getContent();
             $text = $content === null ? null : $content->getWikitextForTransclusion();
             if ($text === null) {
                 $text = false;
             }
         } else {
             $text = false;
         }
         MessageCache::singleton()->replace($this->mTitle->getDBkey(), $text);
     }
     return true;
 }
开发者ID:jongfeli,项目名称:mediawiki,代码行数:37,代码来源:WikiPage.php

示例5: doPurge

 /**
  * Perform the actions of a page purging
  */
 function doPurge()
 {
     global $wgUseSquid;
     // Invalidate the cache
     $this->mTitle->invalidateCache();
     if ($wgUseSquid) {
         // Commit the transaction before the purge is sent
         $dbw = wfGetDB(DB_MASTER);
         $dbw->immediateCommit();
         // Send purge
         $update = SquidUpdate::newSimplePurge($this->mTitle);
         $update->doUpdate();
     }
     $this->view();
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:18,代码来源:Article.php

示例6: hideRevision

 /**
  * Actually go in the database and kill things.
  * @return message key string for success or failure message
  */
 function hideRevision($dbw, $id)
 {
     global $wgUser;
     $dbw->begin();
     $rev = Revision::newFromId($id);
     if (is_null($rev)) {
         $dbw->rollback();
         return 'hiderevision-error-missing';
     }
     if ($rev->isCurrent()) {
         $dbw->rollback();
         return 'hiderevision-error-current';
     }
     $title = $rev->getTitle();
     // Our tasks:
     // Copy revision to "hidden" table
     $this->InsertRevision($dbw, $title, $rev);
     if ($dbw->affectedRows() != 1) {
         $dbw->rollback();
         return 'hiderevision-error-delete';
     }
     // Remove from "revision"
     $dbw->delete('revision', array('rev_id' => $id), __FUNCTION__);
     // Remove from "recentchanges"
     // The page ID is used to get us a relatively usable index
     $dbw->delete('recentchanges', array('rc_cur_id' => $rev->getPage(), 'rc_this_oldid' => $id), __METHOD__);
     // Invalidate cache of page history
     $title->invalidateCache();
     // Done with all database pieces; commit!
     $dbw->commit();
     // Also purge remote proxies.
     // Ideally this would be built into the above, but squid code is
     // old crappy style.
     global $wgUseSquid;
     if ($wgUseSquid) {
         // Send purge
         $update = SquidUpdate::newSimplePurge($title);
         $update->doUpdate();
     }
     return 'hiderevision-success';
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:45,代码来源:HideRevision_body.php

示例7: wfPurgeTitle

function wfPurgeTitle($title)
{
    global $wgUseSquid;
    wfProfileIn(__METHOD__);
    $title->invalidateCache();
    if ($wgUseSquid) {
        // Commit the transaction before the purge is sent
        $dbw = wfGetDB(DB_MASTER);
        $dbw->commit();
        // Send purge
        $update = SquidUpdate::newSimplePurge($title);
        $update->doUpdate();
    }
    wfProfileOut(__METHOD__);
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:ImageTagging.php

示例8: purgeTitle

 public static function purgeTitle($title, $fudgeSeconds = 0)
 {
     global $wgUseSquid, $wrPurgingTitles;
     $ts = time() + $fudgeSeconds;
     if (!isset($wrPurgingTitles) || @$wrPurgingTitles[$title->getPrefixedText()] != $ts) {
         $title->invalidateCache($ts);
         if ($wgUseSquid) {
             // Send purge
             $update = SquidUpdate::newSimplePurge($title);
             $update->doUpdate();
         }
     }
     if (!isset($wrPurgingTitles)) {
         $wrPurgingTitles = array();
     }
     $wrPurgingTitles[$title->getPrefixedText()] = $ts;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:17,代码来源:StructuredData.php

示例9: purgeKey

 /**
  * Purges the API key passed in.  This is in config so that each implementation can
  * override it as needed.  This particular implmentation is MediaWiki-specific.
  */
 public static function purgeKey($apiKey)
 {
     global $wgUseSquid, $wgServer;
     wfProfileIn(__METHOD__);
     if ($wgUseSquid) {
         // Send purge to Fastly so that it re-checks the auth on the next API request.
         $title = $wgServer . "/api.php?checkKey={$apiKey}";
         $update = SquidUpdate::newSimplePurge($title);
         $update->doUpdate();
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:yusufchang,项目名称:app,代码行数:16,代码来源:ApiGate_Config.php

示例10: doSubmit

 /**
  * doSubmit
  *
  * parse tag attributes
  *
  * @author Krzysztof Krzyżaniak <eloy@wikia.com>
  * @access public
  *
  * @param object	$request	WebRequest object
  *
  * @return array	rendered HTML answer and status of operation
  */
 public function doSubmit(&$request)
 {
     global $wgUser, $wgTitle, $parserMemc;
     wfProfileIn(__METHOD__);
     $status = false;
     $vote = $request->getVal("wpPollRadio" . $this->mId, null);
     if (!is_null($vote)) {
         if ($this->doVote($vote)) {
             $status = wfMsg("ajaxpoll-thankyou");
             // invalidate cache
             $wgTitle->invalidateCache();
             // clear parser cache
             $oArticle = new Article($wgTitle);
             $parserCache =& ParserCache::singleton();
             $parserMemc->set($parserCache->getKey($oArticle, $wgUser), null, 0);
             // Send purge
             $update = SquidUpdate::newSimplePurge($wgTitle);
             $update->doUpdate();
         } else {
             $status = wfMsg("ajaxpoll-error");
         }
     }
     list($votes, $total) = $this->getVotes(true);
     //true because we need DB_MASTER and we don't want to use memcache here
     $response = array("id" => $this->mId, "votes" => $votes, "total" => $total, "status" => $status);
     // Purge the vote stats.
     global $wgMemc;
     $memcKey = wfMemcKey(self::MEMC_PREFIX_GETVOTES, $this->mId);
     $wgMemc->delete($memcKey);
     wfProfileOut(__METHOD__);
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:44,代码来源:AjaxPoll_body.php


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