* Use PLURAL for 'search-result-size'
[lhc/web/wiklou.git] / includes / FileStore.php
index 8f25e2e..a547e7e 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+/**
+ * @todo document (needs one-sentence top-level class description).
+ */
 class FileStore {
        const DELETE_ORIGINAL = 1;
        
@@ -33,7 +36,7 @@ class FileStore {
         * suffer an uncaught error the lock will be released when the
         * connection is closed.
         *
-        * @fixme Probably only works on MySQL. Abstract to the Database class?
+        * @todo Probably only works on MySQL. Abstract to the Database class?
         */
        static function lock() {
                global $wgDBtype;
@@ -159,7 +162,7 @@ class FileStore {
        function delete( $key ) {
                $destPath = $this->filePath( $key );
                if( false === $destPath ) {
-                       throw new FSExcepton( "file store does not contain file '$key'" );
+                       throw new FSException( "file store does not contain file '$key'" );
                } else {
                        return FileStore::deleteFile( $destPath );
                }
@@ -175,7 +178,7 @@ class FileStore {
         * @throws FSException if file can't be deleted
         * @return FSTransaction
         *
-        * @fixme Might be worth preliminary permissions check
+        * @todo Might be worth preliminary permissions check
         */
        static function deleteFile( $path ) {
                if( file_exists( $path ) ) {
@@ -216,7 +219,7 @@ class FileStore {
         * Confirm that the given file key is valid.
         * Note that a valid key may refer to a file that does not exist.
         *
-        * Key should consist of a 32-digit base-36 SHA-1 hash and
+        * Key should consist of a 31-digit base-36 SHA-1 hash and
         * an optional alphanumeric extension, all lowercase.
         * The whole must not exceed 64 characters.
         *
@@ -224,7 +227,7 @@ class FileStore {
         * @return boolean
         */
        static function validKey( $key ) {
-               return preg_match( '/^[0-9a-z]{32}(\.[0-9a-z]{1,31})?$/', $key );
+               return preg_match( '/^[0-9a-z]{31,32}(\.[0-9a-z]{1,31})?$/', $key );
        }
        
        
@@ -246,7 +249,7 @@ class FileStore {
                        return false;
                }
                
-               $base36 = wfBaseConvert( $hash, 16, 36, 32 );
+               $base36 = wfBaseConvert( $hash, 16, 36, 31 );
                if( $extension == '' ) {
                        $key = $base36;
                } else {
@@ -368,6 +371,9 @@ class FSTransaction {
        }
 }
 
+/**
+ * @addtogroup Exception
+ */
 class FSException extends MWException { }
 
-?>
+