@@ -378,7 +378,7 @@ public function switchAction($action, $httpVars, $fileVars)
378
378
$ tmpFNAME = $ this ->urlBase .$ dir ."/ " .str_replace (".zip " , ".tmp " , $ localName );
379
379
copy ($ file , $ tmpFNAME );
380
380
try {
381
- AJXP_Controller::applyHook ("node.before_create " , array (new AJXP_Node ($ tmpFNAME ), filesize ($ tmpFNAME )));
381
+ AJXP_Controller::applyHook ("node.before_create " , array (new AJXP_Node ($ tmpFNAME ), $ this -> filesystemFileSize ($ tmpFNAME )));
382
382
} catch (Exception $ e ) {
383
383
@unlink ($ tmpFNAME );
384
384
throw $ e ;
@@ -397,6 +397,7 @@ public function switchAction($action, $httpVars, $fileVars)
397
397
header ("Content-type:application/json " );
398
398
if ($ selection ->isUnique ()){
399
399
$ stat = @stat ($ this ->urlBase .$ selection ->getUniqueFile ());
400
+ $ this ->filesystemFileSize (null , $ stat );
400
401
if (!$ stat ) {
401
402
print '{} ' ;
402
403
} else {
@@ -407,6 +408,7 @@ public function switchAction($action, $httpVars, $fileVars)
407
408
print '{ ' ;
408
409
foreach ($ files as $ index => $ path ){
409
410
$ stat = @stat ($ this ->urlBase .$ path );
411
+ $ this ->filesystemFileSize (null , $ stat );
410
412
if (!$ stat ) $ stat = '{} ' ;
411
413
else $ stat = json_encode ($ stat );
412
414
print json_encode ($ path ).': ' .$ stat . (($ index < count ($ files ) -1 ) ? ", " : "" );
@@ -1548,10 +1550,14 @@ public function date_modif($file)
1548
1550
return $ tmp ;// date("d,m L Y H:i:s",$tmp);
1549
1551
}
1550
1552
1551
- public function filesystemFileSize ($ filePath )
1553
+ public function filesystemFileSize ($ filePath, & $ stat = null )
1552
1554
{
1553
1555
$ bytesize = "- " ;
1554
- $ bytesize = @filesize ($ filePath );
1556
+ if ($ stat != null && is_array ($ stat )){
1557
+ $ bytesize = $ stat [7 ];
1558
+ }else {
1559
+ $ bytesize = @filesize ($ filePath );
1560
+ }
1555
1561
if (method_exists ($ this ->wrapperClassName , "getLastRealSize " )) {
1556
1562
$ last = call_user_func (array ($ this ->wrapperClassName , "getLastRealSize " ));
1557
1563
if ($ last !== false ) {
@@ -1561,7 +1567,9 @@ public function filesystemFileSize($filePath)
1561
1567
if ($ bytesize < 0 ) {
1562
1568
$ bytesize = sprintf ("%u " , $ bytesize );
1563
1569
}
1564
-
1570
+ if ($ stat != null && is_array ($ stat )){
1571
+ $ stat ["size " ] = $ stat [7 ] = $ bytesize ;
1572
+ }
1565
1573
return $ bytesize ;
1566
1574
}
1567
1575
0 commit comments