Browse Source

Update BaseController.class.php

star7th 7 years ago
parent
commit
f9148c1afc
1 changed files with 15 additions and 1 deletions
  1. 15 1
      server/Application/Api/Controller/BaseController.class.php

+ 15 - 1
server/Application/Api/Controller/BaseController.class.php

@@ -22,6 +22,9 @@ class BaseController extends Controller {
 			exit();
 		}
 
+		//检测数据库文件是否有可写权限
+		$this->checkDbWhitable();
+
     }
 
 
@@ -187,6 +190,17 @@ class BaseController extends Controller {
 		}
 
 	}
+	//检查数据库文件是否可写
+	protected function checkDbWhitable(){
+		$file = C("DB_NAME") ;
+	    if ( $fp = @fopen($file, 'a+')) {
+	       @fclose($fp);
+	       return true ;
+	    } else {
+	    	$this->sendError("10103","Sqlite/showdoc.db.php文件不可写");
+	    	exit();
+	    }
+	}
 
 
-}
+}