Ignore:
Timestamp:
2012/02/08 13:55:06 (12 years ago)
Author:
h_yoshimoto
Message:

#1603 #1632 プラグインの管理画面を作成しました。それに伴うエンジン部分の修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/util/SC_Utils.php

    r21452 r21455  
    21352135        return true; 
    21362136    } 
     2137 
     2138    /** 
     2139     * 指定されたパスの配下を再帰的に削除. 
     2140     * 
     2141     * @param string  $path       削除対象のディレクトリまたはファイルのパス 
     2142     * @param boolean $del_myself $pathそのものを削除するか. true なら削除する. 
     2143     * @return void 
     2144     */ 
     2145    function deleteFile($path, $del_myself = true) { 
     2146        $flg = false; 
     2147        // 対象が存在するかを検証. 
     2148        if (file_exists($path) === false) { 
     2149            GC_Utils_Ex::gfPrintLog($path . " が存在しません."); 
     2150        } elseif (is_dir($path)) { 
     2151            // ディレクトリが指定された場合 
     2152            $handle = opendir($path); 
     2153            if (!$handle) { 
     2154                GC_Utils_Ex::gfPrintLog($path . " が開けませんでした."); 
     2155            } 
     2156            while (($item = readdir($handle)) !== false) { 
     2157                if ($item === '.' || $item === '..') continue; 
     2158                $cur_path = $path . '/' . $item; 
     2159                if (is_dir($cur_path)) { 
     2160                    // ディレクトリの場合、再帰処理 
     2161                    $flg = SC_Utils_Ex::deleteFile($cur_path); 
     2162                } else { 
     2163                    // ファイルの場合、unlink 
     2164                    $flg = @unlink($cur_path); 
     2165                } 
     2166            } 
     2167            closedir($handle); 
     2168            // ディレクトリを削除 
     2169            GC_Utils_Ex::gfPrintLog($path . " を削除します."); 
     2170            if ($del_myself) { 
     2171                $flg = @rmdir($path); 
     2172            } 
     2173        } else { 
     2174            // ファイルが指定された場合. 
     2175            GC_Utils_Ex::gfPrintLog($path . " を削除します."); 
     2176            $flg = @unlink($path); 
     2177        } 
     2178        return $flg; 
     2179    } 
    21372180} 
Note: See TracChangeset for help on using the changeset viewer.