蝉知和然之系统基本能在SAE平台正常运行,但是还有部分关于文件系统的操作会报权限错误,有部分代码不规范。进行以下几项工作提高然之在SAE平台上的运行稳定性。
1.1、(蝉知)查找mkdir()、fopen()、fclose()函数的使用地方。使用linux的grep命令进行查找。
./system/module/package/model.php:427: mkdir($downloadPath);
进行了判断不需处理
./system/module/package/model.php:563: if(!@mkdir($path, 0755, true))
进行了判断不需处理
./system/module/ui/control.php:106: if(!is_dir($savePath)) mkdir($savePath, 0755, true);
需要进行判断处理
./system/module/wechat/model.php:116: if(!is_dir(dirname($qrcodeFile))) @mkdir(dirname($qrcodeFile));
需要进行判断处理
./system/module/file/model.php:302: @mkdir($savePath, 0777, true);
进行了判断不需处理
./system/module/cache/model.php:24: if(!is_dir($this->cacheRoot)) mkdir($this->cacheRoot, 0755, true);
功能不了解,暂缓处理
./system/bin/syncext.php:91: if(!is_dir($targetPath)) mkdir($targetPath, 0755, true);
./system/bin/cn2tw.php:41: if(!is_dir($extTargetLangPath)) mkdir($extTargetLangPath);
./system/lib/qrcode/qrcode.class.php:2625: mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
./system/lib/zfile/zfile.class.php:30: mkdir($to);
./system/lib/zfile/zfile.class.php:138: public function mkdir($dir)
./system/lib/zfile/zfile.class.php:140: return mkdir($dir, 0755, true);
./system/lib/purifier/purifier.class.php:15286: mkdir($directory, $chmod);
./system/lib/purifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt:45: if (!is_dir($dir)) mkdir($dir);
./system/lib/pclzip/pclzip.class.php:5026: if (!@mkdir($p_dir, 0777))
./system/framework/helper.class.php:172: if(!is_dir($mergedModelDir)) mkdir($mergedModelDir, 0755, true);
相对于tempRoot无需修改
读文件是可以的,重点检查写文件的操作。
./system/module/file/model.php:305: $fd = @fopen($savePath . DS . 'index.php', "a+");
./system/module/upgrade/model.php:846: $fd = @fopen($indexFile, "a+");
./system/lib/wechatapi/wechatapi.class.php:594: $fh = fopen($logFile, 'a+');
./system/lib/phpmailer/phpmailer.class.php:1700: $fp = fopen('php://temp/', 'r+');
./system/lib/zdb/zdb.class.php:76: $fp = fopen($fileName, 'w');
./system/lib/purifier/purifier.class.php:8253: $fh = fopen($file, 'r');
./system/lib/purifier/purifier.class.php:8273: $fh = fopen($file, 'r');
./system/lib/snoopy/snoopy.class.php:1232: $fp = fopen($file_name, "r");
./system/lib/http/http.class.php:65: $fh = @fopen($logFile, 'a');
./system/lib/pclzip/pclzip.class.php:1114: if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
./system/lib/pclzip/pclzip.class.php:2203: if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
./system/lib/pclzip/pclzip.class.php:2353: if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
./system/lib/pclzip/pclzip.class.php:2667: if (($v_file = @fopen($p_filename, "rb")) == 0) {
./system/lib/pclzip/pclzip.class.php:2807: if (($v_file = @fopen($p_filename, "rb")) == 0) {
./system/lib/pclzip/pclzip.class.php:2841: if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
./system/lib/pclzip/pclzip.class.php:2873: if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
./system/lib/pclzip/pclzip.class.php:3157: if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
./system/lib/pclzip/pclzip.class.php:3827: if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
./system/lib/pclzip/pclzip.class.php:3900: if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
./system/lib/pclzip/pclzip.class.php:3972: if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
./system/lib/pclzip/pclzip.class.php:4002: if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
./system/lib/pclzip/pclzip.class.php:5117: if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
./system/lib/pclzip/pclzip.class.php:5255: if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
./system/framework/router.class.php:1660: $fh = @fopen($errorFile, 'a');
./system/framework/router.class.php:1722: $fh = @fopen($sqlLog, 'a');
1.2 (然之)
./app/sys/file/model.php:273: if(!file_exists($savePath)) @mkdir($savePath, 0777, true);
./lib/qrcode/qrcode.class.php:2626: mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
./lib/zfile/zfile.class.php:30: mkdir($to);
./lib/zfile/zfile.class.php:138: public function mkdir($dir)
./lib/zfile/zfile.class.php:140: return mkdir($dir, 0755, true);
./lib/pclzip/pclzip.class.php:5026: if (!@mkdir($p_dir, 0777))
./framework/helper.class.php:164: if(!is_dir($app->getTmpRoot() . 'model' . DS)) mkdir($app->getTmpRoot() . 'model' . DS, 0755, true);
./app/sys/schema/model.php:125: $handle = fopen($this->session->importFile, 'r');
./lib/phpmailer/phpmailer.class.php:1700: $fp = fopen('php://temp/', 'r+');
./lib/snoopy/snoopy.class.php:1232: $fp = fopen($file_name, "r");
./lib/http/http.class.php:65: $fh = @fopen($logFile, 'a');
./lib/pclzip/pclzip.class.php:1114: if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
./lib/pclzip/pclzip.class.php:2203: if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
./lib/pclzip/pclzip.class.php:2353: if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
./lib/pclzip/pclzip.class.php:2667: if (($v_file = @fopen($p_filename, "rb")) == 0) {
./lib/pclzip/pclzip.class.php:2807: if (($v_file = @fopen($p_filename, "rb")) == 0) {
./lib/pclzip/pclzip.class.php:2841: if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
./lib/pclzip/pclzip.class.php:2873: if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
./lib/pclzip/pclzip.class.php:3157: if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
./lib/pclzip/pclzip.class.php:3827: if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
./lib/pclzip/pclzip.class.php:3900: if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
./lib/pclzip/pclzip.class.php:3972: if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
./lib/pclzip/pclzip.class.php:4002: if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
./lib/pclzip/pclzip.class.php:5117: if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
./lib/pclzip/pclzip.class.php:5255: if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
./framework/router.class.php:1744: $fh = @fopen($errorFile, 'a');
./framework/router.class.php:1789: $fh = @fopen($sqlLog, 'a');
2、将所有的代码审查一遍。
补充注释,将内容与原系统做对比。检查修改是否合适。规范代码格式。
SAE平台MySQL不允许使用show database,需要将install/model.php的checkconfig方法进行修改去掉checkDb()的调用。
3、将演示环境更换到SAE的主版本。
4、编写、修改升级文档
5、查看日志文件,修改出现的错误提示
6、添加英文支持,把语言文件的英文文件添加上。