/** * Record a log entry on the stability config change action * @param Title $title * @param array $config * @param array $oldConfig * @param string $reason */ public static function updateStabilityLog(Title $title, array $config, array $oldConfig, $reason) { $log = new LogPage('stable'); if (FRPageConfig::configIsReset($config)) { # We are going back to default settings $log->addEntry('reset', $title, $reason); } else { # We are changing to non-default settings $action = $oldConfig === FRPageConfig::getDefaultVisibilitySettings() ? 'config' : 'modify'; // modified an existing custom configuration $log->addEntry($action, $title, $reason, FlaggedRevsLog::collapseParams(self::stabilityLogParams($config))); } }
protected function updateLogsAndHistory(FlaggableWikiPage $article) { global $wgContLang; $newConfig = $this->getNewConfig(); $oldConfig = $this->getOldConfig(); $reason = $this->getReason(); # Insert stability log entry... FlaggedRevsLog::updateStabilityLog($this->page, $newConfig, $oldConfig, $reason); # Build null-edit comment...<action: reason [settings] (expiry)> if (FRPageConfig::configIsReset($newConfig)) { $type = "stable-logentry-reset"; $settings = ''; // no level, expiry info } else { $type = "stable-logentry-config"; // Settings message in text form (e.g. [x=a,y=b,z]) $params = FlaggedRevsLog::stabilityLogParams($newConfig); $settings = FlaggedRevsLogView::stabilitySettings($params, true); } $comment = $wgContLang->ucfirst(wfMsgForContent($type, $this->page->getPrefixedText())); // action if ($reason != '') { $comment .= wfMsgForContent('colon-separator') . $reason; // add reason } if ($settings != '') { $comment .= " {$settings}"; // add settings } # Insert a null revision... $dbw = wfGetDB(DB_MASTER); $nullRev = Revision::newNullRevision($dbw, $article->getId(), $comment, true); $nullRev->insertOn($dbw); # Update page record and touch page $oldLatest = $nullRev->getParentId(); $article->updateRevisionOn($dbw, $nullRev, $oldLatest); wfRunHooks('NewRevisionFromEditComplete', array($article, $nullRev, $oldLatest, $this->user)); # Return null Revision object for autoreview check return $nullRev; }