Lines Matching refs:filepath

30      * @param string $filepath Path to JSON file
33 public static function readJson($filepath) { argument
34 if (!file_exists($filepath)) {
38 $handle = @fopen($filepath, 'r');
40 self::logError("Failed to open file for reading: $filepath");
56 self::logError("Failed to acquire read lock: $filepath");
74 self::logError("JSON decode error in $filepath: " . json_last_error_msg());
87 * @param string $filepath Path to JSON file
91 public static function writeJson($filepath, array $data) { argument
92 $dir = dirname($filepath);
101 $tempFile = $dir . '/.tmp_' . uniqid() . '_' . basename($filepath);
138 if (file_exists($filepath)) {
139 $targetHandle = @fopen($filepath, 'r+');
154 self::logError("Failed to lock target file: $filepath");
159 $renamed = @rename($tempFile, $filepath);
166 self::logError("Failed to rename temp to target: $filepath");
171 if (!@rename($tempFile, $filepath)) {
173 self::logError("Failed to rename (no handle): $filepath");
179 if (!@rename($tempFile, $filepath)) {
181 self::logError("Failed to rename new file: $filepath");
192 * @param string $filepath Path to file
195 public static function delete($filepath) { argument
196 if (!file_exists($filepath)) {
200 $handle = @fopen($filepath, 'r+');
203 return @unlink($filepath);
221 return @unlink($filepath);
240 * @param string $filepath Path to file
244 public static function readText($filepath, $default = '') { argument
245 if (!file_exists($filepath)) {
248 $contents = @file_get_contents($filepath);
255 * @param string $filepath Path to file
259 public static function writeText($filepath, $content) { argument
260 $dir = dirname($filepath);
267 $tempFile = $dir . '/.tmp_' . uniqid() . '_' . basename($filepath);
273 if (!@rename($tempFile, $filepath)) {