diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-02-22 16:43:11 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-02-22 16:43:11 +0100 |
commit | d8137fdf66a513d0de4bb234d0427ff27ca40106 (patch) | |
tree | d02f9782f8e7e77670f03469847b3044e1172f53 /lib/helper.php | |
parent | 5b949596867c986916568e5bea2003e04102aa71 (diff) | |
download | nextcloud-server-d8137fdf66a513d0de4bb234d0427ff27ca40106.tar.gz nextcloud-server-d8137fdf66a513d0de4bb234d0427ff27ca40106.zip |
return both, count and result if the operation succeeded or failed. Maybe in some cases it is useful to know how much bytes where copied
Diffstat (limited to 'lib/helper.php')
-rw-r--r-- | lib/helper.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/helper.php b/lib/helper.php index 2c9cd36b199..7420a79eb2d 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -513,13 +513,16 @@ class OC_Helper { if(!$source or !$target) { return false; } - $result=true; + $result = true; + $count = 0; while(!feof($source)) { - if (fwrite($target, fread($source, 8192)) === false) { + if ($c = fwrite($target, fread($source, 8192)) === false) { $result = false; + } else { + $count += $c; } } - return $result; + return array($count, $result); } /** |