]> source.dussan.org Git - nextcloud-server.git/commitdiff
workaround for 32-bit systems to handle filesizes bigger than 2GB
authorThomas Mueller <thomas.mueller@tmit.eu>
Wed, 2 Jan 2013 23:35:57 +0000 (00:35 +0100)
committerThomas Mueller <thomas.mueller@tmit.eu>
Wed, 2 Jan 2013 23:38:44 +0000 (00:38 +0100)
lib/filestorage.php
lib/filestorage/local.php

index dd65f4421b7f0c18e87a125aacecc6be2b73e627..2e03c4cb6dad43c377af143e5d68afe55b52ca5d 100644 (file)
@@ -21,7 +21,7 @@
 */
 
 /**
- * Provde a common interface to all different storage options
+ * Provide a common interface to all different storage options
  */
 abstract class OC_Filestorage{
        abstract public function __construct($parameters);
index 6fe45acf8c5a3b60b4e395971100621bf029571b..0bf6ad2d3d7ddf66e02c4f16759295bc9203090c 100644 (file)
@@ -29,7 +29,24 @@ class OC_Filestorage_Local extends OC_Filestorage_Common{
                return is_file($this->datadir.$path);
        }
        public function stat($path) {
-               return stat($this->datadir.$path);
+               $fullPath = $this->datadir.$path;
+               $statResult = stat($fullPath);
+
+               // special case for 32-bit systems
+               if (PHP_INT_SIZE===4) {
+                       if (!(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'))
+                               $size = (float)exec('stat -c %s '. escapeshellarg ($fullPath));
+                       else{
+                               $fsobj = new COM("Scripting.FileSystemObject");
+                               $f = $fsobj->GetFile($fullPath);
+                               $size = $f->Size;
+                       }
+
+                       $statResult['size'] = $size;
+                       $statResult[7] = $size;
+               }
+
+               return $statResult;
        }
        public function filetype($path) {
                $filetype=filetype($this->datadir.$path);