Added Feature to Display Disk Space Usage
Changes:
- Added disk space calculation logic to the
index.phpfile. - Updated the file listing footer to include total, used, and remaining disk space information.
- Utilized
disk_total_space,disk_free_space, andfm_get_filesizefunctions to obtain and format disk space information. - Introduced a new checkbox under the settings section (
js-show-usage) to allow users to toggle the display of disk space usage. - Implemented a check for the
show_disk_usagesetting before executing disk space calculation and display logic. - Ensured that the feature works seamlessly with existing functionalities and adheres to the project's coding standards.
Benefits:
- Users with multiple mounted drives on their servers can easily see how much disk space is available, used, and remaining on each drive, facilitating better disk space management.
- The toggle setting provides flexibility to users to display or hide disk space information based on their preferences or needs.
- Enhances user experience by providing valuable disk space information, aiding in capacity planning and preventing potential issues related to disk space exhaustion.
- Helps in monitoring disk space usage directly from the file manager without needing to use external tools or commands.
Use Case:
- As someone managing a server with multiple mounted drives, this feature is invaluable for monitoring the disk space usage on each drive. It helps in ensuring that none of the drives are nearing capacity, which could lead to performance degradation or even system failures. Having this information readily available within Tiny File Manager streamlines the process of managing disk space and ensures that I can take timely action if needed, such as cleaning up old files or moving data to other drives with more available space.
Screenshots:
Example with Mounted disk:
I believe this feature, along with the toggle setting, would be a valuable addition to Tiny File Manager, helping users better manage their disk space on servers with multiple drives. I have tested the changes on my local setup to ensure accuracy and compatibility. Looking forward to the feedback and am happy to make any necessary adjustments.
Thank you for considering this contribution.
Congratulations
This PR reminds me of PR https://github.com/prasathmani/tinyfilemanager/pull/911, albeit this one is more elegant and complete, but I never really understood why the latter wasn't merged back then. I did end up implementing it in my custom version though since I think it's undeniable that it adds to the script without taking anything away.
Thank you for referencing PR #911. My PR aims to provide a detailed view of disk usage for systems with multiple mounted drives. Unlike #911, which shows disk space for the root directory, this enhancement displays the disk space for each mounted drive, including external ones. This is particularly useful when drives are mounted as folders, ensuring users can monitor the disk space of these specific directories(drives) accurately. I've attached images from both PRs for clarity, showing the functionality in both the root directory and an external drive context.
Thanks for clarifying this, I wasn't fully aware of the extension of your implementation (although I admittedly hadn't read your entire description yet). I hope this gets merged soon, but even if it doesn't I'll look into integrating it within my custom script anyway.
will this be merged? it looks good