Skip to content

Commit

Permalink
[plugin:ajaxtree] change fwrite() to file_put_contents()
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Apr 1, 2014
1 parent 75922ec commit 0fd3ac1
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions xoops_trust_path/modules/xpwiki/plugin/ajaxtree.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,7 @@ function plugin_ajaxtree_read_file($filename)

function plugin_ajaxtree_write_file($filename, $data)
{
$fp = fopen($filename, is_file($filename) ? 'r+b' : 'wb');
if ($fp === false) {
return false;
}
flock($fp, LOCK_EX);
$last = ignore_user_abort(1);
rewind($fp);
fwrite($fp, $data);
fflush($fp);
ftruncate($fp, ftell($fp));
ignore_user_abort($last);
flock($fp, LOCK_UN);
fclose($fp);
return true;
return file_put_contents($filename, $data, LOCK_EX);
}

function cache_clear() {
Expand Down

0 comments on commit 0fd3ac1

Please sign in to comment.