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


PHP LinksUpdate类代码示例

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


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

示例1: run

 /**
  * Run a refreshLinks job
  * @return boolean success
  */
 function run()
 {
     global $wgParser;
     wfProfileIn(__METHOD__);
     $linkCache =& LinkCache::singleton();
     $linkCache->clear();
     if (is_null($this->title)) {
         $this->error = "refreshLinks: Invalid title";
         wfProfileOut(__METHOD__);
         return false;
     }
     $revision = Revision::newFromTitle($this->title);
     if (!$revision) {
         $this->error = 'refreshLinks: Article not found "' . $this->title->getPrefixedDBkey() . '"';
         wfProfileOut(__METHOD__);
         return false;
     }
     wfProfileIn(__METHOD__ . '-parse');
     $options = new ParserOptions();
     $parserOutput = $wgParser->parse($revision->getText(), $this->title, $options, true, true, $revision->getId());
     wfProfileOut(__METHOD__ . '-parse');
     wfProfileIn(__METHOD__ . '-update');
     $update = new LinksUpdate($this->title, $parserOutput, false);
     $update->doUpdate();
     wfProfileOut(__METHOD__ . '-update');
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:32,代码来源:RefreshLinksJob.php

示例2: testDoUpdateUsingUserdefinedAnnotations

 /**
  * @depends testUpdateToSetPredefinedAnnotations
  */
 public function testDoUpdateUsingUserdefinedAnnotations()
 {
     $this->pageCreator->createPage($this->title)->doEdit('[[HasFirstLinksUpdatetest::testDoUpdate]] [[HasSecondLinksUpdatetest::testDoUpdate]]');
     $parserData = $this->applicationFactory->newParserData($this->title, $this->pageCreator->getEditInfo()->output);
     $contentParser = $this->applicationFactory->newContentParser($this->title);
     $contentParser->parse();
     $parsedParserData = $this->applicationFactory->newParserData($this->title, $contentParser->getOutput());
     $this->assertCount(4, $parserData->getSemanticData()->getProperties());
     $this->assertCount(4, $this->getStore()->getSemanticData(DIWikiPage::newFromTitle($this->title))->getProperties());
     /**
      * See #347 and LinksUpdateConstructed
      */
     $linksUpdate = new \LinksUpdate($this->title, new \ParserOutput());
     $linksUpdate->doUpdate();
     $this->testEnvironment->executePendingDeferredUpdates();
     /**
      * Asserts that before and after the update, the SemanticData container
      * holds the same amount of properties despite the fact that the ParserOutput
      * was invoked empty
      */
     $semanticData = $this->getStore()->getSemanticData(DIWikiPage::newFromTitle($this->title));
     $this->assertCount(4, $semanticData->getProperties());
     $expected = array('propertyKeys' => array('_SKEY', '_MDAT', 'HasFirstLinksUpdatetest', 'HasSecondLinksUpdatetest'));
     $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $semanticData);
     return $this->pageCreator->getPage()->getRevision();
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:29,代码来源:LinksUpdateTest.php

示例3: updateLinksAfterEdit

 /**
  * Call LinksUpdate on the text of this page's approved revision,
  * if there is one.
  */
 public static function updateLinksAfterEdit(&$page, &$editInfo, $changed)
 {
     $title = $page->getTitle();
     if (!ApprovedRevs::pageIsApprovable($title)) {
         return true;
     }
     // If this user's revisions get approved automatically,
     // exit now, because this will be the approved
     // revision anyway.
     if (self::userRevsApprovedAutomatically($title)) {
         return true;
     }
     $text = '';
     $approvedText = ApprovedRevs::getApprovedContent($title);
     if (!is_null($approvedText)) {
         $text = $approvedText;
     }
     // If there's no approved revision, and 'blank if
     // unapproved' is set to true, set the text to blank.
     if (is_null($approvedText)) {
         global $egApprovedRevsBlankIfUnapproved;
         if ($egApprovedRevsBlankIfUnapproved) {
             $text = '';
         } else {
             // If it's an unapproved page and there's no
             // page blanking, exit here.
             return true;
         }
     }
     $editInfo = $page->prepareTextForEdit($text);
     $u = new LinksUpdate($page->mTitle, $editInfo->output);
     $u->doUpdate();
     return true;
 }
开发者ID:emanspeaks,项目名称:ApprovedRevs,代码行数:38,代码来源:ApprovedRevs.hooks.php

示例4: fixLinksFromArticle

function fixLinksFromArticle( $id ) {
	global $wgTitle, $wgParser;

	$wgTitle = Title::newFromID( $id );
	$dbw = wfGetDB( DB_MASTER );

	$linkCache =& LinkCache::singleton();
	$linkCache->clear();

	if ( is_null( $wgTitle ) ) {
		return;
	}
	$dbw->begin();

	$revision = Revision::newFromTitle( $wgTitle );
	if ( !$revision ) {
		return;
	}

	$options = new ParserOptions;
	$parserOutput = $wgParser->parse( $revision->getText(), $wgTitle, $options, true, true, $revision->getId() );
	$update = new LinksUpdate( $wgTitle, $parserOutput, false );
	$update->doUpdate();
	$dbw->commit();
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:videoCleanup.php

示例5: onLinksUpdateComplete

 /**
  * Invalidates the cache for a campaign when any of its dependents are edited. The 'dependents'
  * are tracked by entries in the templatelinks table, which are inserted by using the
  * PageContentSaveComplete hook.
  *
  * This is usually run via the Job Queue mechanism.
  */
 public static function onLinksUpdateComplete(LinksUpdate &$linksupdate)
 {
     if (!$linksupdate->getTitle()->inNamespace(NS_CAMPAIGN)) {
         return true;
     }
     $campaign = new UploadWizardCampaign($linksupdate->getTitle());
     $campaign->invalidateCache();
     return true;
 }
开发者ID:robksawyer,项目名称:lathe.tools,代码行数:16,代码来源:CampaignHooks.php

示例6: execute

 /**
  * Purges the cache of a page
  */
 public function execute()
 {
     global $wgUser;
     $params = $this->extractRequestParams();
     if (!$wgUser->isAllowed('purge') && !$this->getMain()->isInternalMode() && !$this->getMain()->getRequest()->wasPosted()) {
         $this->dieUsageMsg(array('mustbeposted', $this->getModuleName()));
     }
     $forceLinkUpdate = $params['forcelinkupdate'];
     $result = array();
     foreach ($params['titles'] as $t) {
         $r = array();
         $title = Title::newFromText($t);
         if (!$title instanceof Title) {
             $r['title'] = $t;
             $r['invalid'] = '';
             $result[] = $r;
             continue;
         }
         ApiQueryBase::addTitleInfo($r, $title);
         if (!$title->exists()) {
             $r['missing'] = '';
             $result[] = $r;
             continue;
         }
         $context = $this->createContext();
         $context->setTitle($title);
         $article = Article::newFromTitle($title, $context);
         $article->doPurge();
         // Directly purge and skip the UI part of purge().
         $r['purged'] = '';
         if ($forceLinkUpdate) {
             if (!$wgUser->pingLimiter()) {
                 global $wgParser, $wgEnableParserCache;
                 $popts = new ParserOptions();
                 $p_result = $wgParser->parse($article->getContent(), $title, $popts);
                 # Update the links tables
                 $u = new LinksUpdate($title, $p_result);
                 $u->doUpdate();
                 $r['linkupdate'] = '';
                 if ($wgEnableParserCache) {
                     $pcache = ParserCache::singleton();
                     $pcache->save($p_result, $article, $popts);
                 }
             } else {
                 $this->setWarning($this->parseMsg(array('actionthrottledtext')));
                 $forceLinkUpdate = false;
             }
         }
         $result[] = $r;
     }
     $apiResult = $this->getResult();
     $apiResult->setIndexedTagName($result, 'page');
     $apiResult->addValue(null, $this->getModuleName(), $result);
 }
开发者ID:tuxmania87,项目名称:GalaxyAdventures,代码行数:57,代码来源:ApiPurge.php

示例7: onLinksUpdate

 /**
  * LinksUpdate hook handler
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdate
  * @param LinksUpdate $linksUpdate
  */
 public static function onLinksUpdate(&$linksUpdate)
 {
     global $wgUseDumbLinkUpdate;
     $out = $linksUpdate->getParserOutput();
     $data = array();
     if (isset($out->geoData)) {
         $geoData = $out->geoData;
         $data = $geoData->getAll();
     }
     if ($wgUseDumbLinkUpdate || !count($data)) {
         self::doDumbUpdate($data, $linksUpdate->mId);
     } else {
         self::doSmartUpdate($data, $linksUpdate->mId);
     }
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:21,代码来源:GeoDataHooks.php

示例8: onLinksUpdateComplete

 /**
  * @param LinksUpdate $linksUpdate
  * @return bool return true to continue hooks flow
  */
 public static function onLinksUpdateComplete($linksUpdate)
 {
     wfProfileIn(__METHOD__);
     $images = $linksUpdate->getImages();
     $articleId = $linksUpdate->getTitle()->getArticleID();
     if (count($images) === 1) {
         $images = array_keys($images);
         self::buildIndex($articleId, $images);
         wfProfileOut(__METHOD__);
         return true;
     }
     $article = new Article($linksUpdate->getTitle());
     self::buildAndGetIndex($article);
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:imageServingHelper.class.php

示例9: onLinksUpdateComplete

 /**
  * Insert assessment records after page is saved
  * @param LinksUpdate $linksUpdate
  */
 public static function onLinksUpdateComplete(&$linksUpdate)
 {
     $pOut = $linksUpdate->getParserOutput();
     if ($pOut->getExtensionData('ext-pageassessment-assessmentdata') !== null) {
         $assessmentData = $pOut->getExtensionData('ext-pageassessment-assessmentdata');
     } else {
         // Even if there is no assessment data, we still need to run doUpdates
         // in case any assessment data was deleted from the page.
         $assessmentData = [];
     }
     $title = $linksUpdate->getTitle();
     // In most cases $title will be a talk page, but we want to associate the
     // assessment data with the subject page.
     $subjectTitle = $title->getSubjectPage();
     PageAssessmentsBody::doUpdates($subjectTitle, $assessmentData);
 }
开发者ID:wikimedia,项目名称:mediawiki-extensions-PageAssessments,代码行数:20,代码来源:PageAssessments.hooks.php

示例10: doUpdate

 public function doUpdate()
 {
     $services = MediaWikiServices::getInstance();
     $config = $services->getMainConfig();
     $lbFactory = $services->getDBLoadBalancerFactory();
     $batchSize = $config->get('UpdateRowsPerQuery');
     // Page may already be deleted, so don't just getId()
     $id = $this->pageId;
     if ($this->ticket) {
         // Make sure all links update threads see the changes of each other.
         // This handles the case when updates have to batched into several COMMITs.
         $scopedLock = LinksUpdate::acquirePageLock($this->getDB(), $id);
     }
     $title = $this->page->getTitle();
     $dbw = $this->getDB();
     // convenience
     // Delete restrictions for it
     $dbw->delete('page_restrictions', ['pr_page' => $id], __METHOD__);
     // Fix category table counts
     $cats = $dbw->selectFieldValues('categorylinks', 'cl_to', ['cl_from' => $id], __METHOD__);
     $catBatches = array_chunk($cats, $batchSize);
     foreach ($catBatches as $catBatch) {
         $this->page->updateCategoryCounts([], $catBatch, $id);
         if (count($catBatches) > 1) {
             $lbFactory->commitAndWaitForReplication(__METHOD__, $this->ticket, ['wiki' => $dbw->getWikiID()]);
         }
     }
     // Refresh the category table entry if it seems to have no pages. Check
     // master for the most up-to-date cat_pages count.
     if ($title->getNamespace() === NS_CATEGORY) {
         $row = $dbw->selectRow('category', ['cat_id', 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files'], ['cat_title' => $title->getDBkey(), 'cat_pages <= 0'], __METHOD__);
         if ($row) {
             Category::newFromRow($row, $title)->refreshCounts();
         }
     }
     $this->batchDeleteByPK('pagelinks', ['pl_from' => $id], ['pl_from', 'pl_namespace', 'pl_title'], $batchSize);
     $this->batchDeleteByPK('imagelinks', ['il_from' => $id], ['il_from', 'il_to'], $batchSize);
     $this->batchDeleteByPK('categorylinks', ['cl_from' => $id], ['cl_from', 'cl_to'], $batchSize);
     $this->batchDeleteByPK('templatelinks', ['tl_from' => $id], ['tl_from', 'tl_namespace', 'tl_title'], $batchSize);
     $this->batchDeleteByPK('externallinks', ['el_from' => $id], ['el_id'], $batchSize);
     $this->batchDeleteByPK('langlinks', ['ll_from' => $id], ['ll_from', 'll_lang'], $batchSize);
     $this->batchDeleteByPK('iwlinks', ['iwl_from' => $id], ['iwl_from', 'iwl_prefix', 'iwl_title'], $batchSize);
     // Delete any redirect entry or page props entries
     $dbw->delete('redirect', ['rd_from' => $id], __METHOD__);
     $dbw->delete('page_props', ['pp_page' => $id], __METHOD__);
     // Find recentchanges entries to clean up...
     $rcIdsForTitle = $dbw->selectFieldValues('recentchanges', 'rc_id', ['rc_type != ' . RC_LOG, 'rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey(), 'rc_timestamp < ' . $dbw->addQuotes($dbw->timestamp($this->timestamp))], __METHOD__);
     $rcIdsForPage = $dbw->selectFieldValues('recentchanges', 'rc_id', ['rc_type != ' . RC_LOG, 'rc_cur_id' => $id], __METHOD__);
     // T98706: delete by PK to avoid lock contention with RC delete log insertions
     $rcIdBatches = array_chunk(array_merge($rcIdsForTitle, $rcIdsForPage), $batchSize);
     foreach ($rcIdBatches as $rcIdBatch) {
         $dbw->delete('recentchanges', ['rc_id' => $rcIdBatch], __METHOD__);
         if (count($rcIdBatches) > 1) {
             $lbFactory->commitAndWaitForReplication(__METHOD__, $this->ticket, ['wiki' => $dbw->getWikiID()]);
         }
     }
     // Commit and release the lock (if set)
     ScopedCallback::consume($scopedLock);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:59,代码来源:LinksDeletionUpdate.php

示例11: onLinksUpdate

 /**
  * LinksUpdate hook handler - saves a count of h2 elements that occur in the WikiPage
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinksUpdate
  *
  * @param LinksUpdate $lu
  * @return bool
  */
 public static function onLinksUpdate(LinksUpdate $lu)
 {
     if ($lu->getTitle()->isTalkPage()) {
         $parserOutput = $lu->getParserOutput();
         $sections = $parserOutput->getSections();
         $numTopics = 0;
         foreach ($sections as $section) {
             if ($section['toclevel'] == 1) {
                 $numTopics += 1;
             }
         }
         if ($numTopics) {
             $lu->mProperties['page_top_level_section_count'] = $numTopics;
         }
     }
     return true;
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:24,代码来源:MobileFrontend.hooks.php

示例12: doUpdate

 public function doUpdate()
 {
     # Page may already be deleted, so don't just getId()
     $id = $this->pageId;
     // Make sure all links update threads see the changes of each other.
     // This handles the case when updates have to batched into several COMMITs.
     $scopedLock = LinksUpdate::acquirePageLock($this->mDb, $id);
     # Delete restrictions for it
     $this->mDb->delete('page_restrictions', ['pr_page' => $id], __METHOD__);
     # Fix category table counts
     $cats = $this->mDb->selectFieldValues('categorylinks', 'cl_to', ['cl_from' => $id], __METHOD__);
     $this->page->updateCategoryCounts([], $cats);
     # If using cascading deletes, we can skip some explicit deletes
     if (!$this->mDb->cascadingDeletes()) {
         # Delete outgoing links
         $this->mDb->delete('pagelinks', ['pl_from' => $id], __METHOD__);
         $this->mDb->delete('imagelinks', ['il_from' => $id], __METHOD__);
         $this->mDb->delete('categorylinks', ['cl_from' => $id], __METHOD__);
         $this->mDb->delete('templatelinks', ['tl_from' => $id], __METHOD__);
         $this->mDb->delete('externallinks', ['el_from' => $id], __METHOD__);
         $this->mDb->delete('langlinks', ['ll_from' => $id], __METHOD__);
         $this->mDb->delete('iwlinks', ['iwl_from' => $id], __METHOD__);
         $this->mDb->delete('redirect', ['rd_from' => $id], __METHOD__);
         $this->mDb->delete('page_props', ['pp_page' => $id], __METHOD__);
     }
     # If using cleanup triggers, we can skip some manual deletes
     if (!$this->mDb->cleanupTriggers()) {
         $title = $this->page->getTitle();
         # Find recentchanges entries to clean up...
         $rcIdsForTitle = $this->mDb->selectFieldValues('recentchanges', 'rc_id', ['rc_type != ' . RC_LOG, 'rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey()], __METHOD__);
         $rcIdsForPage = $this->mDb->selectFieldValues('recentchanges', 'rc_id', ['rc_type != ' . RC_LOG, 'rc_cur_id' => $id], __METHOD__);
         # T98706: delete PK to avoid lock contention with RC delete log insertions
         $rcIds = array_merge($rcIdsForTitle, $rcIdsForPage);
         if ($rcIds) {
             $this->mDb->delete('recentchanges', ['rc_id' => $rcIds], __METHOD__);
         }
     }
     $this->mDb->onTransactionIdle(function () use(&$scopedLock) {
         // Release the lock *after* the final COMMIT for correctness
         ScopedCallback::consume($scopedLock);
     });
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:42,代码来源:LinksDeletionUpdate.php

示例13: run

 function run()
 {
     if (is_null($this->title)) {
         $this->setLastError("deleteLinks: Invalid title");
         return false;
     }
     $pageId = $this->params['pageId'];
     // Serialize links updates by page ID so they see each others' changes
     $scopedLock = LinksUpdate::acquirePageLock(wfGetDB(DB_MASTER), $pageId, 'job');
     if (WikiPage::newFromID($pageId, WikiPage::READ_LATEST)) {
         // The page was restored somehow or something went wrong
         $this->setLastError("deleteLinks: Page #{$pageId} exists");
         return false;
     }
     $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
     $timestamp = isset($this->params['timestamp']) ? $this->params['timestamp'] : null;
     $page = WikiPage::factory($this->title);
     // title when deleted
     $update = new LinksDeletionUpdate($page, $pageId, $timestamp);
     $update->setTransactionTicket($factory->getEmptyTransactionTicket(__METHOD__));
     $update->doUpdate();
     return true;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:23,代码来源:DeleteLinksJob.php

示例14: assertLinksUpdate

 protected function assertLinksUpdate(Title $title, ParserOutput $parserOutput, $table, $fields, $condition, array $expectedRows)
 {
     $update = new LinksUpdate($title, $parserOutput);
     // NOTE: make sure LinksUpdate does not generate warnings when called inside a transaction.
     $update->beginTransaction();
     $update->doUpdate();
     $update->commitTransaction();
     $this->assertSelect($table, $fields, $condition, $expectedRows);
     return $update;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:LinksUpdateTest.php

示例15: recordUpload2


//.........这里部分代码省略.........
         # version to continue anyway, because that's better than having
         # an image that's not fixable by user operations.
         $reupload = true;
         # Collision, this is an update of a file
         # Insert previous contents into oldimage
         $dbw->insertSelect('oldimage', 'image', array('oi_name' => 'img_name', 'oi_archive_name' => $dbw->addQuotes($oldver), 'oi_size' => 'img_size', 'oi_width' => 'img_width', 'oi_height' => 'img_height', 'oi_bits' => 'img_bits', 'oi_timestamp' => 'img_timestamp', 'oi_description' => 'img_description', 'oi_user' => 'img_user', 'oi_user_text' => 'img_user_text', 'oi_metadata' => 'img_metadata', 'oi_media_type' => 'img_media_type', 'oi_major_mime' => 'img_major_mime', 'oi_minor_mime' => 'img_minor_mime', 'oi_sha1' => 'img_sha1'), array('img_name' => $this->getName()), __METHOD__);
         # Update the current image row
         $dbw->update('image', array('img_size' => $this->size, 'img_width' => intval($this->width), 'img_height' => intval($this->height), 'img_bits' => $this->bits, 'img_media_type' => $this->media_type, 'img_major_mime' => $this->major_mime, 'img_minor_mime' => $this->minor_mime, 'img_timestamp' => $timestamp, 'img_description' => $comment, 'img_user' => $user->getId(), 'img_user_text' => $user->getName(), 'img_metadata' => $dbw->encodeBlob($this->metadata), 'img_sha1' => $this->sha1), array('img_name' => $this->getName()), __METHOD__);
     } else {
         # This is a new file, so update the image count
         DeferredUpdates::addUpdate(SiteStatsUpdate::factory(array('images' => 1)));
     }
     $descTitle = $this->getTitle();
     $wikiPage = new WikiFilePage($descTitle);
     $wikiPage->setFile($this);
     # Add the log entry
     $action = $reupload ? 'overwrite' : 'upload';
     $logEntry = new ManualLogEntry('upload', $action);
     $logEntry->setPerformer($user);
     $logEntry->setComment($comment);
     $logEntry->setTarget($descTitle);
     // Allow people using the api to associate log entries with the upload.
     // Log has a timestamp, but sometimes different from upload timestamp.
     $logEntry->setParameters(array('img_sha1' => $this->sha1, 'img_timestamp' => $timestamp));
     // Note we keep $logId around since during new image
     // creation, page doesn't exist yet, so log_page = 0
     // but we want it to point to the page we're making,
     // so we later modify the log entry.
     // For a similar reason, we avoid making an RC entry
     // now and wait until the page exists.
     $logId = $logEntry->insert();
     $exists = $descTitle->exists();
     if ($exists) {
         // Page exists, do RC entry now (otherwise we wait for later).
         $logEntry->publish($logId);
     }
     wfProfileIn(__METHOD__ . '-edit');
     if ($exists) {
         # Create a null revision
         $latest = $descTitle->getLatestRevID();
         $editSummary = LogFormatter::newFromEntry($logEntry)->getPlainActionText();
         $nullRevision = Revision::newNullRevision($dbw, $descTitle->getArticleID(), $editSummary, false);
         if (!is_null($nullRevision)) {
             $nullRevision->insertOn($dbw);
             wfRunHooks('NewRevisionFromEditComplete', array($wikiPage, $nullRevision, $latest, $user));
             $wikiPage->updateRevisionOn($dbw, $nullRevision);
         }
     }
     # Commit the transaction now, in case something goes wrong later
     # The most important thing is that files don't get lost, especially archives
     # NOTE: once we have support for nested transactions, the commit may be moved
     #       to after $wikiPage->doEdit has been called.
     $dbw->commit(__METHOD__);
     # Save to memcache.
     # We shall not saveToCache before the commit since otherwise
     # in case of a rollback there is an usable file from memcached
     # which in fact doesn't really exist (bug 24978)
     $this->saveToCache();
     if ($exists) {
         # Invalidate the cache for the description page
         $descTitle->invalidateCache();
         $descTitle->purgeSquid();
     } else {
         # New file; create the description page.
         # There's already a log entry, so don't make a second RC entry
         # Squid and file cache for the description page are purged by doEditContent.
         $content = ContentHandler::makeContent($pageText, $descTitle);
         $status = $wikiPage->doEditContent($content, $comment, EDIT_NEW | EDIT_SUPPRESS_RC, false, $user);
         $dbw->begin(__METHOD__);
         // XXX; doEdit() uses a transaction
         // Now that the page exists, make an RC entry.
         $logEntry->publish($logId);
         if (isset($status->value['revision'])) {
             $dbw->update('logging', array('log_page' => $status->value['revision']->getPage()), array('log_id' => $logId), __METHOD__);
         }
         $dbw->commit(__METHOD__);
         // commit before anything bad can happen
     }
     wfProfileOut(__METHOD__ . '-edit');
     if ($reupload) {
         # Delete old thumbnails
         wfProfileIn(__METHOD__ . '-purge');
         $this->purgeThumbnails();
         wfProfileOut(__METHOD__ . '-purge');
         # Remove the old file from the squid cache
         SquidUpdate::purge(array($this->getURL()));
     }
     # Hooks, hooks, the magic of hooks...
     wfProfileIn(__METHOD__ . '-hooks');
     wfRunHooks('FileUpload', array($this, $reupload, $descTitle->exists()));
     wfProfileOut(__METHOD__ . '-hooks');
     # Invalidate cache for all pages using this file
     $update = new HTMLCacheUpdate($this->getTitle(), 'imagelinks');
     $update->doUpdate();
     if (!$reupload) {
         LinksUpdate::queueRecursiveJobsForTable($this->getTitle(), 'imagelinks');
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:spring,项目名称:spring-website,代码行数:101,代码来源:LocalFile.php


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