* @ingroup FileBackend
*/
class FSFile {
- protected $path; // path to file
- private $sha1Base36 = null; // File Sha1Base36
+ /** @var string Path to file */
+ protected $path;
+
+ /** @var string File SHA-1 in base 36 */
+ protected $sha1Base36;
/**
* Sets up the file object
if ( $timestamp !== false ) {
$timestamp = wfTimestamp( TS_MW, $timestamp );
}
+
return $timestamp;
}
* Get an associative array containing information about
* a file with the given storage path.
*
- * @param Mixed $ext: the file extension, or true to extract it from the filename.
+ * @param mixed $ext The file extension, or true to extract it from the filename.
* Set it to false to ignore the extension.
*
* @return array
}
wfProfileOut( __METHOD__ );
+
return $info;
}
/**
* Placeholder file properties to use for files that don't exist
*
- * @return Array
+ * @return array
*/
public static function placeholderProps() {
$info = array();
$info['width'] = 0;
$info['height'] = 0;
$info['bits'] = 0;
+
return $info;
}
* Exract image size information
*
* @param array $gis
- * @return Array
+ * @return array
*/
protected function extractImageSizeInfo( array $gis ) {
$info = array();
} else {
$info['bits'] = 0;
}
+
return $info;
}
if ( $this->sha1Base36 !== null && !$recache ) {
wfProfileOut( __METHOD__ );
+
return $this->sha1Base36;
}
}
wfProfileOut( __METHOD__ );
+
return $this->sha1Base36;
}
*/
public static function extensionFromPath( $path ) {
$i = strrpos( $path, '.' );
+
return strtolower( $i ? substr( $path, $i + 1 ) : '' );
}
* Get an associative array containing information about a file in the local filesystem.
*
* @param string $path absolute local filesystem path
- * @param Mixed $ext: the file extension, or true to extract it from the filename.
- * Set it to false to ignore the extension.
- *
+ * @param mixed $ext The file extension, or true to extract it from the filename.
+ * Set it to false to ignore the extension.
* @return array
*/
public static function getPropsFromPath( $path, $ext = true ) {
$fsFile = new self( $path );
+
return $fsFile->getProps( $ext );
}
* fairly neatly.
*
* @param string $path
- * @param bool $recache
- *
* @return bool|string False on failure
*/
- public static function getSha1Base36FromPath( $path, $recache = false ) {
- static $sha1Base36 = array();
-
- if ( !isset( $sha1Base36[$path] ) || $recache ) {
- $fsFile = new self( $path );
- $sha1Base36[$path] = $fsFile->getSha1Base36();
- }
+ public static function getSha1Base36FromPath( $path ) {
+ $fsFile = new self( $path );
- return $sha1Base36[$path];
+ return $fsFile->getSha1Base36();
}
}