Giter Club home page Giter Club logo

cachemaster's People

Contributors

bobray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cachemaster's Issues

pub_date and unpub_date handling

Hello,
Tried to implement the auto-unpublish with CacheMaster enabled, but unfortunately it does not work as expected :(
Here is my bug report and my local corrections.

Related commits for reference:
9c45274
0ea93d8

  1. When $modx->cacheManager->refresh(...) is called on OnBeforeDocFormSave event, MODX takes the values of pub_date and unpub_date from the database, not from event's $resource object.
    Since we are in OnBeforeDocFormSave handler, the new values (pub or unpub) are not yet saved to the database.
    Therefore, $modx->cacheManager->refresh will update the auto_publish.cache.php not for current resource, but for other resources with non-zero pub_date and unpub_date values.
    If the submitted (but not saved yet) resource is the only with the unpub_date, the auto_publish.cache.php will not be updated.

  2. With the current approach, the auto_publish.cache.php not updating when the user unset either pub_date or unpub_date, which was previously set. Inside OnBeforeDocFormSave unset values are empty and the condition is not satisfied.

My solution:

  • bind CacheMaster to OnDocFormSave event.
  • relocate $modx->cacheManager->refresh(...) without surrounding condition from OnBeforeFormSave to the first switch($event):
/* Bail out if we're not doing this object */
switch($event) {
    case 'OnDocFormSave':
        if (!$doResources) {
            return;
        }
        
        $ctx = $resource->get('context_key');
        
        // If pub_date or unpub_date are set, update the auto_publish cache 
        // if ($resource->get('pub_date') || $resource->get('unpub_date')) {
        $providers = array(
            'auto_publish' => array('contexts' => $ctx),
        );
        $providers_result = array();
        $modx->cacheManager->refresh($providers, $providers_result); // Cache refreshes from database
            
        if ($doDebug) {
            my_debug($providers_result);
        }
            
        //}
        return;        
        
        break;
    case 'OnDocFormPrerender':
    case 'OnBeforeDocFormSave':
        if (!$doResources) {
            return;
        }
        break;


Feature request: Clear parents on doc save and per context

Hi BobRay,

1: I think it would be nice to have an option to clear the cache of all parents on saving a child document up to the highest parent under the root/context.

For example: When I change/add a child resource to an overview/catelog then I now also have to save the overview/catelog resource to clear it's cache so that the changes will be visible on the frontend.

2: And would be clearing only the cache of the current context also be a nice feature?
My previous forum topic http://forums.modx.com/thread/96097/empty-cache-per-context-on-resource-save?page=2#dis-post-529055 (sorry BobRay, I haven't had time to test your snippet).

Kind regards,

Marten

CacheMaster won't install

I'm trying to put cachemaster on a production server, and it won't 'install'. It downloads correctly, extracts correctly, I've confirmed and explicitly set modx-core/components/ to 777 just in case that matters, though it shouldn't.

When I click on on the 'install' nothing happens. I can view the 'about', check for updates, all that, but it simply won't install.

I successfully installed the plugin on my dev server, which tends to have looser permissions than the live server, so I suspect some directory has to have some permissions, but I can't find which it is. Obviously if a directly needs to be writeable for installation that should be checked by the thing being installed as a matter of course, so if that's the problem, this would be a bug issue, not just an install issue.

I've searched my local system for all files/directories with 'cachemaster' after the successful install, and can't find any more directories where permissions might be an issue.

I tried 'updating' another out of date plugin on the live server, and it updated fine, no issues.

Context property

It would be very nice if CachMaster had a property for specifying a context in which to disable the automatic cache clearing button. Probably should take a comma-delimited list, with β€œall” being the default.

Does it work with develop version of MODX?

I installed CacheMaster in develop version of MODX, namely from the Git develop branch (2.3.0-dev). I used both default and custom plugin settings (via property set). But it doesn't seem to work. My resources don't get refreshed even on changing the content field.

The site is installed with a custom config key so the cache files sit in a subfolder of core/cache/. The error log shows nothing. What's the problem?

Cachemaster 1.2.2 and Revo 2.3.2 on Modxcloud.com

Hi Bob,
New to cachemaster and it doesnt seem to be working.
I call my templates using the include snippet e.g.
1

[[include? &file=assets/templates/index.php]]

Say I have 2 pages Home and About

Home - uncached it has 10 queries and cached it has 1 if
1

is correct About - uncached it has 12 queries and cached it has 1

Lets say CacheMaster is installed and both Home and About are currently cached and use 1 query. If I update Home and navigate to About and View source it states I am making 12 queries again instead of 1 implying that the entire site cache has been cleared and not just that of the Home page. I use the default settings in Cache Master properties and the Empty Cache checkbox is checked by default on all my resources.

Am I missing something? I'm also hosted on modxcloud.com

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.