Comparing version 0.3.8 to 0.3.9
@@ -291,4 +291,5 @@ var fs = require("fs"); | ||
global.mkdir = function(p, mode){ | ||
mode = mode || 0777; | ||
mode = mode || '0777'; | ||
if (fs.existsSync(p)) { | ||
chmod(p, mode); | ||
return true; | ||
@@ -312,4 +313,4 @@ }; | ||
global.chmod = function(p, mode){ | ||
mode = mode || 0777; | ||
if (fs.existsSync(p)) { | ||
mode = mode || '0777'; | ||
if (!fs.existsSync(p)) { | ||
return true; | ||
@@ -316,0 +317,0 @@ }; |
@@ -234,5 +234,7 @@ var fs = require("fs"); | ||
var dir = path.dirname(filename); | ||
mkdir(dir, "0777"); | ||
mkdir(dir); | ||
_cache[name] = value; | ||
fs.writeFile(filename, JSON.stringify(value), function(){}); | ||
fs.writeFile(filename, JSON.stringify(value), function(){ | ||
chmod(filename); | ||
}); | ||
return; | ||
@@ -239,0 +241,0 @@ }; |
@@ -53,3 +53,3 @@ /** | ||
if (!fs.existsSync(RUNTIME_PATH)) { | ||
fs.mkdirSync(RUNTIME_PATH, "0777"); | ||
mkdir(RUNTIME_PATH); | ||
}else{ | ||
@@ -56,0 +56,0 @@ if (!isWritable(RUNTIME_PATH)) { |
module.exports = { | ||
clear_require_cache: false | ||
clear_require_cache: false, | ||
log_process_pid: false | ||
} |
@@ -28,2 +28,7 @@ /** | ||
].join(""); | ||
}else if(templateFile.indexOf('/') > -1){ | ||
//自动追加TPL_PATH前缀 | ||
if (templateFile.indexOf('/') !== 0) { | ||
templateFile = TPL_PATH + "/" + templateFile; | ||
}; | ||
}else if(templateFile.indexOf(C('tpl_file_suffix')) === -1){ | ||
@@ -30,0 +35,0 @@ var path = templateFile.split(":"); |
@@ -586,5 +586,2 @@ var util = require('util'); | ||
}).then(function(data){ | ||
if ( data === false) { | ||
return getPromise("_beforeUpdate return false", true); | ||
}; | ||
if (isEmpty(self._options.where) && isEmpty(options.where)) { | ||
@@ -609,5 +606,2 @@ // 如果存在主键数据 则自动作为更新条件 | ||
}).then(function(data){ | ||
if (data === false) { | ||
return getPromise("_afterUpdate return false", true); | ||
}; | ||
return data.affectedRows; | ||
@@ -617,2 +611,18 @@ }) | ||
/** | ||
* 更新多个数据,自动用主键作为查询条件 | ||
* @param {[type]} dataList [description] | ||
* @return {[type]} [description] | ||
*/ | ||
updateAll: function(dataList){ | ||
if (!isArray(dataList) || !isObject(dataList[0])) { | ||
return getPromise(L("_DATA_TYPE_INVALID_"), true); | ||
}; | ||
var promises = []; | ||
var self = this; | ||
dataList.forEach(function(data){ | ||
promises.push(self.update(data)); | ||
}); | ||
return Promise.all(promises); | ||
}, | ||
/** | ||
* 更新某个字段的值 | ||
@@ -619,0 +629,0 @@ * @param {[type]} field [description] |
@@ -176,5 +176,7 @@ //自动加载进行识别的路径 | ||
if (C('log_process_pid') && isMaster) { | ||
mkdir(DATA_PATH); | ||
var pidFile = DATA_PATH + "/app.pid"; | ||
var fs = require("fs"); | ||
fs.writeFileSync(pidFile, process.pid); | ||
chmod(pidFile); | ||
//进程退出时删除该文件 | ||
@@ -181,0 +183,0 @@ process.on('SIGTERM', function () { |
@@ -96,3 +96,5 @@ /** | ||
promise = tag("view_template", this.http, templateFile).then(function(file){ | ||
templateFile = !isFile(file) ? "" : file; | ||
if (file && isFile(file)) { | ||
templateFile = file; | ||
}; | ||
}) | ||
@@ -99,0 +101,0 @@ }; |
@@ -16,3 +16,3 @@ var fs = require("fs"); | ||
}; | ||
chmod(this.options.temp, "0777"); | ||
chmod(this.options.temp); | ||
}, | ||
@@ -33,3 +33,3 @@ /** | ||
if (!isDir(this.options.temp + dir)) { | ||
mkdir(this.options.temp + dir, "0777"); | ||
mkdir(this.options.temp + dir); | ||
}; | ||
@@ -36,0 +36,0 @@ filename = dir + this.options.prefix + name + C('data_file_suffix'); |
{ | ||
"name": "thinkjs", | ||
"description": "thinkphp web framework for nodejs", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "welefen", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
189658
5683