MediaWiki r41649 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r41648‎ | r41649 (on ViewVC)‎ | r41650 >
Date:13:43, 4 October 2008
Author:catrope
Status:old
Tags:
Comment:
(bug 15647) API edit with basetimestamp fails if the page has been deleted and undeleted since the last edit
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/api/ApiEditPage.php
===================================================================
--- trunk/phase3/includes/api/ApiEditPage.php	(revision 41648)
+++ trunk/phase3/includes/api/ApiEditPage.php	(revision 41649)
@@ -100,8 +100,11 @@
 			$reqArr['wpEdittime'] = wfTimestamp(TS_MW, $params['basetimestamp']);
 		else
 			$reqArr['wpEdittime'] = $articleObj->getTimestamp();
-		# Fake wpStartime
-		$reqArr['wpStarttime'] = $reqArr['wpEdittime'];
+		if(!is_null($params['starttimestamp']) && $params['starttimestamp'] != '')
+			$reqArr['wpStarttime'] = wfTimestamp(TS_MW, $params['starttimestamp']);
+		else
+			# Fake wpStartime
+			$reqArr['wpStarttime'] = $reqArr['wpEdittime'];
 		if($params['minor'] || (!$params['notminor'] && $wgUser->getOption('minordefault')))
 			$reqArr['wpMinoredit'] = '';
 		if($params['recreate'])
@@ -253,6 +256,7 @@
 			'notminor' => false,
 			'bot' => false,
 			'basetimestamp' => null,
+			'starttimestamp' => null,
 			'recreate' => false,
 			'createonly' => false,
 			'nocreate' => false,
@@ -279,6 +283,9 @@
 			'basetimestamp' => array('Timestamp of the base revision (gotten through prop=revisions&rvprop=timestamp).',
 						'Used to detect edit conflicts; leave unset to ignore conflicts.'
 			),
+			'starttimestamp' => array('Timestamp when you obtained the edit token.',
+						'Used to detect edit conflicts; leave unset to ignore conflicts.'
+			),
 			'recreate' => 'Override any errors about the article having been deleted in the meantime',
 			'createonly' => 'Don\'t edit the page if it exists already',
 			'nocreate' => 'Throw an error if the page doesn\'t exist',
Index: trunk/phase3/includes/api/ApiQueryInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryInfo.php	(revision 41648)
+++ trunk/phase3/includes/api/ApiQueryInfo.php	(revision 41649)
@@ -403,6 +403,7 @@
 
 			if (!is_null($params['token'])) {
 				$tokenFunctions = $this->getTokenFunctions();
+				$pageInfo['starttimestamp'] = wfTimestamp(TS_ISO_8601, time());
 				foreach($params['token'] as $t)
 				{
 					$val = call_user_func($tokenFunctions[$t], $pageid, $title);
@@ -475,6 +476,7 @@
 				if(!is_null($params['token'])) 
 				{
 					$tokenFunctions = $this->getTokenFunctions();
+					$res['query']['pages'][$pageid]['starttimestamp'] = wfTimestamp(TS_ISO_8601, time());
 					foreach($params['token'] as $t)
 					{
 						$val = call_user_func($tokenFunctions[$t], $pageid, $title);
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 41648)
+++ trunk/phase3/RELEASE-NOTES	(revision 41649)
@@ -291,6 +291,8 @@
   be disabled in LocalSettings.php
 * (bug 15653) Add prop=duplicatefiles
 * (bug 15768) Add list=watchlistraw
+* (bug 15647) action=edit with basetimestamp fails if the page has been deleted
+  and undeleted since the last edit
 
 === Languages updated in 1.14 ===
 

Status & tagging log

  • 17:05, 4 January 2012 Johnduhart (Talk | contribs) changed the tags for r41649 [removed: api]
  • 15:32, 12 September 2011 Meno25 (Talk | contribs) changed the status of r41649 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox