Supress chmod() errors, they're annoying and very common. In all liklihood, the wiki...
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 7 May 2009 16:18:42 +0000 (16:18 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 7 May 2009 16:18:42 +0000 (16:18 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
includes/filerepo/FSRepo.php

index 6c98941..8d7379b 100644 (file)
@@ -22,6 +22,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 
 * (bug 18222) $wgMinimalPasswordLength default is now 1
 * $wgSessionHandler can be used to configure session.save_handler
+* $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to
+  be used when uploading/moving files
 
 === New features in 1.16 ===
 
@@ -113,7 +115,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 6802) profileinfo.php now also work on other database servers than MySQL
 * (bug 16925) Diffs no longer fail when $wgExternalDiffEngine is set to 'wikidiff'
   or 'wikidiff2' but extension is not installed
-
+* (bug 18326) Chmod errors in file repos have been hidden
 
 == API changes in 1.16 ==
 
index 4168ece..0c146d5 100644 (file)
@@ -208,6 +208,8 @@ $wgFileStore['deleted']['hash'] = 3;         ///< 3-level subdirectory split
  *                      May be 'paranoid' to remove all parameters from error messages, 'none' to
  *                      leave the paths in unchanged, or 'simple' to replace paths with
  *                      placeholders. Default for LocalRepo is 'simple'.
+ *    fileMode          This allows wikis to set the file mode when uploading/moving files. Default
+ *                      is 0644.
  *
  * These settings describe a foreign MediaWiki installation. They are optional, and will be ignored
  * for local repositories:
index 95158cd..7a3a162 100644 (file)
@@ -6,7 +6,7 @@
  * @ingroup FileRepo
  */
 class FSRepo extends FileRepo {
-       var $directory, $deletedDir, $url, $deletedHashLevels;
+       var $directory, $deletedDir, $url, $deletedHashLevels, $fileMode;
        var $fileFactory = array( 'UnregisteredLocalFile', 'newFromTitle' );
        var $oldFileFactory = false;
        var $pathDisclosureProtection = 'simple';
@@ -23,6 +23,7 @@ class FSRepo extends FileRepo {
                $this->deletedHashLevels = isset( $info['deletedHashLevels'] ) ?
                        $info['deletedHashLevels'] : $this->hashLevels;
                $this->deletedDir = isset( $info['deletedDir'] ) ? $info['deletedDir'] : false;
+               $this->fileMode = isset( $info['fileMode'] ) ? $info['fileMode'] : 0644;
        }
 
        /**
@@ -203,7 +204,7 @@ class FSRepo extends FileRepo {
                                }
                        }
                        if ( $good ) {
-                               chmod( $dstPath, 0644 );
+                               @chmod( $dstPath, $this->fileMode );
                                $status->successCount++;
                        } else {
                                $status->failCount++;
@@ -389,7 +390,7 @@ class FSRepo extends FileRepo {
                                $status->successCount++;
                                wfDebug(__METHOD__.": wrote tempfile $srcPath to $dstPath\n");
                                // Thread-safe override for umask
-                               chmod( $dstPath, 0644 );
+                               @chmod( $dstPath, $this->fileMode );
                        } else {
                                $status->failCount++;
                        }
@@ -466,7 +467,7 @@ class FSRepo extends FileRepo {
                                        $status->error( 'filerenameerror', $srcPath, $archivePath );
                                        $good = false;
                                } else {
-                                       @chmod( $archivePath, 0644 );
+                                       @chmod( $archivePath, $this->fileMode );
                                }
                        }
                        if ( $good ) {