From: Jerome Jutteau Date: Thu, 12 Sep 2019 10:02:40 +0000 (+0200) Subject: [FEATURE] change folder sub-division in var X-Git-Tag: 4.0.0~18 X-Git-Url: https://git.p6c8.net/jirafeau_project.git/commitdiff_plain/71944676be76169b3a6c18f9942aaaf346d23ef1 [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 --- 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; }