Clarify comment on $wgRateLimits.
[lhc/web/wiklou.git] / includes / FileStore.php
index 3d02bfa..a547e7e 100644 (file)
@@ -109,7 +109,7 @@ class FileStore {
        private function copyFile( $sourcePath, $destPath, $flags=0 ) {
                if( !file_exists( $sourcePath ) ) {
                        // Abort! Abort!
-                       throw new FSException( "missing source file '$sourcePath'\n" );
+                       throw new FSException( "missing source file '$sourcePath'" );
                }
                
                $transaction = new FSTransaction();
@@ -128,7 +128,7 @@ class FileStore {
                                
                                if( !$ok ) {
                                        throw new FSException(
-                                               "failed to create directory for '$destPath'\n" );
+                                               "failed to create directory for '$destPath'" );
                                }
                        }
                        
@@ -141,7 +141,7 @@ class FileStore {
                                $transaction->addRollback( FSTransaction::DELETE_FILE, $destPath );
                        } else {
                                throw new FSException(
-                                       __METHOD__." failed to copy '$sourcePath' to '$destPath'\n" );
+                                       __METHOD__." failed to copy '$sourcePath' to '$destPath'" );
                        }
                }
                
@@ -162,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 );
                }
@@ -219,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.
         *
@@ -227,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 );
        }
        
        
@@ -249,7 +249,7 @@ class FileStore {
                        return false;
                }
                
-               $base36 = wfBaseConvert( $hash, 16, 36, 32 );
+               $base36 = wfBaseConvert( $hash, 16, 36, 31 );
                if( $extension == '' ) {
                        $key = $base36;
                } else {
@@ -371,6 +371,9 @@ class FSTransaction {
        }
 }
 
+/**
+ * @addtogroup Exception
+ */
 class FSException extends MWException { }
 
-?>
+