From 71944676be76169b3a6c18f9942aaaf346d23ef1 Mon Sep 17 00:00:00 2001 From: Jerome Jutteau Date: Thu, 12 Sep 2019 12:02:40 +0200 Subject: [PATCH] [FEATURE] change folder sub-division in var WARNING: breaking change. Folders in Jirafeau are originally split with 1 char. e.g: a/3/b/c/6/f/1... This is now set to 4 chars for better lisibility. Older Jirafeau installation can put back to 1 char by editing this file. This could eventually be a configuration item. Signed-off-by: Jerome Jutteau --- lib/functions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/functions.php b/lib/functions.php index 2817aa1..df207da 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -25,9 +25,16 @@ */ function s2p($s) { + $block_size = 8; $p = ''; for ($i = 0; $i < strlen($s); $i++) { - $p .= $s{$i} . '/'; + $p .= $s{$i}; + if (($i + 1) % $block_size == 0) { + $p .= '/'; + } + } + if (strlen($s) % $block_size != 0) { + $p .= '/'; } return $p; } -- 2.34.1