Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Total Cache Size on Disk Statistics #83

Closed
jaswrks opened this issue Apr 4, 2014 · 9 comments
Closed

Feature Request: Total Cache Size on Disk Statistics #83

jaswrks opened this issue Apr 4, 2014 · 9 comments

Comments

@jaswrks
Copy link

jaswrks commented Apr 4, 2014

I'd like to see a graphical disk usage meter in the Dashboard (perhaps even in the admin bar too)... which shows the current total disk space consumed by Quick Cache at the present time. Or, if that's not feasible (i.e. too resource intensive) it could be updated every X minutes or so.

I think it should be a pro feature myself.

@raamdev
Copy link
Contributor

raamdev commented Apr 4, 2014

Great idea! I'll accept this and add it to my list. Thanks!

@ethanpil
Copy link

ethanpil commented May 7, 2014

+1

@raamdev raamdev added this to the Future Release milestone May 7, 2014
@raamdev
Copy link
Contributor

raamdev commented May 7, 2014

Adding this to the Future Release milestone to work on next, after the Next Release.

@jaswrks
Copy link
Author

jaswrks commented Jun 17, 2014

Two helpful methods from the WSC that might help when it comes time to implement this.

/**
 * Abbreviated byte notation for file sizes.
 *
 * @param float   $bytes File size in bytes. A (float) value.
 *    We need this converted to a (float), so it's possible to deal with numbers beyond that of an integer.
 *
 * @param integer $precision Number of decimals to use.
 *
 * @return string Byte notation.
 */
public function bytes_abbr($bytes, $precision = 2)
{
    $bytes = (float)$bytes;
    $precision = (integer)$precision;

    $precision = ($precision >= 0) ? $precision : 2;
    $units     = array('bytes', 'kbs', 'MB', 'GB', 'TB');

    $bytes = ($bytes > 0) ? $bytes : 0;
    $power = floor(($bytes ? log($bytes) : 0) / log(1024));

    $abbr_bytes = round($bytes / pow(1024, $power), $precision);
    $abbr       = $units[min($power, count($units) - 1)];

    if($abbr_bytes === (float)1 && $abbr === 'bytes')
        $abbr = 'byte'; // Quick fix here.

    else if($abbr_bytes === (float)1 && $abbr === 'kbs')
        $abbr = 'kb'; // Quick fix here.

    return $abbr_bytes.' '.$abbr;
}

/**
 * Converts an abbreviated byte notation into bytes.
 *
 * @param string $string A string value in byte notation.
 *
 * @return float A float indicating the number of bytes.
 */
public function abbr_bytes($string)
{
    $string = (string)$string;

    $notation = '/^(?P<value>[0-9\.]+)\s*(?P<modifier>bytes|byte|kbs|kb|k|mb|m|gb|g|tb|t)$/i';

    if(!preg_match($notation, $string, $_op))
        return (float)0;

    $value    = (float)$_op['value'];
    $modifier = strtolower($_op['modifier']);
    unset($_op); // Housekeeping.

    switch($modifier) // Fall through based on modifier.
    {
        case 't': // Multiplied four times.
        case 'tb':
            $value *= 1024;
        case 'g': // Multiplied three times.
        case 'gb':
            $value *= 1024;
        case 'm': // Multiple two times.
        case 'mb':
            $value *= 1024;
        case 'k': // One time only.
        case 'kb':
        case 'kbs':
            $value *= 1024;
    }
    return (float)$value;
}

@jaswrks
Copy link
Author

jaswrks commented Jun 17, 2014

Related discussion here that might offer some ideas.
http://www.php.net//manual/en/function.disk-total-space.php

@raamdev
Copy link
Contributor

raamdev commented Jun 18, 2014

Punting this to the Future Release milestone.

@raamdev raamdev modified the milestones: Future Release, Next Release Jun 18, 2014
@raamdev raamdev modified the milestones: Next Release, Future Release Aug 4, 2014
@ioerjfoige0439i
Copy link

Don't forget to put an option to completely disable this for customers who don't want this feature in use in order to save on resource usage.

@raamdev raamdev removed this from the Next Release milestone Sep 9, 2014
@raamdev raamdev changed the title Feature Request (Disk Usage) Feature Request: Total Cache Size on Disk Statistics Oct 4, 2014
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 7, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 11, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 11, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 17, 2015
- Enhancing DirStats class.
- Improving organization of SCSS files.
- Improving cache directory utilities; integrating DirStats where applicable.
- Implementing Admin Bar Directory Stats.
- Improving AJAX clear/wipe cache interaction.
- Creating `cleanupCache()` method to give the CRON cleanup a method of its own.
- Improving PostloadUtils, excluding all plugin actions from automatic user cache clearing. This was already the case (for the most), but this change allows us to pick up ALL plugin actions.
- Build `zc-` prefixed files using `SHORT_NAME` for easier branding.
- Removing FontAwesome dependency in favor of Sharkicons.
- Updating to the latest release of Sharkicons and integrating this w/ ZenCache.
- Adding `wurgeCache()` and `autoWurgeCache()` for global cache purging.

See: wpsharks/comet-cache#83 and wpsharks/comet-cache#127
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 18, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 18, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 18, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Aug 19, 2015
@raamdev raamdev added this to the Next Release (Pro) milestone Sep 18, 2015
@raamdev
Copy link
Contributor

raamdev commented Sep 18, 2015

Next Pro Release Changelog:

  • New Feature! Cache Statistics is a completely new ZenCache Pro feature that will help site owners better understand their WordPress site cache. An easy-to-access Cache Stats menu button in the Admin Bar is accompanied by a whole new page that shows Current Cache Totals (including total number of cache files and total size of cache on the disk), Current Disk Health (including total disk capacity and total available), Current System Health (including memory usage and load average), and two beautiful Polar Area pie charts that show you both current and historical data on Cache File Counts and Cache File Sizes with a 30-Day High, Current Total, Page Cache total, and HTML Compressor total for each chart. Props to @jaswsinc. See Issue #83.

@raamdev raamdev closed this as completed Sep 18, 2015
@raamdev
Copy link
Contributor

raamdev commented Oct 2, 2015

ZenCache Pro v151002 has been released and includes changes from this GitHub Issue.

See the v151002 release announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#83).

@wpsharks wpsharks locked and limited conversation to collaborators Oct 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants