选择文件名文件大小最后修改时间操作
[📄] 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. */ require_once(dirname(__FILE__).'/sfGeneratorBaseTask.class.php'); /** * Generates a new application. * * @package symfony * @subpackage task * @author Fabien Potencier * @version SVN: $Id: sfGenerateAppTask.class.php 17762 2009-04-29 14:50:05Z fabien $ */ class sfGenerateAppTask extends sfGeneratorBaseTask { /** * @see sfTask */ protected function doRun(sfCommandManager $commandManager, $options) { $this->process($commandManager, $options); $this->checkProjectExists(); return $this->execute($commandManager->getArgumentValues(), $commandManager->getOptionValues()); } /** * @see sfTask */ protected function configure() { $this->addArguments(array( new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), )); $this->addOptions(array( new sfCommandOption('escaping-strategy', null, sfCommandOption::PARAMETER_REQUIRED, 'Output escaping strategy', false), new sfCommandOption('csrf-secret', null, sfCommandOption::PARAMETER_REQUIRED, 'Secret to use for CSRF protection', false), )); $this->aliases = array('init-app'); $this->namespace = 'generate'; $this->name = 'app'; $this->briefDescription = 'Generates a new application'; $this->detailedDescription = <<discard('.sf'); $this->getFilesystem()->mirror(dirname(__FILE__).'/skeleton/app/app', $appDir, $finder); // Create $app.php or index.php if it is our first app $indexName = 'index'; $firstApp = !file_exists(sfConfig::get('sf_web_dir').'/index.php'); if (!$firstApp) { $indexName = $app; } if (false === $options['csrf-secret']) { $options['csrf-secret'] = 'false'; } // Set no_script_name value in settings.yml for production environment $finder = sfFinder::type('file')->name('settings.yml'); $this->getFilesystem()->replaceTokens($finder->in($appDir.'/config'), '##', '##', array( 'NO_SCRIPT_NAME' => $firstApp ? 'on' : 'off', 'CSRF_SECRET' => sfYamlInline::dump(sfYamlInline::parseScalar($options['csrf-secret'])), 'ESCAPING_STRATEGY' => sfYamlInline::dump((boolean) sfYamlInline::parseScalar($options['escaping-strategy'])), )); $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/web/index.php', sfConfig::get('sf_web_dir').'/'.$indexName.'.php'); $this->getFilesystem()->copy(dirname(__FILE__).'/skeleton/app/web/index.php', sfConfig::get('sf_web_dir').'/'.$app.'_dev.php'); $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir').'/'.$indexName.'.php', '##', '##', array( 'APP_NAME' => $app, 'ENVIRONMENT' => 'prod', 'IS_DEBUG' => 'false', 'IP_CHECK' => '', )); $this->getFilesystem()->replaceTokens(sfConfig::get('sf_web_dir').'/'.$app.'_dev.php', '##', '##', array( 'APP_NAME' => $app, 'ENVIRONMENT' => 'dev', 'IS_DEBUG' => 'true', 'IP_CHECK' => '// this check prevents access to debug front controllers that are deployed by accident to production servers.'.PHP_EOL. '// feel free to remove this, extend it or make something more sophisticated.'.PHP_EOL. 'if (!in_array(@$_SERVER[\'REMOTE_ADDR\'], array(\'127.0.0.1\', \'::1\')))'.PHP_EOL. '{'.PHP_EOL. ' die(\'You are not allowed to access this file. Check \'.basename(__FILE__).\' for more information.\');'.PHP_EOL. '}'.PHP_EOL, )); $this->getFilesystem()->rename($appDir.'/config/ApplicationConfiguration.class.php', $appDir.'/config/'.$app.'Configuration.class.php'); $this->getFilesystem()->replaceTokens($appDir.'/config/'.$app.'Configuration.class.php', '##', '##', array('APP_NAME' => $app)); $fixPerms = new sfProjectPermissionsTask($this->dispatcher, $this->formatter); $fixPerms->setCommandApplication($this->commandApplication); $fixPerms->run(); // Create test dir $this->getFilesystem()->mkdirs(sfConfig::get('sf_test_dir').'/functional/'.$app); } }