Ignore:
Timestamp:
2012/01/16 22:49:05 (14 years ago)
Author:
Seasoft
Message:

#1610 (PHP のタイムアウトを延長する処理をユーティリティクラスへ移動)

File:
1 edited

Legend:

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

    r21374 r21398  
    21682168        return preg_match($pattern, $url) >= 1; 
    21692169    } 
     2170 
     2171    /** 
     2172     * PHP のタイムアウトを延長する 
     2173     * 
     2174     * ループの中で呼び出すことを意図している。 
     2175     * 暴走スレッドが残留する確率を軽減するため、set_time_limit(0) とはしていない。 
     2176     * @param integer $seconds 最大実行時間を延長する秒数。 
     2177     * @return boolean 成功=true, 失敗=false 
     2178     */ 
     2179    function extendTimeOut($seconds = null) { 
     2180        $safe_mode = (boolean)ini_get('safe_mode'); 
     2181        if ($safe_mode) return false; 
     2182 
     2183        if (is_null($seconds)) { 
     2184            $seconds 
     2185                = is_numeric(ini_get('max_execution_time')) 
     2186                ? intval(ini_get('max_execution_time')) 
     2187                : intval(get_cfg_var('max_execution_time')) 
     2188            ; 
     2189        } 
     2190 
     2191        // タイムアウトをリセット 
     2192        set_time_limit($seconds); 
     2193 
     2194        return true; 
     2195    } 
    21702196} 
    21712197?> 
Note: See TracChangeset for help on using the changeset viewer.