Skip to content

Commit

Permalink
file_get_contentsのタイムアウト処理追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Apr 25, 2019
1 parent 1480a02 commit 4608ffc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/utils.php
Expand Up @@ -1650,7 +1650,18 @@ function wp_filesystem_get_contents($file, $is_exfile = false, $credentials_enab
return false;
}

return file_get_contents($file);
$options = array(
'http' => array(
'method' => 'GET',
'timeout' => 2, // タイムアウト時間
)
);

if (!$is_exfile) {//ローカル
return file_get_contents($file);
} else {//外部ファイル
return file_get_contents($file, false, stream_context_create($options));
}

// if ($credentials_enable && is_request_filesystem_credentials_enable()){
// $creds = request_filesystem_credentials('', '', false, false, null);
Expand Down

0 comments on commit 4608ffc

Please sign in to comment.