From: Tim Starling Date: Sat, 16 Apr 2005 11:28:15 +0000 (+0000) Subject: Support for non-standard commons configurations X-Git-Tag: 1.5.0alpha1~252 X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;ds=sidebyside;h=133b4aad48027afda395c241e96e7c565aa8ec09;p=lhc%2Fweb%2Fwiklou.git Support for non-standard commons configurations --- diff --git a/includes/Image.php b/includes/Image.php index b2d457fcc2..0b5ac62673 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -285,10 +285,13 @@ class Image * Load image metadata from cache or DB, unless already loaded */ function load() { + global $wgSharedUploadDBname, $wgUseSharedUploads; if ( !$this->dataLoaded ) { if ( !$this->loadFromCache() ) { $this->loadFromDB(); - if ( $this->fileExists ) { + if ( !$wgSharedUploadDBname && $wgUseSharedUploads ) { + $this->loadFromFile(); + } elseif ( $this->fileExists ) { $this->saveToCache(); } } @@ -1043,12 +1046,21 @@ function wfImageDir( $fname ) { * @access public */ function wfImageThumbDir( $fname, $shared = false ) { - $dir = wfImageArchiveDir( $fname, 'thumb', $shared ) . "/$fname"; + $base = wfImageArchiveDir( $fname, 'thumb', $shared ); + $dir = "$base/$fname"; + + if ( !is_dir( $base ) ) { + $oldumask = umask(0); + @mkdir( $base, 0777 ); + umask( $oldumask ); + } + if ( ! is_dir( $dir ) ) { $oldumask = umask(0); @mkdir( $dir, 0777 ); umask( $oldumask ); } + return $dir; }