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


PHP RecentChange::notifyEdit方法代码示例

本文整理汇总了PHP中RecentChange::notifyEdit方法的典型用法代码示例。如果您正苦于以下问题:PHP RecentChange::notifyEdit方法的具体用法?PHP RecentChange::notifyEdit怎么用?PHP RecentChange::notifyEdit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RecentChange的用法示例。


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

示例1: doEditContent


//.........这里部分代码省略.........

					wfProfileOut( __METHOD__ );
					return $status;
				}

				$revisionId = $revision->insertOn( $dbw );

				// Update page
				//
				// Note that we use $this->mLatest instead of fetching a value from the master DB
				// during the course of this function. This makes sure that EditPage can detect
				// edit conflicts reliably, either by $ok here, or by $article->getTimestamp()
				// before this function is called. A previous function used a separate query, this
				// creates a window where concurrent edits can cause an ignored edit conflict.
				$ok = $this->updateRevisionOn( $dbw, $revision, $oldid, $oldIsRedirect );

				if ( !$ok ) {
					// Belated edit conflict! Run away!!
					$status->fatal( 'edit-conflict' );

					$dbw->rollback( __METHOD__ );

					wfProfileOut( __METHOD__ );
					return $status;
				}

				wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, $baseRevId, $user ) );
				// Update recentchanges
				if ( !( $flags & EDIT_SUPPRESS_RC ) ) {
					// Mark as patrolled if the user can do so
					$patrolled = $wgUseRCPatrol && !count(
						$this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) );
					// Add RC row to the DB
					$rc = RecentChange::notifyEdit( $now, $this->mTitle, $isminor, $user, $summary,
						$oldid, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
						$revisionId, $patrolled
					);

					// Log auto-patrolled edits
					if ( $patrolled ) {
						PatrolLog::record( $rc, true, $user );
					}
				}
				$user->incEditCount();
				$dbw->commit( __METHOD__ );
			} else {
				// Bug 32948: revision ID must be set to page {{REVISIONID}} and
				// related variables correctly
				$revision->setId( $this->getLatest() );
			}

			// Update links tables, site stats, etc.
			$this->doEditUpdates(
				$revision,
				$user,
				array(
					'changed' => $changed,
					'oldcountable' => $oldcountable
				)
			);

			if ( !$changed ) {
				$status->warning( 'edit-no-change' );
				$revision = null;
				// Update page_touched, this is usually implicit in the page update
				// Other cache updates are done in onArticleEdit()
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:67,代码来源:WikiPage.php

示例2: doEdit


//.........这里部分代码省略.........
                 wfDebug(__METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n");
                 $status->fatal('edit-gone-missing');
                 wfProfileOut(__METHOD__);
                 return $status;
             }
             $revision = new Revision(array('page' => $this->getId(), 'comment' => $summary, 'minor_edit' => $isminor, 'text' => $text, 'parent_id' => $this->mLatest, 'user' => $user->getId(), 'user_text' => $user->getName()));
             $dbw->begin();
             $revisionId = $revision->insertOn($dbw);
             # Update page
             #
             # Note that we use $this->mLatest instead of fetching a value from the master DB
             # during the course of this function. This makes sure that EditPage can detect
             # edit conflicts reliably, either by $ok here, or by $article->getTimestamp()
             # before this function is called. A previous function used a separate query, this
             # creates a window where concurrent edits can cause an ignored edit conflict.
             $ok = $this->updateRevisionOn($dbw, $revision, $this->mLatest);
             if (!$ok) {
                 /* Belated edit conflict! Run away!! */
                 $status->fatal('edit-conflict');
                 # Delete the invalid revision if the DB is not transactional
                 if (!$wgDBtransactions) {
                     $dbw->delete('revision', array('rev_id' => $revisionId), __METHOD__);
                 }
                 $revisionId = 0;
                 $dbw->rollback();
             } else {
                 global $wgUseRCPatrol;
                 wfRunHooks('NewRevisionFromEditComplete', array($this, $revision, $baseRevId, $user));
                 # Update recentchanges
                 if (!($flags & EDIT_SUPPRESS_RC)) {
                     # Mark as patrolled if the user can do so
                     $patrolled = $wgUseRCPatrol && $this->mTitle->userCan('autopatrol');
                     # Add RC row to the DB
                     $rc = RecentChange::notifyEdit($now, $this->mTitle, $isminor, $user, $summary, $this->mLatest, $this->getTimestamp(), $bot, '', $oldsize, $newsize, $revisionId, $patrolled);
                     # Log auto-patrolled edits
                     if ($patrolled) {
                         PatrolLog::record($rc, true);
                     }
                 }
                 $user->incEditCount();
                 $dbw->commit();
             }
         } else {
             $status->warning('edit-no-change');
             $revision = null;
             // Keep the same revision ID, but do some updates on it
             $revisionId = $this->getRevIdFetched();
             // Update page_touched, this is usually implicit in the page update
             // Other cache updates are done in onArticleEdit()
             $this->mTitle->invalidateCache();
         }
         if (!$wgDBtransactions) {
             ignore_user_abort($userAbort);
         }
         // Now that ignore_user_abort is restored, we can respond to fatal errors
         if (!$status->isOK()) {
             wfProfileOut(__METHOD__);
             return $status;
         }
         # Invalidate cache of this article and all pages using this article
         # as a template. Partly deferred.
         Article::onArticleEdit($this->mTitle);
         # Update links tables, site stats, etc.
         $this->editUpdates($text, $summary, $isminor, $now, $revisionId, $changed);
     } else {
         # Create new article
开发者ID:GodelDesign,项目名称:Godel,代码行数:67,代码来源:Article.php

示例3: doModify

 /**
  * @param Content $content Pre-save transform content
  * @param integer $flags
  * @param User $user
  * @param string $summary
  * @param array $meta
  * @return Status
  * @throws DBUnexpectedError
  * @throws Exception
  * @throws FatalError
  * @throws MWException
  */
 private function doModify(Content $content, $flags, User $user, $summary, array $meta)
 {
     global $wgUseRCPatrol;
     // Update article, but only if changed.
     $status = Status::newGood(['new' => false, 'revision' => null]);
     // Convenience variables
     $now = wfTimestampNow();
     $oldid = $meta['oldId'];
     /** @var $oldContent Content|null */
     $oldContent = $meta['oldContent'];
     $newsize = $content->getSize();
     if (!$oldid) {
         // Article gone missing
         $status->fatal('edit-gone-missing');
         return $status;
     } elseif (!$oldContent) {
         // Sanity check for bug 37225
         throw new MWException("Could not find text for current revision {$oldid}.");
     }
     // @TODO: pass content object?!
     $revision = new Revision(['page' => $this->getId(), 'title' => $this->mTitle, 'comment' => $summary, 'minor_edit' => $meta['minor'], 'text' => $meta['serialized'], 'len' => $newsize, 'parent_id' => $oldid, 'user' => $user->getId(), 'user_text' => $user->getName(), 'timestamp' => $now, 'content_model' => $content->getModel(), 'content_format' => $meta['serialFormat']]);
     $changed = !$content->equals($oldContent);
     $dbw = wfGetDB(DB_MASTER);
     if ($changed) {
         $prepStatus = $content->prepareSave($this, $flags, $oldid, $user);
         $status->merge($prepStatus);
         if (!$status->isOK()) {
             return $status;
         }
         $dbw->startAtomic(__METHOD__);
         // Get the latest page_latest value while locking it.
         // Do a CAS style check to see if it's the same as when this method
         // started. If it changed then bail out before touching the DB.
         $latestNow = $this->lockAndGetLatest();
         if ($latestNow != $oldid) {
             $dbw->endAtomic(__METHOD__);
             // Page updated or deleted in the mean time
             $status->fatal('edit-conflict');
             return $status;
         }
         // At this point we are now comitted to returning an OK
         // status unless some DB query error or other exception comes up.
         // This way callers don't have to call rollback() if $status is bad
         // unless they actually try to catch exceptions (which is rare).
         // Save the revision text
         $revisionId = $revision->insertOn($dbw);
         // Update page_latest and friends to reflect the new revision
         if (!$this->updateRevisionOn($dbw, $revision, null, $meta['oldIsRedirect'])) {
             throw new MWException("Failed to update page row to use new revision.");
         }
         Hooks::run('NewRevisionFromEditComplete', [$this, $revision, $meta['baseRevId'], $user]);
         // Update recentchanges
         if (!($flags & EDIT_SUPPRESS_RC)) {
             // Mark as patrolled if the user can do so
             $patrolled = $wgUseRCPatrol && !count($this->mTitle->getUserPermissionsErrors('autopatrol', $user));
             // Add RC row to the DB
             RecentChange::notifyEdit($now, $this->mTitle, $revision->isMinor(), $user, $summary, $oldid, $this->getTimestamp(), $meta['bot'], '', $oldContent ? $oldContent->getSize() : 0, $newsize, $revisionId, $patrolled, $meta['tags']);
         }
         $user->incEditCount();
         $dbw->endAtomic(__METHOD__);
         $this->mTimestamp = $now;
     } else {
         // Bug 32948: revision ID must be set to page {{REVISIONID}} and
         // related variables correctly. Likewise for {{REVISIONUSER}} (T135261).
         $revision->setId($this->getLatest());
         $revision->setUserIdAndName($this->getUser(Revision::RAW), $this->getUserText(Revision::RAW));
     }
     if ($changed) {
         // Return the new revision to the caller
         $status->value['revision'] = $revision;
     } else {
         $status->warning('edit-no-change');
         // Update page_touched as updateRevisionOn() was not called.
         // Other cache updates are managed in onArticleEdit() via doEditUpdates().
         $this->mTitle->invalidateCache($now);
     }
     // Do secondary updates once the main changes have been committed...
     DeferredUpdates::addUpdate(new AtomicSectionUpdate($dbw, __METHOD__, function () use($revision, &$user, $content, $summary, &$flags, $changed, $meta, &$status) {
         // Update links tables, site stats, etc.
         $this->doEditUpdates($revision, $user, ['changed' => $changed, 'oldcountable' => $meta['oldCountable'], 'oldrevision' => $meta['oldRevision']]);
         // Trigger post-save hook
         $params = [&$this, &$user, $content, $summary, $flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $meta['baseRevId']];
         ContentHandler::runLegacyHooks('ArticleSaveComplete', $params);
         Hooks::run('PageContentSaveComplete', $params);
     }), DeferredUpdates::PRESEND);
     return $status;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:99,代码来源:WikiPage.php

示例4: doEdit

 /**
  * Article::doEdit()
  *
  * Change an existing article or create a new article. Updates RC and all necessary caches, 
  * optionally via the deferred update array.
  *
  * $wgUser must be set before calling this function.
  *
  * @param string $text New text
  * @param string $summary Edit summary
  * @param integer $flags bitfield:
  *      EDIT_NEW
  *          Article is known or assumed to be non-existent, create a new one
  *      EDIT_UPDATE
  *          Article is known or assumed to be pre-existing, update it
  *      EDIT_MINOR
  *          Mark this edit minor, if the user is allowed to do so
  *      EDIT_SUPPRESS_RC
  *          Do not log the change in recentchanges
  *      EDIT_FORCE_BOT
  *          Mark the edit a "bot" edit regardless of user rights
  *      EDIT_DEFER_UPDATES
  *          Defer some of the updates until the end of index.php
  *      EDIT_AUTOSUMMARY
  *          Fill in blank summaries with generated text where possible
  * 
  * If neither EDIT_NEW nor EDIT_UPDATE is specified, the status of the article will be detected. 
  * If EDIT_UPDATE is specified and the article doesn't exist, the function will return false. If 
  * EDIT_NEW is specified and the article does exist, a duplicate key error will cause an exception
  * to be thrown from the Database. These two conditions are also possible with auto-detection due
  * to MediaWiki's performance-optimised locking strategy.
  *
  * @return bool success
  */
 function doEdit($text, $summary, $flags = 0)
 {
     global $wgUser, $wgDBtransactions;
     wfProfileIn(__METHOD__);
     $good = true;
     if (!($flags & EDIT_NEW) && !($flags & EDIT_UPDATE)) {
         $aid = $this->mTitle->getArticleID(GAID_FOR_UPDATE);
         if ($aid) {
             $flags |= EDIT_UPDATE;
         } else {
             $flags |= EDIT_NEW;
         }
     }
     if (!wfRunHooks('ArticleSave', array(&$this, &$wgUser, &$text, &$summary, $flags & EDIT_MINOR, null, null, &$flags))) {
         wfDebug(__METHOD__ . ": ArticleSave hook aborted save!\n");
         wfProfileOut(__METHOD__);
         return false;
     }
     # Silently ignore EDIT_MINOR if not allowed
     $isminor = $flags & EDIT_MINOR && $wgUser->isAllowed('minoredit');
     $bot = $wgUser->isAllowed('bot') || $flags & EDIT_FORCE_BOT;
     $oldtext = $this->getContent();
     $oldsize = strlen($oldtext);
     # Provide autosummaries if one is not provided.
     if ($flags & EDIT_AUTOSUMMARY && $summary == '') {
         $summary = $this->getAutosummary($oldtext, $text, $flags);
     }
     $text = $this->preSaveTransform($text);
     $newsize = strlen($text);
     $dbw =& wfGetDB(DB_MASTER);
     $now = wfTimestampNow();
     if ($flags & EDIT_UPDATE) {
         # Update article, but only if changed.
         # Make sure the revision is either completely inserted or not inserted at all
         if (!$wgDBtransactions) {
             $userAbort = ignore_user_abort(true);
         }
         $lastRevision = 0;
         $revisionId = 0;
         if (0 != strcmp($text, $oldtext)) {
             $this->mGoodAdjustment = (int) $this->isCountable($text) - (int) $this->isCountable($oldtext);
             $this->mTotalAdjustment = 0;
             $lastRevision = $dbw->selectField('page', 'page_latest', array('page_id' => $this->getId()));
             if (!$lastRevision) {
                 # Article gone missing
                 wfDebug(__METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n");
                 wfProfileOut(__METHOD__);
                 return false;
             }
             $revision = new Revision(array('page' => $this->getId(), 'comment' => $summary, 'minor_edit' => $isminor, 'text' => $text));
             $dbw->begin();
             $revisionId = $revision->insertOn($dbw);
             # Update page
             $ok = $this->updateRevisionOn($dbw, $revision, $lastRevision);
             if (!$ok) {
                 /* Belated edit conflict! Run away!! */
                 $good = false;
                 $dbw->rollback();
             } else {
                 # Update recentchanges
                 if (!($flags & EDIT_SUPPRESS_RC)) {
                     $rcid = RecentChange::notifyEdit($now, $this->mTitle, $isminor, $wgUser, $summary, $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, $revisionId);
                     # Mark as patrolled if the user can do so
                     if ($wgUser->isAllowed('autopatrol')) {
                         RecentChange::markPatrolled($rcid);
                     }
//.........这里部分代码省略.........
开发者ID:negabaro,项目名称:alfresco,代码行数:101,代码来源:Article.php

示例5: execute


//.........这里部分代码省略.........
     $i = 0;
     while ($arg = $this->getArg($i++)) {
         if (file_exists($arg)) {
             $files[$arg] = file_get_contents($arg);
         } else {
             // use glob to support the Windows shell, which doesn't automatically
             // expand wildcards
             $found = false;
             foreach (glob($arg) as $filename) {
                 $found = true;
                 $files[$filename] = file_get_contents($filename);
             }
             if (!$found) {
                 $this->error("Fatal error: The file '{$arg}' does not exist!", 1);
             }
         }
     }
     $count = count($files);
     $this->output("Importing {$count} pages...\n");
     if ($userName === false) {
         $user = User::newSystemUser('Maintenance script', ['steal' => true]);
     } else {
         $user = User::newFromName($userName);
     }
     if (!$user) {
         $this->error("Invalid username\n", true);
     }
     if ($user->isAnon()) {
         $user->addToDatabase();
     }
     $exit = 0;
     $successCount = 0;
     $failCount = 0;
     $skipCount = 0;
     foreach ($files as $file => $text) {
         $pageName = $prefix . pathinfo($file, PATHINFO_FILENAME);
         $timestamp = $useTimestamp ? wfTimestamp(TS_UNIX, filemtime($file)) : wfTimestampNow();
         $title = Title::newFromText($pageName);
         // Have to check for # manually, since it gets interpreted as a fragment
         if (!$title || $title->hasFragment()) {
             $this->error("Invalid title {$pageName}. Skipping.\n");
             $skipCount++;
             continue;
         }
         $exists = $title->exists();
         $oldRevID = $title->getLatestRevID();
         $oldRev = $oldRevID ? Revision::newFromId($oldRevID) : null;
         $actualTitle = $title->getPrefixedText();
         if ($exists) {
             $touched = wfTimestamp(TS_UNIX, $title->getTouched());
             if (!$overwrite) {
                 $this->output("Title {$actualTitle} already exists. Skipping.\n");
                 $skipCount++;
                 continue;
             } elseif ($useTimestamp && intval($touched) >= intval($timestamp)) {
                 $this->output("File for title {$actualTitle} has not been modified since the " . "destination page was touched. Skipping.\n");
                 $skipCount++;
                 continue;
             }
         }
         $rev = new WikiRevision(ConfigFactory::getDefaultInstance()->makeConfig('main'));
         $rev->setText(rtrim($text));
         $rev->setTitle($title);
         $rev->setUserObj($user);
         $rev->setComment($summary);
         $rev->setTimestamp($timestamp);
         if ($exists && $overwrite && $rev->getContent()->equals($oldRev->getContent())) {
             $this->output("File for title {$actualTitle} contains no changes from the current " . "revision. Skipping.\n");
             $skipCount++;
             continue;
         }
         $status = $rev->importOldRevision();
         $newId = $title->getLatestRevID();
         if ($status) {
             $action = $exists ? 'updated' : 'created';
             $this->output("Successfully {$action} {$actualTitle}\n");
             $successCount++;
         } else {
             $action = $exists ? 'update' : 'create';
             $this->output("Failed to {$action} {$actualTitle}\n");
             $failCount++;
             $exit = 1;
         }
         // Create the RecentChanges entry if necessary
         if ($rc && $status) {
             if ($exists) {
                 if (is_object($oldRev)) {
                     $oldContent = $oldRev->getContent();
                     RecentChange::notifyEdit($timestamp, $title, $rev->getMinor(), $user, $summary, $oldRevID, $oldRev->getTimestamp(), $bot, '', $oldContent ? $oldContent->getSize() : 0, $rev->getContent()->getSize(), $newId, 1);
                 }
             } else {
                 RecentChange::notifyNew($timestamp, $title, $rev->getMinor(), $user, $summary, $bot, '', $rev->getContent()->getSize(), $newId, 1);
             }
         }
     }
     $this->output("Done! {$successCount} succeeded, {$skipCount} skipped.\n");
     if ($exit) {
         $this->error("Import failed with {$failCount} failed pages.\n", $exit);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:101,代码来源:importTextFiles.php

示例6: doEditContent


//.........这里部分代码省略.........
         if ($changed) {
             $prepStatus = $content->prepareSave($this, $flags, $oldid, $user);
             $status->merge($prepStatus);
             if (!$status->isOK()) {
                 return $status;
             }
             $dbw->begin(__METHOD__);
             // Get the latest page_latest value while locking it.
             // Do a CAS style check to see if it's the same as when this method
             // started. If it changed then bail out before touching the DB.
             $latestNow = $this->lockAndGetLatest();
             if ($latestNow != $oldid) {
                 $dbw->commit(__METHOD__);
                 // Page updated or deleted in the mean time
                 $status->fatal('edit-conflict');
                 return $status;
             }
             // At this point we are now comitted to returning an OK
             // status unless some DB query error or other exception comes up.
             // This way callers don't have to call rollback() if $status is bad
             // unless they actually try to catch exceptions (which is rare).
             $revisionId = $revision->insertOn($dbw);
             // Update page_latest and friends to reflect the new revision
             if (!$this->updateRevisionOn($dbw, $revision, null, $oldIsRedirect)) {
                 $dbw->rollback(__METHOD__);
                 throw new MWException("Failed to update page row to use new revision.");
             }
             Hooks::run('NewRevisionFromEditComplete', array($this, $revision, $baseRevId, $user));
             // Update recentchanges
             if (!($flags & EDIT_SUPPRESS_RC)) {
                 // Mark as patrolled if the user can do so
                 $patrolled = $wgUseRCPatrol && !count($this->mTitle->getUserPermissionsErrors('autopatrol', $user));
                 // Add RC row to the DB
                 RecentChange::notifyEdit($now, $this->mTitle, $isminor, $user, $summary, $oldid, $this->getTimestamp(), $bot, '', $oldsize, $newsize, $revisionId, $patrolled);
             }
             $user->incEditCount();
             $dbw->commit(__METHOD__);
             $this->mTimestamp = $now;
         } else {
             // Bug 32948: revision ID must be set to page {{REVISIONID}} and
             // related variables correctly
             $revision->setId($this->getLatest());
         }
         // Update links tables, site stats, etc.
         $this->doEditUpdates($revision, $user, array('changed' => $changed, 'oldcountable' => $oldcountable, 'oldrevision' => $old_revision));
         if (!$changed) {
             $status->warning('edit-no-change');
             $revision = null;
             // Update page_touched, this is usually implicit in the page update
             // Other cache updates are done in onArticleEdit()
             $this->mTitle->invalidateCache($now);
         }
     } else {
         // Create new article
         $status->value['new'] = true;
         $prepStatus = $content->prepareSave($this, $flags, $oldid, $user);
         $status->merge($prepStatus);
         if (!$status->isOK()) {
             return $status;
         }
         $dbw->begin(__METHOD__);
         // Add the page record unless one already exists for the title
         $newid = $this->insertOn($dbw);
         if ($newid === false) {
             $dbw->commit(__METHOD__);
             // nothing inserted
开发者ID:mb720,项目名称:mediawiki,代码行数:67,代码来源:WikiPage.php

示例7: updateArticle

 /**
  * Change an existing article. Puts the previous version back into the old table, updates RC
  * and all necessary caches, mostly via the deferred update array.
  *
  * It is possible to call this function from a command-line script, but note that you should
  * first set $wgUser, and clean up $wgDeferredUpdates after each edit.
  */
 function updateArticle($text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '')
 {
     global $wgOut, $wgUser;
     global $wgDBtransactions, $wgMwRedir;
     global $wgUseSquid, $wgInternalServer, $wgPostCommitUpdateList, $wgUseFileCache;
     $fname = 'Article::updateArticle';
     wfProfileIn($fname);
     $good = true;
     $isminor = $minor && $wgUser->isLoggedIn();
     if ($this->isRedirect($text)) {
         # Remove all content but redirect
         # This could be done by reconstructing the redirect from a title given by
         # Title::newFromRedirect(), but then we wouldn't know which synonym the user
         # wants to see
         if (preg_match("/^((" . $wgMwRedir->getBaseRegex() . ')[^\\n]+)/i', $text, $m)) {
             $redir = 1;
             $text = $m[1] . "\n";
         }
     } else {
         $redir = 0;
     }
     $text = $this->preSaveTransform($text);
     $dbw =& wfGetDB(DB_MASTER);
     $now = wfTimestampNow();
     # Update article, but only if changed.
     # It's important that we either rollback or complete, otherwise an attacker could
     # overwrite cur entries by sending precisely timed user aborts. Random bored users
     # could conceivably have the same effect, especially if cur is locked for long periods.
     if (!$wgDBtransactions) {
         $userAbort = ignore_user_abort(true);
     }
     $oldtext = $this->getContent(true);
     $oldsize = strlen($oldtext);
     $newsize = strlen($text);
     $lastRevision = 0;
     if (0 != strcmp($text, $oldtext)) {
         $empty = false;
         $this->mGoodAdjustment = $this->isCountable($text) - $this->isCountable($oldtext);
         $this->mTotalAdjustment = 0;
         $now = wfTimestampNow();
         $lastRevision = $dbw->selectField('page', 'page_latest', array('page_id' => $this->getId()));
         $revision = new Revision(array('page' => $this->getId(), 'comment' => $summary, 'minor_edit' => $isminor, 'text' => $text));
         $dbw->immediateCommit();
         $dbw->begin();
         $revisionId = $revision->insertOn($dbw);
         # Update page
         $ok = $this->updateRevisionOn($dbw, $revision, $lastRevision);
         if (!$ok) {
             /* Belated edit conflict! Run away!! */
             $good = false;
             $dbw->rollback();
         } else {
             # Update recentchanges (moved some lines below) and purge cache and whatnot
             $bot = (int) ($wgUser->isBot() || $forceBot);
             Article::onArticleEdit($this->mTitle);
             $dbw->commit();
         }
     } else {
         $empty = true;
     }
     if (!$wgDBtransactions) {
         ignore_user_abort($userAbort);
     }
     if ($good) {
         if ($watchthis) {
             if (!$this->mTitle->userIsWatching()) {
                 $this->watch();
             }
         } else {
             if ($this->mTitle->userIsWatching()) {
                 $this->unwatch();
             }
         }
         # standard deferred updates
         $this->editUpdates($text);
         if (!$empty) {
             # moved from above to make sure editUpdates were performed:
             # Is important to call RecentChange::notifyEdit _after_ editUpdates
             # because a user_newtalk flag and addwatch might be committed in editUpdates
             # which triggers the sending of an Enotif in RecentChange::notifyEdit just right now
             RecentChange::notifyEdit($now, $this->mTitle, $isminor, $wgUser, $summary, $lastRevision, $this->getTimestamp(), $bot, '', $oldsize, $newsize, $revisionId);
         }
         $urls = array();
         # Template namespace
         # Purge all articles linking here
         if ($this->mTitle->getNamespace() == NS_TEMPLATE) {
             $titles = $this->mTitle->getLinksTo();
             Title::touchArray($titles);
             if ($wgUseSquid) {
                 foreach ($titles as $title) {
                     $urls[] = $title->getInternalURL();
                 }
             }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:101,代码来源:Article.php

示例8: saveWithinTransaction

	public function saveWithinTransaction() {
		global
			$wgTitle, $wgUser, $wgRequest;

		$summary = $wgRequest->getText( 'summary' );

		// Insert transaction information into the DB
		startNewTransaction( $wgUser->getID(), wfGetIP(), $summary );

		// Perform regular save
		$this->save( new QueryAtTransactionInformation( $wgRequest->getInt( 'transaction' ), false ) );

		// Update page caches
		$wgTitle->invalidateCache();

		// Add change to RC log
		$now = wfTimestampNow();
		RecentChange::notifyEdit( $now, $wgTitle, false, $wgUser, $summary, 0, $now, false, '', 0, 0, 0 );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:Wikidata.php


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