issue #2194 change data organization

This commit is contained in:
plegall 2024-07-30 23:05:03 +02:00
parent db08d32d6f
commit e5e84e07e6

View file

@ -2486,9 +2486,9 @@ function send_piwigo_infos()
$piwigo_infos['general_stats']['disk_usage'] = intval($piwigo_infos['general_stats']['disk_usage'] / 1024); $piwigo_infos['general_stats']['disk_usage'] = intval($piwigo_infos['general_stats']['disk_usage'] / 1024);
$piwigo_infos['general_stats']['installed_on'] = get_installation_date(); $piwigo_infos['general_stats']['installed_on'] = get_installation_date();
$piwigo_infos['general_stats']['nb_photos_synced'] = 0;
$piwigo_infos['general_stats']['last_photo_synced'] = null;
$piwigo_infos['files'] = array(); $piwigo_infos['general_stats']['last_photo'] = null;
if ($piwigo_infos['general_stats']['nb_photos'] > 0) if ($piwigo_infos['general_stats']['nb_photos'] > 0)
{ {
@ -2509,7 +2509,17 @@ SELECT
FROM `'.IMAGES_TABLE.'` FROM `'.IMAGES_TABLE.'`
GROUP BY add_method GROUP BY add_method
;'; ;';
$piwigo_infos['files']['added_by'] = query2array($query, 'add_method'); $files_added_by = query2array($query, 'add_method');
$piwigo_infos['general_stats']['nb_photos_synced'] = $files_added_by['sync']['nb_files'];
$piwigo_infos['general_stats']['last_photo_synced'] = $files_added_by['sync']['last_added_on'];
$method_of_last_photo = 'sync';
if (isset($files_added_by['api']) and strtotime($files_added_by['api']['last_added_on']) > strtotime($files_added_by['sync']['last_added_on']))
{
$method_of_last_photo = 'api';
}
$piwigo_infos['general_stats']['last_photo'] = $files_added_by[$method_of_last_photo]['last_added_on'];
} }
else else
{ {
@ -2522,13 +2532,10 @@ SELECT
LIMIT 1 LIMIT 1
;'; ;';
$images = query2array($query); $images = query2array($query);
if (count($images) > 0)
$piwigo_infos['files']['added_by'] = array( {
'api' => array( $piwigo_infos['general_stats']['last_photo'] = $images[0]['date_available'];
'nb_files' => $piwigo_infos['general_stats']['nb_photos'], }
'last_added_on' => count($images) > 0 ? $images[0]['date_available'] : null,
)
);
} }
$query = ' $query = '
@ -2539,7 +2546,7 @@ SELECT
FROM `'.IMAGES_TABLE.'` FROM `'.IMAGES_TABLE.'`
GROUP BY ext GROUP BY ext
;'; ;';
$piwigo_infos['files']['extensions'] = query2array($query, 'ext'); $piwigo_infos['file_extensions'] = query2array($query, 'ext');
} }
// $conf['pem_plugins_category'] = 12; // $conf['pem_plugins_category'] = 12;