mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-05-08 14:25:02 +02:00
fixes #1317 remove cache directory size calculation
This commit is contained in:
@@ -625,32 +625,6 @@ function get_fs_directories($path, $recursive = true)
|
|||||||
return $dirs;
|
return $dirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the size (in bytes) of a filesystem directory
|
|
||||||
*
|
|
||||||
* @since 11
|
|
||||||
* @param string path
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function get_fs_directory_size($path)
|
|
||||||
{
|
|
||||||
$bytestotal = 0;
|
|
||||||
$path = realpath($path);
|
|
||||||
|
|
||||||
if (!function_exists('exec'))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@exec('du -sk '.$path, $returnarray);
|
|
||||||
if (is_array($returnarray) and !empty($returnarray[0]) and preg_match('/^(\d+)\s/', $returnarray[0], $matches))
|
|
||||||
{
|
|
||||||
$bytestotal = $matches[1] * 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $bytestotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* save the rank depending on given categories order
|
* save the rank depending on given categories order
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -409,24 +409,6 @@ if (isset($result[0]['SUM(filesize)']))
|
|||||||
$data_storage['Formats'] = $result[0]['SUM(filesize)'];
|
$data_storage['Formats'] = $result[0]['SUM(filesize)'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows can't execute get_fs_directory_size correctly
|
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
|
|
||||||
{
|
|
||||||
if (!isset($_SESSION['cachedir_info']) or $_SESSION['cachedir_info']['calculated_on'] < strtotime('5 minutes ago'))
|
|
||||||
{
|
|
||||||
$start_time = get_moment();
|
|
||||||
|
|
||||||
$_SESSION['cachedir_info'] = array(
|
|
||||||
'size' => get_fs_directory_size($conf['data_location']),
|
|
||||||
'calculated_on' => time(),
|
|
||||||
);
|
|
||||||
|
|
||||||
$logger->debug('[admin/intro::'.__LINE__.'] cache size calculated in '.get_elapsed_time($start_time, get_moment()).' ('.$_SESSION['cachedir_info']['size'].' bytes)');
|
|
||||||
}
|
|
||||||
|
|
||||||
$data_storage['Cache'] = $_SESSION['cachedir_info']['size'] / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Calculate total storage
|
//Calculate total storage
|
||||||
$total_storage = 0;
|
$total_storage = 0;
|
||||||
foreach ($data_storage as $value)
|
foreach ($data_storage as $value)
|
||||||
|
|||||||
Reference in New Issue
Block a user