MCPcopy Create free account
hub / github.com/error311/FileRise / saveRaw

Method saveRaw

src/FileRise/Storage/SourcesConfig.php:487–510  ·  view source on GitHub ↗
(array $cfg)

Source from the content-addressed store, hash-verified

485 }
486
487 private static function saveRaw(array $cfg): bool
488 {
489 $path = self::filePath();
490 if ($path === '') {
491 return false;
492 }
493 self::ensureDir();
494
495 $json = json_encode($cfg, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
496 if ($json === false) {
497 return false;
498 }
499
500 $tmp = $path . '.tmp';
501 if (@file_put_contents($tmp, $json, LOCK_EX) === false) {
502 return false;
503 }
504 if (!@rename($tmp, $path)) {
505 @unlink($tmp);
506 return false;
507 }
508 @chmod($path, 0644);
509 return true;
510 }
511}

Callers 3

saveEnabledMethod · 0.95
upsertSourceMethod · 0.95
deleteSourceMethod · 0.95

Calls 2

filePathMethod · 0.95
ensureDirMethod · 0.95

Tested by

no test coverage detected