svnno****@sourc*****
svnno****@sourc*****
2010年 6月 25日 (金) 10:32:22 JST
Revision: 114 http://sourceforge.jp/projects/frameworkspider/svn/view?view=rev&revision=114 Author: m_nakashima Date: 2010-06-25 10:32:22 +0900 (Fri, 25 Jun 2010) Log Message: ----------- spiderのビルドファイル作成パスが一部のWindows環境でうまく動作しなかった問題の修正 Modified Paths: -------------- current/README.txt current/spider/lib/spider/BuildInformation.class.php -------------- next part -------------- Modified: current/README.txt =================================================================== --- current/README.txt 2010-06-24 01:33:57 UTC (rev 113) +++ current/README.txt 2010-06-25 01:32:22 UTC (rev 114) @@ -10,6 +10,8 @@ ** Modifier : Masanori Nakashima ** Last Updated: 2010.06.23 ** +-- 2010-06-25 +1)spiderのビルドファイル作成パスが一部のWindows環境でうまく動作しなかった問題の修正 -- 2010-06-22 1) RewriteDocumentRootタグの修正。同じ名称のフォルダが階層内にあった場合にリンク変換が正しく行われない問題の修正をおこないました。 2) Templateタグの修正。外側テンプレートに記述されたモジュールより優先されていなかった問題の修正 Modified: current/spider/lib/spider/BuildInformation.class.php =================================================================== --- current/spider/lib/spider/BuildInformation.class.php 2010-06-24 01:33:57 UTC (rev 113) +++ current/spider/lib/spider/BuildInformation.class.php 2010-06-25 01:32:22 UTC (rev 114) @@ -109,36 +109,35 @@ * 実行ビルドファイルパスを取得します */ function getAgentPageBuildFilePath() { - $virtual_root = APPLICATION_BASE_PATH; - if( preg_match('/^[a-zA-Z]\\:/', APPLICATION_BASE_PATH, $regmatch_array ) ) { - // Windows対策ドライブをディレクトリとして変換 - $driveName = substr($regmatch_array[0],0,1); - $virtual_root = str_replace(DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, - DIRECTORY_SEPARATOR,preg_replace('/^[a-zA-Z]\\:/' - ,$driveName.DIRECTORY_SEPARATOR,$virtual_root )); - } else { - $virtual_root = substr($virtual_root,1); - } - // 2009-12-16 実行ファイル作成パスをspiderの上層ディレクトリ起点とする + // 実行フォルダパスの変換を簡易にする + $vartualRoot = str_replace(DIRECTORY_SEPARATOR,'/',APPLICATION_BASE_PATH); + $appBaseUri = str_replace(DIRECTORY_SEPARATOR,'/',APPLICATION_BASE_URI); if( !defined('SPIDER_USE_ABSOLUTE_BIN_PATH') || SPIDER_USE_ABSOLUTE_BIN_PATH === false ) { - $cutPath = dirname(DIR_PATH_SPIDER_DATA); - if( preg_match('/^[a-zA-Z]\\:/', APPLICATION_BASE_PATH, $regmatch_array ) > 0 ) { - // Windows対策ドライブをディレクトリとして変換 - $driveName = substr($regmatch_array[0],0,1); - $cutPath = str_replace(DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, - DIRECTORY_SEPARATOR,preg_replace('/^[a-zA-Z]\\:/' - ,$driveName.DIRECTORY_SEPARATOR, $cutPath )); - } - $virtual_root = preg_replace('/^'.util_CharUtility::escapeRegxStr($cutPath).'/','',$virtual_root); + // 実行ファイルパスをspiderの上層ディレクトリにする + $cutPath = str_replace(DIRECTORY_SEPARATOR,'/',dirname(DIR_PATH_SPIDER_DATA)); + $vartualRoot = str_replace($cutPath,'',$vartualRoot); } - $bin_file_path = DIR_PATH_BIN - .DIRECTORY_SEPARATOR.$virtual_root - .DIRECTORY_SEPARATOR.str_replace('/','',str_replace(DIRECTORY_SEPARATOR,'',APPLICATION_BASE_URI)) - .DIRECTORY_SEPARATOR.$this->getAgentPageUri(); - $bin_file_path = str_replace(DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR,DIRECTORY_SEPARATOR,$bin_file_path); - if( !is_dir( dirname($bin_file_path) ) ) { + if( strpos($vartualRoot,':') !== false ) { + // windows対策に:を変換 + $vartualRoot = str_replace(':','_CMA',dirname($vartualRoot)); + } + if( strpos($vartualRoot,'/') === 0 ) { + // /から始まるなら頭の/を除去 + $vartualRoot = substr($vartualRoot,1); + } + $binFilePath = DIR_PATH_BIN.'/'.$vartualRoot + .'/'.str_replace('/','_',$appBaseUri) + .'/'.$this->getAgentPageUri(); + while( strpos($binFilePath,DIRECTORY_SEPARATOR) !== false ){ + $binFilePath = str_replace(DIRECTORY_SEPARATOR,'/',$binFilePath); + } + while( strpos($binFilePath,'//') !== false ){ + $binFilePath = str_replace('//','/',$binFilePath); + } + $binFilePath = str_replace('/',DIRECTORY_SEPARATOR,$binFilePath); + if( !is_dir( dirname($binFilePath) ) ) { // 上位ディレクトリがないならディレクトリ階層を作成する - $dirname_array = explode(DIRECTORY_SEPARATOR, dirname($bin_file_path) ); + $dirname_array = explode(DIRECTORY_SEPARATOR, dirname($binFilePath) ); $dir_path = ''; foreach( $dirname_array as $dir_name ) { if( strlen($dir_path) > 0 ) { @@ -160,7 +159,7 @@ } } } - return $bin_file_path; + return $binFilePath; } /** * プレモジュール取り出し