Development

/branches/1.0/lib/generator/sfGeneratorManager.class.php

You must first sign up to be able to contribute.

root/branches/1.0/lib/generator/sfGeneratorManager.class.php

Revision 9260, 1.5 kB (checked in by fabien, 7 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  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfGeneratorManager helps generate classes, views and templates for scaffolding, admin interface, ...
13  *
14  * @package    symfony
15  * @subpackage generator
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfGeneratorManager
20 {
21   protected $cache = null;
22
23   /**
24    * Initializes the sfGeneratorManager instance.
25    */
26   public function initialize()
27   {
28     // create cache instance
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
Note: See TracBrowser for help on using the browser.