svnno****@sourc*****
svnno****@sourc*****
2009年 6月 25日 (木) 12:13:31 JST
Revision: 78 http://sourceforge.jp/projects/frameworkspider/svn/view?view=rev&revision=78 Author: m_nakashima Date: 2009-06-25 12:13:31 +0900 (Thu, 25 Jun 2009) Log Message: ----------- suPHPなどの特殊環境に対応する為、spiderが動的に作成する一時ファイルや一時フォルダのパーミッションをdefine.inc.phpで定義できるようにしました。 Modified Paths: -------------- current/DATA/define.inc.php current/DATA/lib/spider/BuildInformation.class.php current/DATA/lib/spider/Builder.class.php current/DATA/lib/spider/HttpRequest.class.php current/DATA/lib/spider/functions.inc.php current/DATA/lib/spider/tags/OutputHtml.class.php current/DATA/lib/util/File.class.php current/DATA/lib/util/LockProcess.class.php current/README.txt -------------- next part -------------- Modified: current/DATA/define.inc.php =================================================================== --- current/DATA/define.inc.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/define.inc.php 2009-06-25 03:13:31 UTC (rev 78) @@ -37,6 +37,11 @@ /* * 拡張設定 */ +// spiderコアが自動生成するファイルの標準パーミッション +define ( 'SPIDER_FILE_CREATE_PERMITTION', 0666 ); +// spiderコアが自動生成するフォルダの標準パーミッション +define ( 'SPIDER_FOLDER_CREATE_PERMITTION', 0777 ); + // ライブラリディレクトリ名 define ( 'DIR_NAME_LIB', 'lib' ); // テンプレート配置ディレクトリ名 Modified: current/DATA/lib/spider/BuildInformation.class.php =================================================================== --- current/DATA/lib/spider/BuildInformation.class.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/spider/BuildInformation.class.php 2009-06-25 03:13:31 UTC (rev 78) @@ -120,8 +120,8 @@ } } if( strlen($dir_path) > strlen(DIR_PATH_BIN) && !is_dir($dir_path) ) { - if( @mkdir( $dir_path, 0777 ) ) { - @chmod( $dir_path, 0777 ); + if( @mkdir( $dir_path, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( $dir_path, SPIDER_FOLDER_CREATE_PERMITTION ); } else { header('Content-Type: text/plain;charset=UTF-8'); die('Core Erorr! Can\'t create build file directoreis! '.$dir_path); Modified: current/DATA/lib/spider/Builder.class.php =================================================================== --- current/DATA/lib/spider/Builder.class.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/spider/Builder.class.php 2009-06-25 03:13:31 UTC (rev 78) @@ -289,10 +289,10 @@ fwrite( $fp, $string ); flock($fp, LOCK_UN); @fclose( $fp ); - @chmod( $bin_file_path, 0666 ); + @chmod( $bin_file_path, SPIDER_FILE_CREATE_PERMITTION ); } else { @fclose( $fp ); - @chmod( $bin_file_path, 0666 ); + @chmod( $bin_file_path, SPIDER_FILE_CREATE_PERMITTION ); die('Core Error: Can\'t create execute file!!'); } } else { @@ -332,10 +332,10 @@ fwrite( $fp, $string ); flock($fp, LOCK_UN); @fclose( $fp ); - @chmod( $build_file_path, 0666 ); + @chmod( $build_file_path, SPIDER_FILE_CREATE_PERMITTION ); } else { @fclose( $fp ); - @chmod( $build_file_path, 0666 ); + @chmod( $build_file_path, SPIDER_FILE_CREATE_PERMITTION ); die('Core Error: Can\'t create build file!!'); } } else { Modified: current/DATA/lib/spider/HttpRequest.class.php =================================================================== --- current/DATA/lib/spider/HttpRequest.class.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/spider/HttpRequest.class.php 2009-06-25 03:13:31 UTC (rev 78) @@ -329,26 +329,26 @@ // ログファイル名の決定 $log_file_path = DIR_PATH_LOG.DIRECTORY_SEPARATOR.'spider'; if( !file_exists( $log_file_path ) ) { - if( @mkdir( $log_file_path, 0777 ) ) { - @chmod( $log_file_path, 0777 ); + if( @mkdir( $log_file_path, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( $log_file_path, SPIDER_FOLDER_CREATE_PERMITTION ); } } $log_file_path = $log_file_path.DIRECTORY_SEPARATOR.date('Y'); if( !file_exists( $log_file_path ) ) { - if( @mkdir( $log_file_path, 0777 ) ) { - @chmod( $log_file_path, 0777 ); + if( @mkdir( $log_file_path, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( $log_file_path, SPIDER_FOLDER_CREATE_PERMITTION ); } } $log_file_path = $log_file_path.DIRECTORY_SEPARATOR.date('m'); if( !file_exists( $log_file_path ) ) { - if( @mkdir( $log_file_path, 0777 ) ) { - @chmod( $log_file_path, 0777 ); + if( @mkdir( $log_file_path, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( $log_file_path, SPIDER_FOLDER_CREATE_PERMITTION ); } } $log_file_path = $log_file_path.DIRECTORY_SEPARATOR.'system_'.date('d').'.log'; if( !file_exists( $log_file_path ) ) { - if(@touch( $log_file_path, 0666 )){ - @chmod( $log_file_path, 0666 ); + if(@touch( $log_file_path, SPIDER_FILE_CREATE_PERMITTION )){ + @chmod( $log_file_path, SPIDER_FILE_CREATE_PERMITTION ); } } error_log($log_message."\n" , 3, $log_file_path ); Modified: current/DATA/lib/spider/functions.inc.php =================================================================== --- current/DATA/lib/spider/functions.inc.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/spider/functions.inc.php 2009-06-25 03:13:31 UTC (rev 78) @@ -26,8 +26,8 @@ array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.workdirisnotwritable'] ); } else { if( !file_exists(DIR_PATH_BIN) ) { - if( @mkdir(DIR_PATH_BIN,0777) ) { - @chmod(DIR_PATH_BIN,0777); + if( @mkdir(DIR_PATH_BIN,SPIDER_FOLDER_CREATE_PERMITTION) ) { + @chmod(DIR_PATH_BIN,SPIDER_FOLDER_CREATE_PERMITTION); } else { array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.cantcreatebindir'] ); } @@ -35,8 +35,8 @@ array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.bindirisnotwritable'] ); } if( !file_exists(DIR_PATH_LOCK) ) { - if( @mkdir( DIR_PATH_LOCK, 0777 ) ) { - @chmod( DIR_PATH_LOCK, 0777 ); + if( @mkdir( DIR_PATH_LOCK, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( DIR_PATH_LOCK, SPIDER_FOLDER_CREATE_PERMITTION ); } else { array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.cantcreatelockdir'] ); } @@ -44,8 +44,8 @@ array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.lockdirisnotwritable'] ); } if( !file_exists(DIR_PATH_TMP) ) { - if( @mkdir( DIR_PATH_TMP, 0777 ) ) { - @chmod( DIR_PATH_TMP, 0777 ); + if( @mkdir( DIR_PATH_TMP, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( DIR_PATH_TMP, SPIDER_FOLDER_CREATE_PERMITTION ); } else { array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.cantcreatetmpdir'] ); } @@ -53,8 +53,8 @@ array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.tmpdirisnotwritable'] ); } if( !file_exists(DIR_PATH_CACHE) ) { - if( @mkdir( DIR_PATH_CACHE, 0777 ) ) { - @chmod( DIR_PATH_CACHE, 0777 ); + if( @mkdir( DIR_PATH_CACHE, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( DIR_PATH_CACHE, SPIDER_FOLDER_CREATE_PERMITTION ); } else { array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.cantcreatecachedir'] ); } @@ -69,8 +69,8 @@ array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.datadirisnotwritable'] ); } else { if( !file_exists(DIR_PATH_LOG) ) { - if( @mkdir( DIR_PATH_LOG, 0777 ) ) { - @chmod( DIR_PATH_LOG, 0777 ); + if( @mkdir( DIR_PATH_LOG, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( DIR_PATH_LOG, SPIDER_FOLDER_CREATE_PERMITTION ); } else { array_push( $errors, $GLOBALS['spider.messages']['spider.finctions.cantcreatelogdir'] ); } @@ -228,8 +228,8 @@ $lock_path = DIR_PATH_LOCK.DIRECTORY_SEPARATOR.'spider.orgsession.mainlock'; if( spider_pwait() ) { // ロックがかかっていないならロックディレクトリ作成 - mkdir( $lock_path, 0777 ); - chmod( $lock_path, 0777 ); + mkdir( $lock_path, SPIDER_FOLDER_CREATE_PERMITTION ); + chmod( $lock_path, SPIDER_FOLDER_CREATE_PERMITTION ); return true; } else { return false; Modified: current/DATA/lib/spider/tags/OutputHtml.class.php =================================================================== --- current/DATA/lib/spider/tags/OutputHtml.class.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/spider/tags/OutputHtml.class.php 2009-06-25 03:13:31 UTC (rev 78) @@ -92,7 +92,7 @@ $process_code .= 'flock($fp, LOCK_UN);'."\n"; $process_code .= '}'."\n"; $process_code .= '@fclose( $fp );'."\n"; - $process_code .= '@chmod( "'.$html_path.'", 0666 );'."\n"; + $process_code .= '@chmod( "'.$html_path.'", '.SPIDER_FILE_CREATE_PERMITTION.' );'."\n"; $process_code .= '}'."\n"; $process_code .= '}'."\n"; if( !isset($build_information->convert_view_process_hash) Modified: current/DATA/lib/util/File.class.php =================================================================== --- current/DATA/lib/util/File.class.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/util/File.class.php 2009-06-25 03:13:31 UTC (rev 78) @@ -19,8 +19,8 @@ if( preg_match('/^[dD][iI][rR]/', filetype($file_absolute_path) ) ) { // フォルダの場合なければ作成する if( !file_exists($destination_path) ) { - if( @mkdir( $destination_path, 0777 ) ) { - @chmod( $destination_path, 0777 ); + if( @mkdir( $destination_path, SPIDER_FOLDER_CREATE_PERMITTION ) ) { + @chmod( $destination_path, SPIDER_FOLDER_CREATE_PERMITTION ); } else { return false; } @@ -33,7 +33,7 @@ // 対象がファイルの場合なければコピー if( $force || !file_exists($destination_path) ) { if( @copy( $file_absolute_path, $destination_path ) ) { - @chmod( $destination_path, 0777 ); + @chmod( $destination_path, SPIDER_FOLDER_CREATE_PERMITTION ); } else { return false; } Modified: current/DATA/lib/util/LockProcess.class.php =================================================================== --- current/DATA/lib/util/LockProcess.class.php 2009-06-25 01:26:29 UTC (rev 77) +++ current/DATA/lib/util/LockProcess.class.php 2009-06-25 03:13:31 UTC (rev 78) @@ -41,8 +41,8 @@ // 現在ロックがかかっているか確認する if( $this->wait() ) { // ロックがかかっていないならロックディレクトリ作成 - mkdir( $this->lock_file_name, 0777 ); - chmod( $this->lock_file_name, 0777 ); + mkdir( $this->lock_file_name, SPIDER_FOLDER_CREATE_PERMITTION ); + chmod( $this->lock_file_name, SPIDER_FOLDER_CREATE_PERMITTION ); return true; } else { return false; Modified: current/README.txt =================================================================== --- current/README.txt 2009-06-25 01:26:29 UTC (rev 77) +++ current/README.txt 2009-06-25 03:13:31 UTC (rev 78) @@ -3,6 +3,10 @@ ** ** このファイルにはコミットごとに変更点とファイル名を記述します。 ** +-- 2009-06-25 +1) suPHPなどの特殊環境に対応する為、spiderが動的に作成する一時ファイルや一時フォルダのパーミッションを + define.inc.phpで定義できるようにしました。 + -- 2009-04-22 1) spiderのDATAフォルダをspider.inc.php配置フォルダからさかのぼって自動認識するようにしました。 2) HttpRequestのセッションの適正化メソッドで、セッションスコープの判断をREQUEST_URIで行っており