yii创建一个没有资产的干净应用程序

yii创建一个没有资产的干净应用程序,yii,Yii,我使用/yiicwebapp/path/to/name创建一个项目,但我不需要创建任何文件 实际: assets css images index.php index-test.php受保护的主题 预期: index.php受保护 我应该更改的模板在哪里 如果您真的想改变这一点,您应该扩展(或修改)作为框架一部分的类WebAppCommand。可以在 Yii -> Framework ->cli -> commands ->WebAppCo

我使用
/yiicwebapp/path/to/name
创建一个项目,但我不需要创建任何文件

实际:
assets css images index.php index-test.php受保护的主题

预期:
index.php受保护


我应该更改的模板在哪里

如果您真的想改变这一点,您应该扩展(或修改)作为框架一部分的类WebAppCommand。可以在

Yii
-> Framework 
   ->cli
     -> commands
       ->WebAppCommand.php 
与其修改现有代码,我建议您编写一个扩展
WebAppCommand
类的自定义类,只需在调用
WebAppCommand
的run方法的单独方法中删除目录,并添加额外的行以删除不必要的目录。 也许是这样的

<?php 
 class MyCustomWebAppCommand extends WebAppCommand {
      private $_rootPath; // Need to redefine  and compute this as thevariable is defined as private in the parent class and better not touch core classes;
      public function run($args){
          parent::run($args);
          $path=strtr($args[0],'/\\',DIRECTORY_SEPARATOR);
          if(strpos($path,DIRECTORY_SEPARATOR)===false)
          $path='.'.DIRECTORY_SEPARATOR.$path;
          if(basename($path)=='..')
          $path.=DIRECTORY_SEPARATOR.'.';
          $dir=rtrim(realpath(dirname($path)),'\\/');
          if($dir===false || !is_dir($dir))
              $this->usageError("The directory '$path' is not valid. Please make sure the parent directory exists.");
          if(basename($path)==='.')
              $this->_rootPath=$path=$dir;
          else
              $this->_rootPath=$path=$dir.DIRECTORY_SEPARATOR.basename($path);
              $this->deleteDir($this->_rootPath.DIRECTORY_SEPARATOR."assets");
              $this->deleteDir($this->_rootPath.DIRECTORY_SEPARATOR."themes");
              $this->deleteDir($this->_rootPath.DIRECTORY_SEPARATOR."images");
              $this->deleteDir($this->_rootPath.DIRECTORY_SEPARATOR."css");
              unset($this->_rootPath.DIRECTORY_SEPARATOR."index-test.php");
      }


       public static function deleteDir($dirPath) {
          if (! is_dir($dirPath)) {
            throw new InvalidArgumentException("$dirPath must be a directory");
          }
          if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
             $dirPath .= '/';
          }
          $files = glob($dirPath . '*', GLOB_MARK);
          foreach ($files as $file) {
            if (is_dir($file)) {
               self::deleteDir($file);
             } else {
               unlink($file);
             }
         }
         rmdir($dirPath);
         }
}