當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。