diff --git a/Think/Create.php b/Think/Create.php new file mode 100644 index 00000000..0065fe80 --- /dev/null +++ b/Think/Create.php @@ -0,0 +1,73 @@ + +// +---------------------------------------------------------------------- +// $Id$ + +namespace Think; +class Create { + static public function build($install) { + // 锁定 + $lockfile = APP_PATH.'install.lock'; + if(is_writable($lockfile)) { + return ; + } else { + touch($lockfile); + } + foreach ($install as $module=>$list){ + if(!is_dir(APP_PATH.$module)) {// 创建模块目录 + mkdir(APP_PATH.$module); + } + foreach($list as $path=>$file){ + if(is_int($path)) { + // 生成文件 + if(!is_file(APP_PATH.$module.'/'.$file)) { + file_put_contents(APP_PATH.$module.'/'.$file,""); + } + }else{ + if(!is_dir(APP_PATH.$module.'/'.$path)){ + mkdir(APP_PATH.$module.'/'.$path); + } + foreach($file as $val){ + switch($path) { + case 'Controller': + $filename = ucwords($val).$path; + if(!is_file(APP_PATH.$module.'/'.$path.'/'.$filename.'.php')) { + file_put_contents(APP_PATH.$module.'/'.$path.'/'.$filename.'.php',"