Function safe_file_write
Writes data to a file, optionally making a backup, while avoiding race conditions.
Package: SMF
Copyright: 2020 Simple Machines and individual contributors
License: BSD
Author: Simple Machines https://www.simplemachines.org
Located at Sources/Subs-Admin.php
Copyright: 2020 Simple Machines and individual contributors
License: BSD
Author: Simple Machines https://www.simplemachines.org
Located at Sources/Subs-Admin.php
string |
$file |
The filepath of the file where the data should be written. |
string |
$data |
The data to be written to $file. |
string |
$backup_file = null |
The filepath where the backup should be saved. Default null. |
integer |
$mtime = null |
If modification time of $file is more recent than this Unix timestamp, the write operation will abort. Defaults to time that the script started execution. |
boolean |
$append = false |
If true, the data will be appended instead of overwriting the existing content of the file. Default false. |
boolean
|
Whether the write operation succeeded or not. |