From: Jerome Jutteau Date: Tue, 7 Apr 2020 20:45:39 +0000 (+0200) Subject: [FEATURE] Compute data folder in admin pannel X-Git-Tag: 4.2.0~63 X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/commitdiff_plain/2b4714c704f8ca5567c85a26e9202d5c9b3550e4 [FEATURE] Compute data folder in admin pannel Few fix added after original LucTech's MR https://gitlab.com/mojo42/Jirafeau/-/merge_requests/70 Signed-off-by: Jerome Jutteau --- diff --git a/admin.php b/admin.php index 44a0134..54fcde1 100644 --- a/admin.php +++ b/admin.php @@ -160,6 +160,19 @@ if (php_sapi_name() == "cli") { +
+ + + + + + + + + + + +
@@ -228,6 +241,12 @@ if (php_sapi_name() == "cli") { echo '

'; echo t('CLEANED_FILES_CNT') . ' : ' . $total; echo '

'; + } elseif (strcmp($_POST['action'], 'size') == 0) { + $size = jirafeau_dir_size($cfg['var_root']); + $human_size = jirafeau_human_size($size); + echo '
' . NL; + echo '

' . t('SIZE_DATA') . ': ' . $human_size .'

'; + echo '
'; } elseif (strcmp($_POST['action'], 'list') == 0) { jirafeau_admin_list("", "", ""); } elseif (strcmp($_POST['action'], 'search_by_name') == 0) { diff --git a/lib/functions.php b/lib/functions.php index 058d53e..84f2a44 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1344,3 +1344,12 @@ function jirafeau_admin_csrf_field() { return ""; } + +function jirafeau_dir_size($dir) +{ + $size = 0; + foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $entry) { + $size += is_file($entry) ? filesize($entry) : jirafeau_dir_size($entry); + } + return $size; +} diff --git a/lib/locales/ar.json b/lib/locales/ar.json index d8a3299..147b534 100644 --- a/lib/locales/ar.json +++ b/lib/locales/ar.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "قد لا يدعم متصفحك HTML5، لذا فإن الحد الأقصى لحجم الملف هو ", "PLURAL_ENDING": "", diff --git a/lib/locales/be.json b/lib/locales/be.json index a8716b5..3c4d25d 100644 --- a/lib/locales/be.json +++ b/lib/locales/be.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Ваш браўзер не падтрымлівае HTML5, таму максімальны памер файла ", "PLURAL_ENDING": "", diff --git a/lib/locales/bn_IN.json b/lib/locales/bn_IN.json index 31a2e09..115c34f 100644 --- a/lib/locales/bn_IN.json +++ b/lib/locales/bn_IN.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "আপনার ব্রাউজার HTML5 সমর্থন নাও করতে পারে, তাই সর্বোচ্চ ফাইলের আকার ", "PLURAL_ENDING": "", diff --git a/lib/locales/bo.json b/lib/locales/bo.json index 187976f..e1079f8 100644 --- a/lib/locales/bo.json +++ b/lib/locales/bo.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/ca.json b/lib/locales/ca.json index b3f9f83..0d50c1a 100644 --- a/lib/locales/ca.json +++ b/lib/locales/ca.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "El teu navegador no és compatible amb HTML5, per tant, la mida màxima del fitxers és ", "PLURAL_ENDING": "s", diff --git a/lib/locales/cs.json b/lib/locales/cs.json index bed93db..dd47a55 100644 --- a/lib/locales/cs.json +++ b/lib/locales/cs.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Váš prohlížeč nepodporuje HTML5, proto je maximílní velikost souboru ", "PLURAL_ENDING": "", diff --git a/lib/locales/da.json b/lib/locales/da.json index 6338a09..d355e5b 100644 --- a/lib/locales/da.json +++ b/lib/locales/da.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/de.json b/lib/locales/de.json index b232f84..df6d893 100644 --- a/lib/locales/de.json +++ b/lib/locales/de.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Ihr Browser unterstützt möglicherweise kein HTML5, demnach beträgt die maximale Dateigröße ", "PLURAL_ENDING": "n", diff --git a/lib/locales/el.json b/lib/locales/el.json index 8801a1b..5ba9999 100644 --- a/lib/locales/el.json +++ b/lib/locales/el.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/en.json b/lib/locales/en.json index 845743a..412f377 100644 --- a/lib/locales/en.json +++ b/lib/locales/en.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "Data size", "INCOMPATIBLE_OPTIONS_W": "The following configuration options are incompatible:", "NO_BROWSER_SUPPORT": "Your browser may not support HTML5, so the maximum file size is ", "PLURAL_ENDING": "s", diff --git a/lib/locales/es.json b/lib/locales/es.json index 5c0eb21..1a3bab0 100644 --- a/lib/locales/es.json +++ b/lib/locales/es.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Tu navegador puede no soportar HTML5, debido a esto el tamaño máximo de archivo es ", "PLURAL_ENDING": "", diff --git a/lib/locales/et.json b/lib/locales/et.json index 6a37463..ae3cd57 100644 --- a/lib/locales/et.json +++ b/lib/locales/et.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/fi.json b/lib/locales/fi.json index 1fa64f5..3a32681 100644 --- a/lib/locales/fi.json +++ b/lib/locales/fi.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/fr.json b/lib/locales/fr.json index aa4d3d3..72930f2 100644 --- a/lib/locales/fr.json +++ b/lib/locales/fr.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "Volume de données", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Votre navigateur ne supporte apparemment pas HTML5, la taille maximale de fichier téléchargable est de ", "PLURAL_ENDING": "s", diff --git a/lib/locales/he.json b/lib/locales/he.json index 6e0a569..4cc0fb0 100644 --- a/lib/locales/he.json +++ b/lib/locales/he.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/hi.json b/lib/locales/hi.json index 172250c..92f0276 100644 --- a/lib/locales/hi.json +++ b/lib/locales/hi.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/hr.json b/lib/locales/hr.json index b4515eb..57b7e4e 100644 --- a/lib/locales/hr.json +++ b/lib/locales/hr.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/hu.json b/lib/locales/hu.json index 9ff524c..8b2505a 100644 --- a/lib/locales/hu.json +++ b/lib/locales/hu.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/id.json b/lib/locales/id.json index 187976f..e1079f8 100644 --- a/lib/locales/id.json +++ b/lib/locales/id.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/it.json b/lib/locales/it.json index b9e0a0c..0ab9b6c 100644 --- a/lib/locales/it.json +++ b/lib/locales/it.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Il tuo browser potrebbe non supportare HTML5, quindi la dimensione massima del file è ", "PLURAL_ENDING": "", diff --git a/lib/locales/ja.json b/lib/locales/ja.json index ba12063..f7c6f95 100644 --- a/lib/locales/ja.json +++ b/lib/locales/ja.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/ko.json b/lib/locales/ko.json index 172250c..92f0276 100644 --- a/lib/locales/ko.json +++ b/lib/locales/ko.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/ku.json b/lib/locales/ku.json index 6a37463..ae3cd57 100644 --- a/lib/locales/ku.json +++ b/lib/locales/ku.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/la.json b/lib/locales/la.json index 753919b..e29fba6 100644 --- a/lib/locales/la.json +++ b/lib/locales/la.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/mfe.json b/lib/locales/mfe.json index 6a37463..ae3cd57 100644 --- a/lib/locales/mfe.json +++ b/lib/locales/mfe.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/ms.json b/lib/locales/ms.json index 187976f..e1079f8 100644 --- a/lib/locales/ms.json +++ b/lib/locales/ms.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/nb_NO.json b/lib/locales/nb_NO.json index 2d73630..11435f2 100644 --- a/lib/locales/nb_NO.json +++ b/lib/locales/nb_NO.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Det kan hende at nettleseren din ikke støtter HTML5, så største tillatte filstørrelse er ", "PLURAL_ENDING": "er", diff --git a/lib/locales/nl.json b/lib/locales/nl.json index 61dc97a..1b3af7c 100644 --- a/lib/locales/nl.json +++ b/lib/locales/nl.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/pl.json b/lib/locales/pl.json index b13d75e..f7fc42b 100644 --- a/lib/locales/pl.json +++ b/lib/locales/pl.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/ps.json b/lib/locales/ps.json index 6a37463..ae3cd57 100644 --- a/lib/locales/ps.json +++ b/lib/locales/ps.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/pt.json b/lib/locales/pt.json index 05bf78e..3c2aa97 100644 --- a/lib/locales/pt.json +++ b/lib/locales/pt.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "NO_BROWSER_SUPPORT": "O seu navegador pode não suportar HTML5, então o tamanho máximo do ficheiro é ", "INCOMPATIBLE_OPTIONS_W": "", "PLURAL_ENDING": "s", diff --git a/lib/locales/pt_BR.json b/lib/locales/pt_BR.json index 935e8aa..a3660d8 100644 --- a/lib/locales/pt_BR.json +++ b/lib/locales/pt_BR.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Seu navegador pode não suportar HTML5, portanto, o tamanho máximo do arquivo é ", "PLURAL_ENDING": "s", diff --git a/lib/locales/ro.json b/lib/locales/ro.json index 3a4922c..128cb00 100644 --- a/lib/locales/ro.json +++ b/lib/locales/ro.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/ru.json b/lib/locales/ru.json index d8881b4..cb79ca8 100644 --- a/lib/locales/ru.json +++ b/lib/locales/ru.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/sh.json b/lib/locales/sh.json index 6a37463..ae3cd57 100644 --- a/lib/locales/sh.json +++ b/lib/locales/sh.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/sk.json b/lib/locales/sk.json index 971da4f..ff84998 100644 --- a/lib/locales/sk.json +++ b/lib/locales/sk.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Zdá sa, že Váš prehliadač nepodporuje HTML5. Maximálna veľkosť súboru je preto obmedzená na ", "PLURAL_ENDING": "", diff --git a/lib/locales/sl.json b/lib/locales/sl.json index 6a37463..ae3cd57 100644 --- a/lib/locales/sl.json +++ b/lib/locales/sl.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/sq.json b/lib/locales/sq.json index 6a37463..ae3cd57 100644 --- a/lib/locales/sq.json +++ b/lib/locales/sq.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/sr.json b/lib/locales/sr.json index 3bc925a..2db7e30 100644 --- a/lib/locales/sr.json +++ b/lib/locales/sr.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/sv.json b/lib/locales/sv.json index a93481b..67b143e 100644 --- a/lib/locales/sv.json +++ b/lib/locales/sv.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "Följande inställningar är inkompatibla:", "NO_BROWSER_SUPPORT": "Din webbläsare verkar inte stödja HTML5, så max filstorlek är ", "PLURAL_ENDING": "er", diff --git a/lib/locales/ta.json b/lib/locales/ta.json index 6a37463..ae3cd57 100644 --- a/lib/locales/ta.json +++ b/lib/locales/ta.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/template.json b/lib/locales/template.json index a2b8432..c8fedae 100644 --- a/lib/locales/template.json +++ b/lib/locales/template.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/th.json b/lib/locales/th.json index 6a37463..ae3cd57 100644 --- a/lib/locales/th.json +++ b/lib/locales/th.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/tr.json b/lib/locales/tr.json index c5e394a..26d91d5 100644 --- a/lib/locales/tr.json +++ b/lib/locales/tr.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "Tarayıcınız HTML5'i desteklemeyebilir, bu nedenle en fazla dosya boyutu ", "PLURAL_ENDING": "sn", diff --git a/lib/locales/uk.json b/lib/locales/uk.json index dc3bdbc..f3bc80a 100644 --- a/lib/locales/uk.json +++ b/lib/locales/uk.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "NO_BROWSER_SUPPORT": "Ваш веб-переглядач може не підтримує HTML5, тому найбільший розмір файлу - це ", "PLURAL_ENDING": "(-ів)", "JI_WEB_RE": "Jirafeau — ваше мережеве сховище файлів", diff --git a/lib/locales/vi.json b/lib/locales/vi.json index ba12063..f7c6f95 100644 --- a/lib/locales/vi.json +++ b/lib/locales/vi.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "", "PLURAL_ENDING": "", diff --git a/lib/locales/zh.json b/lib/locales/zh.json index a039407..d1f8f03 100644 --- a/lib/locales/zh.json +++ b/lib/locales/zh.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "您的浏览器可能不支持 HTML5,因此文件最大为 ", "PLURAL_ENDING": "s", diff --git a/lib/locales/zh_TW.json b/lib/locales/zh_TW.json index a322bd1..7445c76 100644 --- a/lib/locales/zh_TW.json +++ b/lib/locales/zh_TW.json @@ -1,4 +1,5 @@ { + "SIZE_DATA": "", "INCOMPATIBLE_OPTIONS_W": "", "NO_BROWSER_SUPPORT": "您的瀏覽器可能不支持 HTML5,因此文件最大為 ", "PLURAL_ENDING": "s",