Esempio n. 1
0
 /**
  * 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;
 }
 /**
  * @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;
 }
 /**
  * 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);
 }
 /**
  * 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;
 }
Esempio n. 5
0
 /**
  * After article was edited and parsed, in case of layer page, save layers to database
  *
  * @since 3.0
  *
  * @param LinksUpdate &$linksUpdate
  *
  * @return true
  */
 public static function onLinksUpdateConstructed(LinksUpdate &$linksUpdate)
 {
     $title = $linksUpdate->getTitle();
     self::processLayersStoreCandidate($linksUpdate->mParserOutput, $title);
     return true;
 }
Esempio n. 6
0
 /**
  * Modifies ParserOutput
  * @param \LinksUpdate $linksUpdate
  * @return bool
  */
 public static function onLinksUpdate(\LinksUpdate $linksUpdate)
 {
     $linksUpdate->mParserOutput = (new \FlagsController())->modifyParserOutputWithFlags($linksUpdate->getParserOutput(), $linksUpdate->getTitle()->getArticleID());
     return true;
 }
 public static function preventCategorization(LinksUpdate $updater)
 {
     $handle = new MessageHandle($updater->getTitle());
     if ($handle->isMessageNamespace() && !$handle->isDoc()) {
         $updater->mCategories = array();
     }
     return true;
 }