r76581 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76580‎ | r76581 | r76582 >
Date:16:42, 12 November 2010
Author:ialex
Status:ok
Tags:
Comment:
Fixed some doxygen warnings
Modified paths:
  • /trunk/phase3/includes/upload/UploadStash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadStash.php
@@ -34,7 +34,8 @@
3535 /**
3636 * Represents the session which contains temporarily stored files.
3737 * Designed to be compatible with the session stashing code in UploadBase (should replace it eventually)
38 - * @param {FileRepo} $repo: optional -- repo in which to store files. Will choose LocalRepo if not supplied.
 38+ *
 39+ * @param $repo FileRepo: optional -- repo in which to store files. Will choose LocalRepo if not supplied.
3940 */
4041 public function __construct( $repo = null ) {
4142
@@ -56,20 +57,22 @@
5758 }
5859
5960 /**
60 - * Get the base of URLs by which one can access the files
61 - * @return {String} url
 61+ * Get the base of URLs by which one can access the files
 62+ *
 63+ * @return String: url
6264 */
6365 public function getBaseUrl() {
6466 return $this->baseUrl;
6567 }
6668
67 - /**
 69+ /**
6870 * Get a file and its metadata from the stash.
6971 * May throw exception if session data cannot be parsed due to schema change, or key not found.
70 - * @param {Integer} $key: key
 72+ *
 73+ * @param $key Integer: key
7174 * @throws UploadStashFileNotFoundException
7275 * @throws UploadStashBadVersionException
73 - * @return {UploadStashItem} null if no such item or item out of date, or the item
 76+ * @return UploadStashItem: null if no such item or item out of date, or the item
7477 */
7578 public function getFile( $key ) {
7679 if ( ! preg_match( self::KEY_FORMAT_REGEX, $key ) ) {
@@ -104,12 +107,12 @@
105108 * We store data in a flat key-val namespace because that's how UploadBase did it. This also means we have to
106109 * ensure that the key-val pairs in $data do not overwrite other required fields.
107110 *
108 - * @param {String} $path: path to file you want stashed
109 - * @param {Array} $data: optional, other data you want associated with the file. Do not use 'mTempPath', 'mFileProps', 'mFileSize', or 'version' as keys here
110 - * @param {String} $key: optional, unique key for this file in this session. Used for directory hashing when storing, otherwise not important
 111+ * @param $path String: path to file you want stashed
 112+ * @param $data Array: optional, other data you want associated with the file. Do not use 'mTempPath', 'mFileProps', 'mFileSize', or 'version' as keys here
 113+ * @param $key String: optional, unique key for this file in this session. Used for directory hashing when storing, otherwise not important
111114 * @throws UploadStashBadPathException
112115 * @throws UploadStashFileException
113 - * @return {null|UploadStashFile} file, or null on failure
 116+ * @return UploadStashFile: file, or null on failure
114117 */
115118 public function stashFile( $path, $data = array(), $key = null ) {
116119 if ( ! file_exists( $path ) ) {
@@ -174,11 +177,12 @@
175178 /**
176179 * A LocalFile wrapper around a file that has been temporarily stashed, so we can do things like create thumbnails for it
177180 * Arguably UnregisteredLocalFile should be handling its own file repo but that class is a bit retarded currently
178 - * @param {UploadStash} $stash: UploadStash, useful for obtaining config, stashing transformed files
179 - * @param {FileRepo} $repo: repository where we should find the path
180 - * @param {String} $path: path to file
181 - * @param {String} $key: key to store the path and any stashed data under
182 - * @param {String} $data: any other data we want stored with this file
 181+ *
 182+ * @param $stash UploadStash: useful for obtaining config, stashing transformed files
 183+ * @param $repo FileRepo: repository where we should find the path
 184+ * @param $path String: path to file
 185+ * @param $key String: key to store the path and any stashed data under
 186+ * @param $data String: any other data we want stored with this file
183187 * @throws UploadStashBadPathException
184188 * @throws UploadStashFileNotFoundException
185189 */
@@ -218,7 +222,8 @@
219223 * We do not necessarily care about doing the description at this point
220224 * However, we also can't return the empty string, as the rest of MediaWiki demands this (and calls to imagemagick
221225 * convert require it to be there)
222 - * @return {String} dummy value
 226+ *
 227+ * @return String: dummy value
223228 */
224229 public function getDescriptionUrl() {
225230 return $this->getUrl();
@@ -263,8 +268,8 @@
264269 * The actual argument is the result of thumbName although we seem to have
265270 * buggy code elsewhere that expects a boolean 'suffix'
266271 *
267 - * @param {String|false} $thumbName: name of thumbnail (e.g. "120px-123456.jpg" ), or false to just get the path
268 - * @return {String} path thumbnail should take on filesystem, or containing directory if thumbname is false
 272+ * @param $thumbName String: name of thumbnail (e.g. "120px-123456.jpg" ), or false to just get the path
 273+ * @return String: path thumbnail should take on filesystem, or containing directory if thumbname is false
269274 */
270275 public function getThumbPath( $thumbName = false ) {
271276 $path = dirname( $this->path );
@@ -277,8 +282,8 @@
278283 /**
279284 * Return the file/url base name of a thumbnail with the specified parameters
280285 *
281 - * @param {Array} $params: handler-specific parameters
282 - * @return {String|null} base name for URL, like '120px-12345.jpg', or null if there is no handler
 286+ * @param $params Array: handler-specific parameters
 287+ * @return String: base name for URL, like '120px-12345.jpg', or null if there is no handler
283288 */
284289 function thumbName( $params ) {
285290 if ( !$this->getHandler() ) {
@@ -299,8 +304,8 @@
300305 * the thumbnail urls be predictable. However, in our model the URL is not based on the filename
301306 * (that's hidden in the session)
302307 *
303 - * @param {String} $thumbName: basename of thumbnail file -- however, we don't want to use the file exactly
304 - * @return {String} URL to access thumbnail, or URL with partial path
 308+ * @param $thumbName String: basename of thumbnail file -- however, we don't want to use the file exactly
 309+ * @return String: URL to access thumbnail, or URL with partial path
305310 */
306311 public function getThumbUrl( $thumbName = false ) {
307312 $path = $this->sessionStash->getBaseUrl();
@@ -313,7 +318,8 @@
314319 /**
315320 * The basename for the URL, which we want to not be related to the filename.
316321 * Will also be used as the lookup key for a thumbnail file.
317 - * @return {String} base url name, like '120px-123456.jpg'
 322+ *
 323+ * @return String: base url name, like '120px-123456.jpg'
318324 */
319325 public function getUrlName() {
320326 if ( ! $this->urlName ) {
@@ -324,8 +330,9 @@
325331
326332 /**
327333 * Return the URL of the file, if for some reason we wanted to download it
328 - * We tend not to do this for the original file, but we do want thumb icons
329 - * @return {String} url
 334+ * We tend not to do this for the original file, but we do want thumb icons
 335+ *
 336+ * @return String: url
330337 */
331338 public function getUrl() {
332339 if ( !isset( $this->url ) ) {
@@ -338,7 +345,7 @@
339346 * Parent classes use this method, for no obvious reason, to return the path (relative to wiki root, I assume).
340347 * But with this class, the URL is unrelated to the path.
341348 *
342 - * @return {String} url
 349+ * @return String: url
343350 */
344351 public function getFullUrl() {
345352 return $this->getUrl();
@@ -347,7 +354,8 @@
348355
349356 /**
350357 * Getter for session key (the session-unique id by which this file's location & metadata is stored in the session)
351 - * @return {String} session key
 358+ *
 359+ * @return String: session key
352360 */
353361 public function getSessionKey() {
354362 return $this->sessionKey;
@@ -360,9 +368,9 @@
361369 * Here we override transform() to stash the thumbnail file, and then
362370 * provide a way to get at the stashed thumbnail file to extract properties such as its URL
363371 *
364 - * @param {Array} $params: parameters suitable for File::transform()
365 - * @param {Bitmask} $flags: flags suitable for File::transform()
366 - * @return {ThumbnailImage} with additional File thumbnailFile property
 372+ * @param $params Array: parameters suitable for File::transform()
 373+ * @param $flags Integer: bitmask, flags suitable for File::transform()
 374+ * @return ThumbnailImage: with additional File thumbnailFile property
367375 */
368376 public function transform( $params, $flags = 0 ) {
369377
@@ -390,7 +398,7 @@
391399
392400 /**
393401 * Remove the associated temporary file
394 - * @return {Status} success
 402+ * @return Status: success
395403 */
396404 public function remove() {
397405 return $this->repo->freeTemp( $this->path );

Status & tagging log