Ignore:
Timestamp:
2007/10/19 16:27:45 (16 years ago)
Author:
nanasess
Message:

リファクタリング

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/html/install/index.php

    r16313 r16506  
    3232 
    3333if(!is_writable($temp_dir)) { 
    34     SC_Utils_Ex::sfErrorHeader($temp_dir . "にユーザ書込み権限(777等)を付与して下さい。", true); 
     34    SC_Utils_Ex::sfErrorHeader($temp_dir . "にユーザ書込み権限(777, 707等)を付与して下さい。", true); 
    3535    exit; 
    3636} 
     
    374374        "../cp", 
    375375        "../upload", 
    376         ".." . HTML2DATA_DIR . "Smarty/templates_c", 
    377         ".." . HTML2DATA_DIR . "conf/cache", 
    378         ".." . HTML2DATA_DIR . "downloads", 
    379         ".." . HTML2DATA_DIR . "logs" 
     376        ".." . HTML2DATA_DIR . "cache/", 
     377        ".." . HTML2DATA_DIR . "class/", 
     378        ".." . HTML2DATA_DIR . "Smarty/", 
     379        ".." . HTML2DATA_DIR . "downloads/" 
    380380    ); 
    381381 
     
    383383    $err_file = false; 
    384384    foreach($arrWriteFile as $val) { 
    385         if(file_exists($val)) { 
    386             $mode = lfGetFileMode($val); 
    387             $real_path = realpath($val); 
    388  
    389             // ディレクトリの場合 
    390             if(is_dir($val)) { 
    391                 if(is_writable($val)) { 
    392                     $mess.= ">> ○:$real_path($mode) <br>アクセス権限は正常です。<br>"; 
     385 
     386        $arrDirs = listdirs($val); 
     387        foreach ($arrDirs as $path) { 
     388            if(file_exists($path)) { 
     389                $mode = lfGetFileMode($path); 
     390                $real_path = realpath($path); 
     391 
     392                // ディレクトリの場合 
     393                if(is_dir($path)) { 
     394                    if(is_writable($path)) { 
     395                        //$mess.= ">> ○:$real_path($mode) <br>アクセス権限は正常です。<br>"; 
     396                    } else { 
     397                        $mess.= ">> ×:$real_path($mode) <br>ユーザ書込み権限(777, 707等)を付与して下さい。<br>"; 
     398                        $err_file = true; 
     399                    } 
    393400                } else { 
    394                     $mess.= ">> ×:$real_path($mode) <br>ユーザ書込み権限(777等)を付与して下さい。<br>"; 
    395                     $err_file = true; 
     401                    if(is_writable($path)) { 
     402                        //$mess.= ">> ○:$real_path($mode) <br>アクセス権限は正常です。<br>"; 
     403                    } else { 
     404                        $mess.= ">> ×:$real_path($mode) <br>ユーザ書込み権限(666, 606等)を付与して下さい。<br>"; 
     405                        $err_file = true; 
     406                    } 
    396407                } 
    397408            } else { 
    398                 if(is_writable($val)) { 
    399                     $mess.= ">> ○:$real_path($mode) <br>アクセス権限は正常です。<br>"; 
    400                 } else { 
    401                     $mess.= ">> ×:$real_path($mode) <br>ユーザ書込み権限(666等)を付与して下さい。<br>"; 
    402                     $err_file = true; 
    403                 } 
     409                $mess.= ">> ×:$path が見つかりません。<br>"; 
     410                $err_file = true; 
    404411            } 
    405         } else { 
    406             $mess.= ">> ×:$val が見つかりません。<br>"; 
    407             $err_file = true; 
    408412        } 
    409413    } 
     
    451455            mkdir($path); 
    452456        } 
     457        $mess.= ">> ○:アクセス権限は正常です。<br>"; 
    453458    } 
    454459 
     
    10451050    $objDb->sfDataExists("dtb_csv", "csv_id = ? AND col = ?", array($csv_id, $col), $dsn, $sql, true); 
    10461051} 
     1052 
     1053/** 
     1054 * $dir を再帰的に辿ってパス名を配列で返す. 
     1055 * 
     1056 * @param string 任意のパス名 
     1057 * @return array $dir より下層に存在するパス名の配列 
     1058 * @see http://www.php.net/glob 
     1059 */ 
     1060function listdirs($dir) { 
     1061    static $alldirs = array(); 
     1062    $dirs = glob($dir . '/*'); 
     1063    if (count($dirs) > 0) { 
     1064        foreach ($dirs as $d) $alldirs[] = $d; 
     1065    } 
     1066    foreach ($dirs as $dir) listdirs($dir); 
     1067    return $alldirs; 
     1068} 
    10471069?> 
Note: See TracChangeset for help on using the changeset viewer.