Переглянути джерело

打开文件使用__DIR__

visuddhinanda 4 роки тому
батько
коміт
08e6141037

+ 1 - 1
app/install/db_insert_bookword_from_csv_cli.php

@@ -34,7 +34,7 @@ $dns = _FILE_DB_BOOK_WORD_;
 $dbh_word_index = new PDO($dns, _DB_USERNAME_, _DB_PASSWORD_, array(PDO::ATTR_PERSISTENT => true));
 $dbh_word_index->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 
-if (($handle = fopen("filelist.csv", 'r')) !== false) {
+if (($handle = fopen(__DIR__."/filelist.csv", 'r')) !== false) {
     while (($filelist[$fileNums] = fgetcsv($handle, 0, ',')) !== false) {
         $fileNums++;
     }

+ 1 - 1
app/install/db_insert_palitext_cli.php

@@ -29,7 +29,7 @@ $fileNums = 0;
 $log = "";
 echo "doing $_from";
 
-if (($handle = fopen("filelist.csv", 'r')) !== false) {
+if (($handle = fopen(__DIR__."/filelist.csv", 'r')) !== false) {
     while (($filelist[$fileNums] = fgetcsv($handle, 0, ',')) !== false) {
         $fileNums++;
     }

+ 4 - 4
app/install/db_insert_templet_cli.php

@@ -2,8 +2,8 @@
 /*
 用拆分好的三藏数据 生成模板库
  */
-require_once __DIR__."../path.php";
-require_once __DIR__.'../public/_pdo.php';
+require_once __DIR__."/../path.php";
+require_once __DIR__.'/../public/_pdo.php';
 
 
 echo "Insert templet to DB".PHP_EOL;
@@ -25,7 +25,7 @@ if ($_to > 217) {
 
 $filelist = array();
 
-if (($handle = fopen("filelist.csv", 'r')) !== false) {
+if (($handle = fopen(__DIR__."/filelist.csv", 'r')) !== false) {
     while (($filelist[] = fgetcsv($handle, 0, ',')) !== false) {
     }
 }
@@ -76,7 +76,7 @@ for ($from=$_from; $from <=$_to ; $from++) {
 	$log =  "$from,$FileName,open\r\n";
 	//fwrite($myLogFile, $log);
 
-	#删除目标数据库中所有数据
+	#删除目标数据库中数据
 	$query = "DELETE FROM "._TABLE_PALICANON_TEMPLET_." WHERE book = ?";
 	$stmt = $PDO->prepare($query);
 	if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {

+ 1 - 1
app/install/db_insert_word_from_csv_cli.php

@@ -34,7 +34,7 @@ $dns = _FILE_DB_PALI_INDEX_;
 $dbh_word_index = new PDO($dns, _DB_USERNAME_, _DB_PASSWORD_, array(PDO::ATTR_PERSISTENT => true));
 $dbh_word_index->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 
-if (($handle = fopen("filelist.csv", 'r')) !== false) {
+if (($handle = fopen(__DIR__."/filelist.csv", 'r')) !== false) {
     while (($filelist[$fileNums] = fgetcsv($handle, 0, ',')) !== false) {
         $fileNums++;
     }

+ 1 - 2
app/install/db_update_palitext_cli.php

@@ -28,8 +28,7 @@ $filelist = array();
 $fileNums = 0;
 $log = "";
 
-
-if (($handle = fopen("filelist.csv", 'r')) !== false) {
+if (($handle = fopen(__DIR__."/filelist.csv", 'r')) !== false) {
     while (($filelist[$fileNums] = fgetcsv($handle, 0, ',')) !== false) {
         $fileNums++;
     }

+ 1 - 1
app/install/db_update_toc_cli.php

@@ -27,7 +27,7 @@ $fileNums = 0;
 $log = "";
 echo "doing $_from".PHP_EOL;
 
-if (($handle = fopen("filelist.csv", 'r')) !== false) {
+if (($handle = fopen(__DIR__."/filelist.csv", 'r')) !== false) {
     while (($filelist[$fileNums] = fgetcsv($handle, 0, ',')) !== false) {
         $fileNums++;
     }