Forums / Developer / how to clear override cache?

how to clear override cache?

Author Message

Eric Bourgain

Saturday 03 March 2007 8:25:04 am

As I'm am unable to make the class_group match override rule work, I generate overrides by script. The idea is that I create class (form class), and that I want them to use a specific template.
I generate the override, the class, that is OK. But when I create an instance of my class, the new override rule is not known: I get the default template!!
the override. ini has been generated through different ways. It is currently done through a code directly mimicked from visual/emplatecreate.php:

    $overrideINI=eZINI::instance('override.ini', 'settings', null, null, true);
    $overrideINI->prependOverrideDir("siteaccess/$siteAccess",
                                     false,
                                     'siteaccess');
    $overrideINI->loadCache();
    $overrideINI->setVariable("line_$classIdentifier",
                              'Source',
                              'node/view/line.tpl');
    $overrideINI->setVariable("line_$classIdentifier",
                              'MatchFile',
                              $lineTemplate);
    $overrideINI->setVariable("line_$classIdentifier",
                              'Subdir',
                              "templates");
    $overrideINI->setVariable("line_$classIdentifier",
                              'Match',
                              array('class_identifier' => $classIdentifier));
    $oldumask = umask(0);
    $overrideINI->save("siteaccess/$siteAccess/override.ini.append");
    chmod("settings/siteaccess/$siteAccess/override.ini.append.php",
          octdec($filePermission));
    umask($oldumask);
    include_once('kernel/classes/ezcontentcachemanager.php');
    eZContentCacheManager::clearAllContentCache();
    // Clear override cache
    $cachedDir = eZSys::cacheDirectory();
    $cachedDir .= "/override/";
    eZDir::recursiveDelete($cachedDir);

This is made at class creation, before the object creation. I've even added some extra clearcache instruction:

  include_once( "kernel/classes/ezcache.php" );
  eZCache::clearByTag( 'ini' );
  $cacheCleared['ini'] = true;
  include_once( 'kernel/classes/ezcontentcachemanager.php' );
  eZContentCacheManager::clearAllContentCache();
  $cachedDir = eZSys::cacheDirectory();
  $cachedDir .= "/override/";
  eZDir::recursiveDelete( $cachedDir );
  eZCache::clearByID( 'template-override' );

It does not work. The override is OK: if I remove template+contents cache, it works. But this is not an open option, since I mut be able to create form classes while the site is in production.
Does anyone have an idea?

Fabien Mas

Friday 09 March 2007 5:43:48 am

Hi,
I am also very interested by this ?
nobody knows ?

Thx, Fabien