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

Cache dir change leaves old files #580

Closed
clavaque opened this issue Oct 2, 2015 · 6 comments
Closed

Cache dir change leaves old files #580

clavaque opened this issue Oct 2, 2015 · 6 comments
Assignees
Milestone

Comments

@clavaque
Copy link

clavaque commented Oct 2, 2015

Improvement idea:

I just noticed that if I change the cache directory for ZC, the files in the previous one are left there and not removed. I had to remove them via FTP.

I think it's something ZC should notice and clear it automatically as it does when other big changes happen. Or move it so it doesn't have to generate all the files again.

@raamdev
Copy link
Contributor

raamdev commented Oct 2, 2015

@clavaque Thanks for the report! I agree, it makes sense for that to be more intelligent.

@clavaque
Copy link
Author

clavaque commented Oct 3, 2015

👍

@jaswrks
Copy link

jaswrks commented Oct 7, 2015

Next Actions

  • New feature branch: feature/580 in the websharks/zencache-pro repo.

  • Replace this class member with the following:

    $self->updateOptions = function (array $options) use ($self) {
        if (!IS_PRO) { // Do not save lite option keys.
            $options = array_diff_key($options, $self->pro_only_option_keys);
        }
        if (!empty($options['base_dir']) && $options['base_dir'] !== $self->options['base_dir']) {
            $self->tryErasingAllFilesDirsIn($self->wpContentBaseDirTo(''));
        }
        $self->options = array_merge($self->default_options, $self->options, $options);
        $self->options = array_intersect_key($self->options, $self->default_options);
        update_site_option(GLOBAL_NS.'_options', $self->options);
    
        return $self->getOptions();
    };
  • Submit PR.

@jaswrks
Copy link

jaswrks commented Oct 7, 2015

@renzms While working on this issue you can take note of the array $options in the function delcaration above, and learn more about PHP type hinting here: http://www.sitepoint.com/type-hinting-in-php/

@raamdev
Copy link
Contributor

raamdev commented Oct 10, 2015

Next Pro Release Changelog:

  • Enhancement: When the Cache Directory location is changed, ZenCache now cleans up the old Cache Directory and any old cache files instead of leaving them behind. Props @clavaque @renzms. See Issue #580.

@raamdev raamdev closed this as completed Oct 10, 2015
@raamdev
Copy link
Contributor

raamdev commented Nov 14, 2015

ZenCache v151114 has been released and includes changes from this GitHub Issue. See the v151114 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 (#580).

@wpsharks wpsharks locked and limited conversation to collaborators Nov 14, 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