Skip to content

Commit 82f77ec

Browse files
committed
1 parent 457ff6e commit 82f77ec

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

Extend/Engine/Cluster/DefaultApp/IO/auto.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@
1919
if(is_file(APP_PATH.'Common/common_local.php')){
2020
require APP_PATH.'Common/common_local.php';
2121
}
22+
//本地上传文件的IO操作
23+
function file_upload($src_file,$dest_file){
24+
$pdir=dirname($dest_file);
25+
if(!is_dir($pdir)) @mkdir($pdir,0777);
26+
return copy($src_file,$dest_file);
27+
}
28+
function file_delete($filename){
29+
return unlink($filename);
30+
}
31+
2232
if(!APP_DEBUG && is_file(RUNTIME_FILE)) {
2333
// 部署模式直接载入运行缓存
2434
require RUNTIME_FILE;
2535
}else{
2636
// 加载运行时文件
2737
require THINK_PATH.'Common/runtime.php';
28-
}
38+
}
2939
exit();
3040
}

Extend/Engine/Cluster/DefaultApp/IO/sample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function file_upload($src_file,$dest_file){
141141
* @return void
142142
*/
143143
function file_delete($filename){
144-
return delete($filename);
144+
return unlink($filename);
145145
}
146146

147147
/**

Extend/Engine/Cluster/DefaultApp/Lib/Action/IndexAction.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// 本类由系统自动生成,仅供测试用途
33
class IndexAction extends Action {
44
public function index(){
5-
$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b> (Cluster Engine for '.IO_NAME.')!</p></div><div>测试:<a href="__URL__/f" target="_blank">F函数</a> <a href="__URL__/s" target="_blank">S函数</a> <a href="__URL__/upload" target="_blank">上传文件</a> <a href="__URL__/log" target="_blank">日志记录</a></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
5+
$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b> (Cluster Engine for '.IO_NAME.')!</p></div><div>测试:<a href="__URL__/f" target="_blank">F函数</a> <a href="__URL__/s" target="_blank">S函数</a> <a href="__URL__/upload" target="_blank">上传图片</a> <a href="__URL__/log" target="_blank">日志记录</a></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
66
}
77
public function f(){
88
F('name','success');
@@ -27,7 +27,6 @@ public function upload(){
2727
'saveRule'=>'time',
2828
);
2929
$upload = new UploadFile($config);
30-
$upload->imageClassPath="@.ORG.Image";
3130
$upload->thumb=true;
3231
$upload->thumbMaxHeight=100;
3332
$upload->thumbMaxWidth=100;

Extend/Engine/Cluster/build_first_app.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ function copy_defaut_app($directory,$to) {
55
}
66
$handle = opendir($directory);
77
while (($file = readdir($handle)) !== false) {
8-
if ($file != "." && $file != "..") {
9-
is_dir("$directory/$file") ?copy_defaut_app("$directory/$file","$to/$file") :copy("$directory/$file","$to/$file");
8+
if ($file != '.' && $file != '..') {
9+
if(is_file($to.'/'.$file)) continue;
10+
is_dir($directory.'/'.$file) ?copy_defaut_app($directory.'/'.$file,$to.'/'.$file) :copy($directory.'/'.$file,$to.'/'.$file);
1011
}
1112
}
1213
if (readdir($handle) == false) {

Extend/Engine/cluster.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
require IO_PATH;
2222
//[cluster] 记录开始运行时间 移动到加载IO文件之后
2323
$GLOBALS['_beginTime'] = microtime(TRUE);
24-
// 记录内存初始使用
25-
define('MEMORY_LIMIT_ON',function_exists('memory_get_usage'));
26-
if(MEMORY_LIMIT_ON) $GLOBALS['_startUseMems'] = memory_get_usage();
2724
//[cluster] 定义加载IO配置
2825
defined('IO_TRUE_NAME') or define('IO_TRUE_NAME',IO_NAME);
2926
require CLUSTER_PATH.'Lib/Core/ThinkFS.class.php';

0 commit comments

Comments
 (0)