r76740 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76739‎ | r76740 | r76741 >
Date:23:49, 15 November 2010
Author:neilk
Status:ok
Tags:
Comment:
updated comments, error messages. Removing exposure of actual paths in error message, while convenient for a developer it probably should not be exposed to the public.
Modified paths:
  • /trunk/phase3/includes/upload/UploadStash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadStash.php
@@ -72,7 +72,7 @@
7373 * @param $key Integer: key
7474 * @throws UploadStashFileNotFoundException
7575 * @throws UploadStashBadVersionException
76 - * @return UploadStashItem: null if no such item or item out of date, or the item
 76+ * @return UploadStashFile
7777 */
7878 public function getFile( $key ) {
7979 if ( ! preg_match( self::KEY_FORMAT_REGEX, $key ) ) {
@@ -81,7 +81,7 @@
8282
8383 if ( !isset( $this->files[$key] ) ) {
8484 if ( !isset( $_SESSION[UploadBase::SESSION_KEYNAME][$key] ) ) {
85 - throw new UploadStashFileNotFoundException( "key '$key' not found in session" );
 85+ throw new UploadStashFileNotFoundException( "key '$key' not found in stash" );
8686 }
8787
8888 $data = $_SESSION[UploadBase::SESSION_KEYNAME][$key];
@@ -116,7 +116,7 @@
117117 */
118118 public function stashFile( $path, $data = array(), $key = null ) {
119119 if ( ! file_exists( $path ) ) {
120 - throw new UploadStashBadPathException( "path '$path' doesn't exist" );
 120+ throw new UploadStashBadPathException( "path doesn't exist" );
121121 }
122122 $fileProps = File::getPropsFromPath( $path );
123123
@@ -200,12 +200,12 @@
201201 $repoTempPath = $repo->getZonePath( 'temp' );
202202 if ( ( ! $repo->validateFilename( $path ) ) ||
203203 ( strpos( $path, $repoTempPath ) !== 0 ) ) {
204 - throw new UploadStashBadPathException( "path '$path' is not valid or is not in repo temp area: '$repoTempPath'" );
 204+ throw new UploadStashBadPathException( 'path is not valid' );
205205 }
206206
207207 // check if path exists! and is a plain file.
208208 if ( ! $repo->fileExists( $path, FileRepo::FILES_ONLY ) ) {
209 - throw new UploadStashFileNotFoundException( "cannot find path '$path'" );
 209+ throw new UploadStashFileNotFoundException( 'cannot find path, or not a plain file' );
210210 }
211211
212212 parent::__construct( false, $repo, $path, false );
@@ -257,7 +257,7 @@
258258 }
259259
260260 if ( is_null( $extension ) ) {
261 - throw new UploadStashFileException( "extension '$extension' is null" );
 261+ throw new UploadStashFileException( "extension is null" );
262262 }
263263
264264 $this->extension = parent::normalizeExtension( $extension );

Follow-up revisions

RevisionCommit summaryAuthorDate
r76797uploadwizard-deployment: Merge recent revs from trunk: r75995, r76354, r76386...catrope14:47, 16 November 2010

Status & tagging log