[pmwiki-users] Display size of uploads directory in wiki?
Petko Yotov
5ko at 5ko.fr
Thu Dec 8 10:59:42 PST 2022
This in config.php:
function MXUploadDirSize($dir="") {
global $UploadDir;
$dir = $UploadDir . '/'. preg_replace('!\\.+/+!', '', strval($dir));
return dirsize($dir);
}
$MarkupExpr['uploadsize'] = 'MXUploadDirSize(@$args[0])';
# Human-readable numbers with suffix like 1.2G, 221.6M
$MarkupExpr['human'] = 'FileSizeCompact(0+@$args[0])';
Then in a wiki page:
* {(uploadsize)}
* {(uploadsize Main)}
* {(human (uploadsize))}
* {(human (uploadsize Main))}
Possibly in Site.UploadQuiclReference:
* {(human (uploadsize {*$Group}))}
In a pagelist template:
(:pagelist list=grouphomes fmt=#usize:)
[[#usize]]
* {=$Group}: {(human (uploadsize {=$Group}))}
[[#usizeend]]
I'll write a Cookbook recipe shortly.
Petko
--
If you upgrade : https://www.pmwiki.org/Upgrades
On 08/12/2022 16:00, Johan Bengtsson wrote:
> Hi,
>
> Is it possible to display the size of the uploads directory
> in the wiki?
>
> Best regards,
> Johan Bengtsson
>
> ----
> Systemadministratör - Chalmers IT-avdelning
> Tel: 6734 https://www.chalmers.se/it
More information about the pmwiki-users
mailing list