r78083 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78082‎ | r78083 | r78084 >
Date:18:59, 8 December 2010
Author:mah
Status:ok (Comments)
Tags:
Comment:
re r75906 — replace the removed getSessionKey() with stashSession()
Modified paths:
  • /trunk/phase3/includes/upload/UploadFromUrl.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadFromUrl.php
@@ -33,19 +33,19 @@
3434
3535 /**
3636 * Entry point for API upload
37 - *
 37+ *
3838 * @param $name string
3939 * @param $url string
40 - * @param $async mixed Whether the download should be performed
 40+ * @param $async mixed Whether the download should be performed
4141 * asynchronous. False for synchronous, async or async-leavemessage for
4242 * asynchronous download.
4343 */
4444 public function initialize( $name, $url, $async = false ) {
4545 global $wgAllowAsyncCopyUploads;
46 -
 46+
4747 $this->mUrl = $url;
4848 $this->mAsync = $wgAllowAsyncCopyUploads ? $async : false;
49 -
 49+
5050 $tempPath = $this->mAsync ? null : $this->makeTemporaryFile();
5151 # File size and removeTempFile will be filled in later
5252 $this->initializePathInfo( $name, $tempPath, 0, false );
@@ -77,13 +77,13 @@
7878 && Http::isValidURI( $url )
7979 && $wgUser->isAllowed( 'upload_by_url' );
8080 }
81 -
8281
 82+
8383 public function fetchFile() {
8484 if ( !Http::isValidURI( $this->mUrl ) ) {
8585 return Status::newFatal( 'http-invalid-url' );
8686 }
87 -
 87+
8888 if ( !$this->mAsync ) {
8989 return $this->reallyFetchFile();
9090 }
@@ -91,7 +91,7 @@
9292 }
9393 /**
9494 * Create a new temporary file in the URL subdirectory of wfTempDir().
95 - *
 95+ *
9696 * @return string Path to the file
9797 */
9898 protected function makeTemporaryFile() {
@@ -99,8 +99,8 @@
100100 }
101101 /**
102102 * Save the result of a HTTP request to the temporary file
103 - *
104 - * @param $req MWHttpRequest
 103+ *
 104+ * @param $req MWHttpRequest
105105 * @return Status
106106 */
107107 private function saveTempFile( $req ) {
@@ -137,7 +137,7 @@
138138 }
139139
140140 /**
141 - * Wrapper around the parent function in order to defer verifying the
 141+ * Wrapper around the parent function in order to defer verifying the
142142 * upload until the file really has been fetched.
143143 */
144144 public function verifyUpload() {
@@ -158,7 +158,7 @@
159159 }
160160 return parent::checkWarnings();
161161 }
162 -
 162+
163163 /**
164164 * Wrapper around the parent function in order to defer checking protection
165165 * until we are sure that the file can actually be uploaded
@@ -169,7 +169,7 @@
170170 }
171171 return parent::verifyPermissions( $user );
172172 }
173 -
 173+
174174 /**
175175 * Wrapper around the parent function in order to defer uploading to the
176176 * job queue for asynchronous uploads
@@ -177,18 +177,18 @@
178178 public function performUpload( $comment, $pageText, $watch, $user ) {
179179 if ( $this->mAsync ) {
180180 $sessionKey = $this->insertJob( $comment, $pageText, $watch, $user );
181 -
 181+
182182 $status = new Status;
183183 $status->error( 'async', $sessionKey );
184184 return $status;
185185 }
186 -
 186+
187187 return parent::performUpload( $comment, $pageText, $watch, $user );
188188 }
189189
190 -
 190+
191191 protected function insertJob( $comment, $pageText, $watch, $user ) {
192 - $sessionKey = $this->getSessionKey();
 192+ $sessionKey = $this->stashSession();
193193 $job = new UploadFromUrlJob( $this->getTitle(), array(
194194 'url' => $this->mUrl,
195195 'comment' => $comment,
@@ -204,6 +204,6 @@
205205 $job->insert();
206206 return $sessionKey;
207207 }
208 -
209208
 209+
210210 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r780961.17: Merge recent fixes tagged on CodeReview, except for problematic revisio...catrope21:17, 8 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75906core changes for UploadWizard (merged from r73549 to HEAD in branches/uploadw...neilk04:32, 3 November 2010

Comments

#Comment by MarkAHershberger (talk | contribs)   19:13, 8 December 2010

Sorry for the whitespace changes. The only real change is here:

-		$sessionKey = $this->getSessionKey();
+		$sessionKey = $this->stashSession();

Status & tagging log