[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12713] add custom function for filesize
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12713] add custom function for filesize |
Date: |
Fri, 06 Feb 2015 11:47:14 +0000 |
Revision: 12713
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12713
Author: sigurdne
Date: 2015-02-06 11:47:13 +0000 (Fri, 06 Feb 2015)
Log Message:
-----------
add custom function for filesize
Modified Paths:
--------------
trunk/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
Modified: trunk/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
2015-02-05 22:54:48 UTC (rev 12712)
+++ trunk/phpgwapi/inc/class.vfs_fileoperation_filesystem.inc.php
2015-02-06 11:47:13 UTC (rev 12713)
@@ -31,16 +31,31 @@
}
+ private function _filesize($filename)
+ {
+ $a = fopen($filename, 'r');
+ fseek($a, 0, SEEK_END);
+ $filesize = ftell($a);
+ fclose($a);
+ return $filesize;
+ }
+
public function filesize($path_parts)
{
$path = $path_parts->real_full_path;
- return filesize($path);
+
+ if(!$filesize = @filesize($path))
+ {
+ $filesize = $this->_filesize($path);
+ }
+ return $filesize;
}
public function read($path_parts)
{
$path = $path_parts->real_full_path;
- $filesize = filesize($path);
+
+ $filesize = $this->_filesize($path);
$contents = false;
if( $filesize > 0 && $fp = fopen($path, 'rb'))
{
@@ -126,4 +141,4 @@
- }
+ }
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12713] add custom function for filesize,
Sigurd Nes <=