模块目录默认只生成config.php文件 其他的需要指定生成

This commit is contained in:
thinkphp
2015-12-11 09:35:52 +08:00
parent b34d2f3a1b
commit 78d5bbd471

View File

@@ -60,7 +60,7 @@ class Create
mkdir(APP_PATH . dirname($file), 0777, true); mkdir(APP_PATH . dirname($file), 0777, true);
} }
if (!is_file(APP_PATH . $file)) { if (!is_file(APP_PATH . $file)) {
file_put_contents(APP_PATH . $file, ''); file_put_contents(APP_PATH . $file, 'php' == pathinfo($file, PATHINFO_EXTENSION) ? "<?php\n" : '');
} }
} }
} }
@@ -94,7 +94,7 @@ class Create
// 生成(空白)文件 // 生成(空白)文件
foreach ($file as $name) { foreach ($file as $name) {
if (!is_file($modulePath . $name)) { if (!is_file($modulePath . $name)) {
file_put_contents($modulePath . $name, ''); file_put_contents($modulePath . $name, 'php' == pathinfo($name, PATHINFO_EXTENSION) ? "<?php\n" : '');
} }
} }
} else { } else {
@@ -146,14 +146,8 @@ class Create
// 创建模块公共文件 // 创建模块公共文件
protected static function buildCommon($module) protected static function buildCommon($module)
{ {
if (!is_file(APP_PATH . $module . DS . 'common.php')) {
file_put_contents(APP_PATH . $module . DS . 'common.php', "<?php\n");
}
if (!is_file(APP_PATH . $module . DS . 'config.php')) { if (!is_file(APP_PATH . $module . DS . 'config.php')) {
file_put_contents(APP_PATH . $module . DS . 'config.php', "<?php\nreturn [\n\n];"); file_put_contents(APP_PATH . $module . DS . 'config.php', "<?php\nreturn [\n\n];");
} }
if (!is_file(APP_PATH . $module . DS . 'alias.php')) {
file_put_contents(APP_PATH . $module . DS . 'alias.php', "<?php\nreturn [\n\n];");
}
} }
} }