本文整理汇总了PHP中ManualLogEntry::setComment方法的典型用法代码示例。如果您正苦于以下问题:PHP ManualLogEntry::setComment方法的具体用法?PHP ManualLogEntry::setComment怎么用?PHP ManualLogEntry::setComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManualLogEntry
的用法示例。
在下文中一共展示了ManualLogEntry::setComment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logTagAdded
protected function logTagAdded($tags, $revId, $user, $reason)
{
// log it
$logEntry = new ManualLogEntry('tag', 'update');
$logEntry->setPerformer($user);
$logEntry->setComment($reason);
// find the appropriate target page
if ($revId) {
$rev = Revision::newFromId($revId);
if ($rev) {
$logEntry->setTarget($rev->getTitle());
}
}
if (!$logEntry->getTarget()) {
// target is required, so we have to set something
$logEntry->setTarget(SpecialPage::getTitleFor('Tags'));
}
$logParams = array('4::revid' => $revId, '6:list:tagsAdded' => $tags, '7:number:tagsAddedCount' => count($tags));
$logEntry->setParameters($logParams);
$logEntry->setRelations(array('Tag' => $tags));
$dbw = wfGetDB(DB_MASTER);
$logId = $logEntry->insert($dbw);
// Only send this to UDP, not RC, similar to patrol events
$logEntry->publish($logId, 'udp');
//$logEntry->publish( $logId );
}
示例2: onSubmit
public function onSubmit(array $formData)
{
global $IP, $wgCreateWikiSQLfiles;
$DBname = $formData['dbname'];
$founderName = $formData['founder'];
$siteName = $formData['sitename'];
$language = $formData['language'];
$private = $formData['private'];
$reason = $formData['reason'];
$dbw = wfGetDB(DB_MASTER);
$farmerLogEntry = new ManualLogEntry('farmer', 'createwiki');
$farmerLogEntry->setPerformer($this->getUser());
$farmerLogEntry->setTarget($this->getTitle());
$farmerLogEntry->setComment($reason);
$farmerLogEntry->setParameters(array('4::wiki' => $DBname));
$farmerLogID = $farmerLogEntry->insert();
$farmerLogEntry->publish($farmerLogID);
$dbw->query('SET storage_engine=InnoDB;');
$dbw->query('CREATE DATABASE ' . $dbw->addIdentifierQuotes($DBname) . ';');
$dbw->selectDB($DBname);
foreach ($wgCreateWikiSQLfiles as $sqlfile) {
$dbw->sourceFile($sqlfile);
}
$this->writeToDBlist($DBname, $siteName, $language, $private);
$this->createMainPage($language);
$shcreateaccount = exec("/usr/bin/php " . "{$IP}/extensions/CentralAuth/maintenance/createLocalAccount.php " . wfEscapeShellArg($founderName) . " --wiki " . wfEscapeShellArg($DBname));
if (!strpos($shcreateaccount, 'created')) {
wfDebugLog('CreateWiki', 'Failed to create local account for founder. - error: ' . $shcreateaccount);
return wfMessage('createwiki-error-usernotcreated')->escaped();
}
$shpromoteaccount = exec("/usr/bin/php " . "{$IP}/maintenance/createAndPromote.php " . wfEscapeShellArg($founderName) . " --bureaucrat --sysop --force --wiki " . wfEscapeShellArg($DBname));
$this->getOutput()->addHTML('<div class="successbox">' . wfMessage('createwiki-success')->escaped() . '</div>');
return true;
}
示例3: execute
public function execute($par)
{
// Shortcut by using $par
if ($par) {
$this->getOutput()->redirect($this->getTitle()->getLinkURL(array('user' => $par)));
return;
}
$this->setHeaders();
$this->outputHeader();
// Parse options
$opt = new \FormOptions();
$opt->add('user', '');
$opt->add('delete', '');
$opt->add('reason', '');
$opt->fetchValuesFromRequest($this->getRequest());
// Parse user
$user = $opt->getValue('user');
$userObj = \User::newFromName($user);
$userExists = $userObj && $userObj->getId() !== 0;
// If current task is delete and user is not allowed
$canDoAdmin = $this->getUser()->isAllowed('avataradmin');
if ($opt->getValue('delete')) {
if (!$canDoAdmin) {
throw new \PermissionsError('avataradmin');
}
// Delete avatar if the user exists
if ($userExists) {
if (Avatars::deleteAvatar($userObj)) {
global $wgAvatarLogInRC;
$logEntry = new \ManualLogEntry('avatar', 'delete');
$logEntry->setPerformer($this->getUser());
$logEntry->setTarget($userObj->getUserPage());
$logEntry->setComment($opt->getValue('reason'));
$logId = $logEntry->insert();
$logEntry->publish($logId, $wgAvatarLogInRC ? 'rcandudp' : 'udp');
}
}
}
$this->getOutput()->addModules(array('mediawiki.userSuggest'));
$this->showForm($user);
if ($userExists) {
$haveAvatar = Avatars::hasAvatar($userObj);
if ($haveAvatar) {
$html = \Xml::tags('img', array('src' => Avatars::getLinkFor($user, 'original') . '&nocache&ver=' . dechex(time()), 'height' => 400), '');
$html = \Xml::tags('p', array(), $html);
$this->getOutput()->addHTML($html);
// Add a delete button
if ($canDoAdmin) {
$this->showDeleteForm($user);
}
} else {
$this->getOutput()->addWikiMsg('viewavatar-noavatar');
}
} else {
if ($user) {
$this->getOutput()->addWikiMsg('viewavatar-nouser');
}
}
}
示例4: newLogEntry
public function newLogEntry($action, $params)
{
$logEntry = new ManualLogEntry('phpunit', $action);
$logEntry->setPerformer($this->user);
$logEntry->setTarget($this->title);
$logEntry->setComment('A very good reason');
$logEntry->setParameters($params);
return $logEntry;
}
示例5: logPromotion
/**
* Log the promotion of a local unattached to a global
*
* @param string $oldName
* @param string $wiki
* @param string $newName
* @param string $reason
*/
public function logPromotion($oldName, $wiki, $newName, $reason)
{
$logEntry = new ManualLogEntry('gblrename', 'promote');
$logEntry->setPerformer($this->performingUser);
$logEntry->setTarget(Title::makeTitleSafe(NS_SPECIAL, 'CentralAuth/' . $newName));
$logEntry->setComment($reason);
$logEntry->setParameters(array('4::olduser' => $oldName, '5::newuser' => $newName, '6::oldwiki' => $wiki));
$logEntry->setRelations(array('oldname' => $oldName));
$logid = $logEntry->insert();
$logEntry->publish($logid);
}
示例6: log
/**
* @param CentralAuthUser[] $oldNames
* @param string $newName
* @param string $reason
*/
public function log(array $oldNames, $newName, $reason)
{
$logEntry = new ManualLogEntry('gblrename', 'merge');
$logEntry->setPerformer($this->performingUser);
$logEntry->setTarget(Title::makeTitleSafe(NS_SPECIAL, 'CentralAuth/' . $newName));
$imploded = implode('|', array_map(function (CentralAuthUser $user) {
return $user->getName();
}, $oldNames));
$logEntry->setComment($reason);
$logEntry->setParameters(array('4::olduser' => $imploded, '5::newuser' => $newName));
$logid = $logEntry->insert();
$logEntry->publish($logid);
}
示例7: addLogEntry
/**
* adds a log entry to the database.
*
* @param $type string: type of the log entry
* @param $subtype string: subtype of the log entry
* @param $user User: user that performs the logged operation
* @param $ns int: number of the namespace for the entry's target's title
* @param $title string: title of the entry's target
* @param $comment string: comment of the log entry
* @param $parameters Array: (optional) accompanying data that is attached
* to the entry
*
* @return int id of the added log entry
*/
private function addLogEntry($type, $subtype, User $user, $ns, $title, $comment = null, $parameters = null)
{
$logEntry = new ManualLogEntry($type, $subtype);
$logEntry->setPerformer($user);
$logEntry->setTarget(Title::newFromText($title, $ns));
if ($comment !== null) {
$logEntry->setComment($comment);
}
if ($parameters !== null) {
$logEntry->setParameters($parameters);
}
return $logEntry->insert();
}
示例8: newLogEntry
/**
* Create new Log entry
*
* @param string $action Action name as defined above
* @param integer $mapId Map id
* @param string $comment Comment
* @param array $params Additional params
* @return ManualLogEntry
*/
public static function newLogEntry($action, $user, $mapId, $comment, $params = [])
{
$logEntry = new ManualLogEntry(self::LOG_TYPE_NAME, $action);
$logEntry->setPerformer($user);
$logEntry->setTarget(SpecialPage::getTitleFor(WikiaMapsSpecialController::PAGE_NAME, $mapId));
$logEntry->setComment($comment);
if (!empty($params)) {
// we can't allow to pass those elements
// more info: https://www.mediawiki.org/wiki/Manual:Logging_to_Special:Log#1.19_and_later
unset($params[1], $params[2], $params[3]);
$logEntry->setParameters($params);
}
return $logEntry;
}
示例9: log
/**
* Create a log entry using the provided info.
* Takes care about the logging interface changes in MediaWiki 1.19.
*
* @since 0.1
*
* @param array $info
*/
public static function log(array $info)
{
$user = array_key_exists('user', $info) ? $info['user'] : $GLOBALS['wgUser'];
$logEntry = new ManualLogEntry($info['type'], $info['subtype']);
$logEntry->setPerformer($user);
$logEntry->setTarget($info['title']);
if (array_key_exists('comment', $info)) {
$logEntry->setComment($info['comment']);
}
if (array_key_exists('parameters', $info)) {
$logEntry->setParameters($info['parameters']);
}
$logid = $logEntry->insert();
$logEntry->publish($logid);
}
示例10: onSubmitInput
function onSubmitInput(array $params)
{
if (!$this->getUser()->isAllowed('managewiki')) {
throw new MWException("User '{$this->getUser()->getName()}' without managewiki right tried to change wiki settings!");
}
$values = array('wiki_sitename' => $params['sitename'], 'wiki_language' => $params['language'], 'wiki_closed' => $params['closed'] == true ? 1 : 0);
if ($this->getUser()->isAllowed('managewiki-restricted')) {
$values['wiki_private'] = $params['private'] == true ? 1 : 0;
}
$dbw = wfGetDB(DB_MASTER);
$dbw->update('cw_wikis', $values, array('wiki_dbname' => $params['dbname']), __METHOD__);
$farmerLogEntry = new ManualLogEntry('farmer', 'managewiki');
$farmerLogEntry->setPerformer($this->getUser());
$farmerLogEntry->setTarget($this->getTitle());
$farmerLogEntry->setComment($params['reason']);
$farmerLogEntry->setParameters(array('4::wiki' => $params['dbname']));
$farmerLogID = $farmerLogEntry->insert();
$farmerLogEntry->publish($farmerLogID);
$this->getOutput()->addHTML('<div class="successbox">' . wfMessage('managewiki-success')->escaped() . '</div>');
return true;
}
示例11: log
/**
* Create a log entry using the provided info.
* Takes care about the logging interface changes in MediaWiki 1.19.
*
* @since 0.1
*
* @param array $info
*/
public static function log(array $info)
{
$user = array_key_exists('user', $info) ? $info['user'] : $GLOBALS['wgUser'];
if ($info !== false) {
if (class_exists('ManualLogEntry')) {
$logEntry = new ManualLogEntry($info['type'], $info['subtype']);
$logEntry->setPerformer($user);
$logEntry->setTarget($info['title']);
if (array_key_exists('comment', $info)) {
$logEntry->setComment($info['comment']);
}
if (array_key_exists('parameters', $info)) {
$logEntry->setParameters($info['parameters']);
}
$logid = $logEntry->insert();
$logEntry->publish($logid);
} else {
// Compatibility with MediaWiki 1.18.
$log = new LogPage($info['type']);
$log->addEntry($info['subtype'], $info['title'], array_key_exists('comment', $info) ? $info['comment'] : '', array_key_exists('parameters', $info) ? $info['parameters'] : array(), $user);
}
}
}
示例12: moveToInternal
/**
* Move page to a title which is either a redirect to the
* source page or nonexistent
*
* @param $nt Title the page to move to, which should be a redirect or nonexistent
* @param $reason String The reason for the move
* @param $createRedirect Bool Whether to leave a redirect at the old title. Ignored
* if the user doesn't have the suppressredirect right
*/
private function moveToInternal(&$nt, $reason = '', $createRedirect = true)
{
global $wgUser, $wgContLang;
if ($nt->exists()) {
$moveOverRedirect = true;
$logType = 'move_redir';
} else {
$moveOverRedirect = false;
$logType = 'move';
}
$redirectSuppressed = !$createRedirect && $wgUser->isAllowed('suppressredirect');
$logEntry = new ManualLogEntry('move', $logType);
$logEntry->setPerformer($wgUser);
$logEntry->setTarget($this);
$logEntry->setComment($reason);
$logEntry->setParameters(array('4::target' => $nt->getPrefixedText(), '5::noredir' => $redirectSuppressed ? '1' : '0'));
$formatter = LogFormatter::newFromEntry($logEntry);
$formatter->setContext(RequestContext::newExtraneousContext($this));
$comment = $formatter->getPlainActionText();
if ($reason) {
$comment .= wfMsgForContent('colon-separator') . $reason;
}
# Truncate for whole multibyte characters.
$comment = $wgContLang->truncate($comment, 255);
$oldid = $this->getArticleID();
$latest = $this->getLatestRevID();
$dbw = wfGetDB(DB_MASTER);
$newpage = WikiPage::factory($nt);
if ($moveOverRedirect) {
$newid = $nt->getArticleID();
# Delete the old redirect. We don't save it to history since
# by definition if we've got here it's rather uninteresting.
# We have to remove it so that the next step doesn't trigger
# a conflict on the unique namespace+title index...
$dbw->delete('page', array('page_id' => $newid), __METHOD__);
$newpage->doDeleteUpdates($newid);
}
# Save a null revision in the page's history notifying of the move
$nullRevision = Revision::newNullRevision($dbw, $oldid, $comment, true);
if (!is_object($nullRevision)) {
throw new MWException('No valid null revision produced in ' . __METHOD__);
}
$nullRevId = $nullRevision->insertOn($dbw);
# Change the name of the target page:
$dbw->update('page', array('page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey()), array('page_id' => $oldid), __METHOD__);
$this->resetArticleID(0);
$nt->resetArticleID($oldid);
$newpage->updateRevisionOn($dbw, $nullRevision);
wfRunHooks('NewRevisionFromEditComplete', array($newpage, $nullRevision, $latest, $wgUser));
$newpage->doEditUpdates($nullRevision, $wgUser, array('changed' => false));
if (!$moveOverRedirect) {
WikiPage::onArticleCreate($nt);
}
# Recreate the redirect, this time in the other direction.
if ($redirectSuppressed) {
WikiPage::onArticleDelete($this);
} else {
$mwRedir = MagicWord::get('redirect');
$redirectText = $mwRedir->getSynonym(0) . ' [[' . $nt->getPrefixedText() . "]]\n";
$redirectArticle = WikiPage::factory($this);
$newid = $redirectArticle->insertOn($dbw);
if ($newid) {
// sanity
$redirectRevision = new Revision(array('page' => $newid, 'comment' => $comment, 'text' => $redirectText));
$redirectRevision->insertOn($dbw);
$redirectArticle->updateRevisionOn($dbw, $redirectRevision, 0);
wfRunHooks('NewRevisionFromEditComplete', array($redirectArticle, $redirectRevision, false, $wgUser));
$redirectArticle->doEditUpdates($redirectRevision, $wgUser, array('created' => true));
}
}
# Log the move
$logid = $logEntry->insert();
$logEntry->publish($logid);
}
示例13: processInput
/**
* @param array $formData
* @param HtmlForm $form
*
* @return bool|string
* @throws DBUnexpectedError
* @throws Exception
* @throws MWException
*/
public static function processInput(array $formData, HtmlForm $form)
{
error_reporting(0);
global $wgCreateWikiSQLfiles, $IP;
$DBname = $formData['dbname'];
$founderName = $formData['founder'];
$dbw = wfGetDB(DB_MASTER);
$dbTest = $dbw->query('SHOW DATABASES LIKE ' . $dbw->addQuotes($DBname) . ';');
$rows = $dbTest->numRows();
$dbTest->free();
if ($rows !== 0) {
return wfMessage('createwiki-error-dbexists')->plain();
}
$farmerLogEntry = new ManualLogEntry('farmer', 'createandpromote');
$farmerLogEntry->setPerformer($form->getUser());
$farmerLogEntry->setTarget($form->getTitle());
$farmerLogEntry->setComment($formData['comment']);
$farmerLogEntry->setParameters(array('4::wiki' => $DBname, '5::founder' => $founderName));
$farmerLogID = $farmerLogEntry->insert();
$farmerLogEntry->publish($farmerLogID);
$dbw->query('SET storage_engine=InnoDB;');
$dbw->query('CREATE DATABASE ' . $dbw->addIdentifierQuotes($DBname) . ';');
$dbw->selectDB($DBname);
foreach ($wgCreateWikiSQLfiles as $file) {
$dbw->sourceFile($file);
}
$dbw->insert('site_stats', array('ss_row_id' => 1));
$dbw->close();
// Add DNS record to cloudflare
global $wgCreateWikiUseCloudFlare, $wgCloudFlareUser, $wgCloudFlareKey;
if ($wgCreateWikiUseCloudFlare) {
$domainPrefix = substr($DBname, 0, -4);
$cloudFlare = new cloudflare_api($wgCloudFlareUser, $wgCloudFlareKey);
$cloudFlareResult = $cloudFlare->rec_new('orain.org', 'CNAME', $domainPrefix, 'lb.orain.org');
if (!is_object($cloudFlareResult) || $cloudFlareResult->result !== 'success') {
wfDebugLog('CreateWiki', 'CloudFlare FAILED to add CNAME for ' . $domainPrefix . '.orain.org');
} else {
wfDebugLog('CreateWiki', 'CloudFlare CNAME added for ' . $domainPrefix . '.orain.org');
}
}
// Create local account for founder (hack)
$out = exec("php5 {$IP}/extensions/CentralAuth/maintenance/createLocalAccount.php " . escapeshellarg($founderName) . ' --wiki ' . escapeshellarg($DBname));
if (!strpos($out, 'created')) {
return wfMessage('createwiki-error-usernotcreated')->plain();
}
require_once "{$IP}/includes/UserRightsProxy.php";
// Grant founder sysop and bureaucrat rights
$founderUser = UserRightsProxy::newFromName($DBname, $founderName);
$newGroups = array('sysop', 'bureaucrat');
array_map(array($founderUser, 'addGroup'), $newGroups);
$founderUser->invalidateCache();
$form->getOutput()->addWikiMsg('createwiki-success', $DBname);
return true;
}
示例14: logTagManagementAction
/**
* Writes a tag action into the tag management log.
*
* @param string $action
* @param string $tag
* @param string $reason
* @param User $user Who to attribute the action to
* @param int $tagCount For deletion only, how many usages the tag had before
* it was deleted.
* @return int ID of the inserted log entry
* @since 1.25
*/
protected static function logTagManagementAction($action, $tag, $reason, User $user, $tagCount = null)
{
$dbw = wfGetDB(DB_MASTER);
$logEntry = new ManualLogEntry('managetags', $action);
$logEntry->setPerformer($user);
// target page is not relevant, but it has to be set, so we just put in
// the title of Special:Tags
$logEntry->setTarget(Title::newFromText('Special:Tags'));
$logEntry->setComment($reason);
$params = array('4::tag' => $tag);
if (!is_null($tagCount)) {
$params['5:number:count'] = $tagCount;
}
$logEntry->setParameters($params);
$logEntry->setRelations(array('Tag' => $tag));
$logId = $logEntry->insert($dbw);
$logEntry->publish($logId);
return $logId;
}
示例15: wfProfileIn
/**
* Record a file upload in the upload log and the image table
* @param string $oldver
* @param string $comment
* @param string $pageText
* @param bool|array $props
* @param string|bool $timestamp
* @param null|User $user
* @return bool
*/
function recordUpload2($oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null)
{
wfProfileIn(__METHOD__);
if (is_null($user)) {
global $wgUser;
$user = $wgUser;
}
$dbw = $this->repo->getMasterDB();
$dbw->begin(__METHOD__);
if (!$props) {
wfProfileIn(__METHOD__ . '-getProps');
$props = $this->repo->getFileProps($this->getVirtualUrl());
wfProfileOut(__METHOD__ . '-getProps');
}
if ($timestamp === false) {
$timestamp = $dbw->timestamp();
}
$props['description'] = $comment;
$props['user'] = $user->getId();
$props['user_text'] = $user->getName();
$props['timestamp'] = wfTimestamp(TS_MW, $timestamp);
// DB -> TS_MW
$this->setProps($props);
# Fail now if the file isn't there
if (!$this->fileExists) {
wfDebug(__METHOD__ . ": File " . $this->getRel() . " went missing!\n");
wfProfileOut(__METHOD__);
return false;
}
$reupload = false;
# Test to see if the row exists using INSERT IGNORE
# This avoids race conditions by locking the row until the commit, and also
# doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
$dbw->insert('image', array('img_name' => $this->getName(), '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), __METHOD__, 'IGNORE');
if ($dbw->affectedRows() == 0) {
# (bug 34993) Note: $oldver can be empty here, if the previous
# version of the file was broken. Allow registration of the new
# 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__);
//.........这里部分代码省略.........