|
Revision 9260, 1.5 kB
(checked in by fabien, 5 years ago)
|
fixed cache corruption in the production environment for admin generated content (config/ and modules/ caches do not have to be expired in production)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id Rev Date
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfGeneratorManager |
|---|
| 20 |
{ |
|---|
| 21 |
protected $cache = null; |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
* Initializes the sfGeneratorManager instance. |
|---|
| 25 |
*/ |
|---|
| 26 |
public function initialize() |
|---|
| 27 |
{ |
|---|
| 28 |
|
|---|
| 29 |
$this->cache = new sfFileCache(sfConfig::get('sf_module_cache_dir')); |
|---|
| 30 |
$this->cache->initialize(array('lifeTime' => 86400 * 365 * 10, 'automaticCleaningFactor' => 0)); |
|---|
| 31 |
$this->cache->setSuffix(''); |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
* Returns the current sfCache implementation instance. |
|---|
| 36 |
* |
|---|
| 37 |
* @return sfCache A sfCache implementation instance |
|---|
| 38 |
*/ |
|---|
| 39 |
public function getCache() |
|---|
| 40 |
{ |
|---|
| 41 |
return $this->cache; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
* Generates classes and templates for a given generator class. |
|---|
| 46 |
* |
|---|
| 47 |
* @param string The generator class name |
|---|
| 48 |
* @param array An array of parameters |
|---|
| 49 |
* |
|---|
| 50 |
* @return string The cache for the configuration file |
|---|
| 51 |
*/ |
|---|
| 52 |
public function generate($generator_class, $param) |
|---|
| 53 |
{ |
|---|
| 54 |
$generator = new $generator_class(); |
|---|
| 55 |
$generator->initialize($this); |
|---|
| 56 |
$data = $generator->generate($param); |
|---|
| 57 |
|
|---|
| 58 |
return $data; |
|---|
| 59 |
} |
|---|
| 60 |
} |
|---|
| 61 |
|
|---|