Following the success of my server space script for one of my clients, I thought it would be great to use it under WordPress. This Plugin was inspired by Richard who came to host with me after being on WordPress.com for some years. He really liked to keep track of how much space he has left to upload pictures and I was happy to take on this challenge.
Since I’m using some shell commands to count the files you’re using in your current directory, this Plugin only works on Linux servers – NOT on Windows servers.
For the Pie Chart display to work, your server needs to have GD 2.0.1 or later installed with JPG Support enabled.
It couldn’t be simpler:
- in your WordPress Backend, go to Plugins – Add New
- search for Disk Space Pie and you’ll see it
- hit Install Now and follow the instructions
Alternatively, you can download the Plugin from the WordPress.org and install it manually (via ZIP upload or FTP).
The Plugin can tell you how much space you’re using, but it doesn’t know how much space you’re ALLOWED to use. Hence it can only display the progress bar and pie chart diagramme if you honestly tell it. You should always be honest by the way, even with plugins
To do so, go to Dashboard – Disk Space Pie and type in the amount of web space you’re allowed to use. Say you have 1GB of web space, put in 1 and hit Save Changes. Easy.
If you know your value in MB, you need to divide this value by 1024 to arrive at the equivalent GB value. For example, 100MB divided by 1024 is 0.09765625 – that’s the value to use in the box. You get the drift.
If you enter a number smaller than the amount of space you’re using, you’ll see something like 105% space free – which obviously isn’t what you want. So don’t do that.
In order to determine your used disk space “live” and at all times, the server physically counts every file in all your directories every time the Dahsboard or admin screen is called. On larger installations or slow servers this can take some time so you may notice a slight delay upon loading the page. This is normal yet annoying.
To minimise this issue, just close the dahsboard window using the little arrow in the top right corner. Alternatively, click on Screen Options and disable the widget by unticking the box.
Roadmap and Future Ideas
I’d like to incorporate the usage of database space in future versions. Maybe have an option that lets you display values in GB or MB. I’m also working on a branch of this plugin for my hosting clients, who will be able to sign up for extra space right from the backend. Done since Version 0.2
There’s a lot that a hosting company could present to the customer from within WordPress – however this won’t be useful to the general public. Maybe it could become something like Hosting Integration – just thinking out loud here.
I’d also like to add translation to this plugin.
Version 0.4 – 06/07/2011
- Fixed dashboard widget display in WordPress 3.2 (Thanks Dan!)
- Replaced hard coded links with dynamic ones
- Updated Folder Structure in accordance with WordPress Best Coding Standards
- Added default unit value for first-time-user (now defaults to GB rather than nothing)
- Changed Donation Link (Buy me a Coffee)
Version 0.3 – sometime in April 2011
- added Unlimited Space option
- certified WordPress 3.1 compatibility
Version 0.2 – 07/01/2011
- Added a drop-down menu so you an easily choose if you’d like things displayed in MB or GB
- Added Database Size Count courtesy of Chris Rabiet’s WP Database Plugin
- Added numeric display of space underneath pie charts – like in the dashboard widget
Version 0.1 – 31/12/2010
Driven by Richard’s suggestion, I’ve used Alex Rabe’s WP Memory Usage Plugin as template and several WordPress tutorials on how to build plugins. Within a few hours, the basis was established. Then I integrated Rasmus Peter’s Pie Chart Script and made it all work together. Code Cleanup followed: renaming functions, hooks, variables, deleting code that’s not needed.
Enjoy this Plugin responsibly