选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * sfGeneratorManager helps generate classes, views and templates for scaffolding, admin interface, ... * * @package symfony * @subpackage generator * @author Fabien Potencier * @version SVN: $Id: sfGeneratorManager.class.php 17858 2009-05-01 21:22:50Z FabianLange $ */ class sfGeneratorManager { protected $configuration = null, $basePath = null; /** * Class constructor. * * @param sfProjectConfiguration $configuration A sfProjectConfiguration instance * @param string $basePath The base path for file generation * * @see initialize() */ public function __construct(sfProjectConfiguration $configuration, $basePath = null) { $this->configuration = $configuration; $this->basePath = $basePath; } /** * Initializes the sfGeneratorManager instance. * * @param sfProjectConfiguration $configuration A sfProjectConfiguration instance * @deprecated */ public function initialize(sfProjectConfiguration $configuration) { // DEPRECATED } /** * Returns the current configuration instance. * * @return sfProjectConfiguration A sfProjectConfiguration instance */ public function getConfiguration() { return $this->configuration; } /** * Gets the base path to use when generating files. * * @return string The base path */ public function getBasePath() { if (is_null($this->basePath)) { // for BC $this->basePath = sfConfig::get('sf_module_cache_dir'); } return $this->basePath; } /** * Sets the base path to use when generating files. * * @param string $basePath The base path */ public function setBasePath($basePath) { $this->basePath = $basePath; } /** * Saves some content. * * @param string $path The relative path * @param string $content The content */ public function save($path, $content) { $path = $this->getBasePath().DIRECTORY_SEPARATOR.$path; if (!is_dir(dirname($path))) { $current_umask = umask(0000); if (false === @mkdir(dirname($path), 0777, true)) { throw new sfCacheException(sprintf('Failed to make cache directory "%s".', dirname($path))); } umask($current_umask); } if (false === $ret = @file_put_contents($path, $content)) { throw new sfCacheException(sprintf('Failed to write cache file "%s".', $path)); } return $ret; } /** * Generates classes and templates for a given generator class. * * @param string $generatorClass The generator class name * @param array $param An array of parameters * * @return string The cache for the configuration file */ public function generate($generatorClass, $param) { $generator = new $generatorClass($this); return $generator->generate($param); } }