We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9237
    • 8 Posts
    Is there a way to clear SiteCache.idx.php NOT from within the manager? I have a script that runs on its own and utilizes the ModX front end API. It updates the system_settings table on install and I therefore need to clear the cache before I can access the new variables. The problem is that I don’t want to have to log into the manager to do this. I have tried the following:

    include_once('../../manager/processors/cache_sync.class.processor.php');
    $sync = new synccache();
    $sync->setCachepath("../../assets/cache/");
    $sync->setReport(false);
    $sync->emptyCache();


    but since the emptyCache function uses mysql_query, mysql_num_rows, etc. instead of the modx->db functions, it doesn’t work.

    Any help would be appreciated.
      • 22303 MODX Staff
      • 10,725 Posts
      There is an example of how to do it in the NewsPublisher snippet I believe.
        • 9237
        • 8 Posts
        Yeah, the example in NewsPublisher is the same as what I tried. Since I’m not directly using the ModX index file, it’s not working. I’m getting failures on all of the mysql functions called in manager/processors/cache_sync.class.processor.php, most likely due to the fact that I’m not directly accessing the API, but rather through a ModX API library.
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: eVizions at Aug 16, 2007, 04:01 PM

          I’m getting failures on all of the mysql functions called in manager/processors/cache_sync.class.processor.php, most likely due to the fact that I’m not directly accessing the API, but rather through a ModX API library.
          The MODxAPI in the repository should allow you to instantiate the MODx object and use this method of clearing the cache, though I haven’t used it myself to confirm. Or are you talking about a "home-grown" library?
            • 9237
            • 8 Posts
            I’m using the ModXAPI in the repository, but I’ve made some customizations to it, although nothing that should affect how it works overall. I’m able to utilize the ModX object through it, but for some reason it doesn’t accept standard mysql calls, only by using the modx->db object.