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

Method write

src/FileRise/Domain/FolderCrypto.php:84–105  ·  view source on GitHub ↗
(array $doc)

Source from the content-addressed store, hash-verified

82 }
83
84 private static function write(array $doc): bool
85 {
86 $path = self::filePath();
87 $dir = dirname($path);
88 if (!is_dir($dir)) {
89 @mkdir($dir, 0775, true);
90 }
91
92 $json = json_encode($doc, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
93 if (!is_string($json)) {
94 return false;
95 }
96
97 $ok = @file_put_contents($path, $json, LOCK_EX) !== false;
98 if ($ok) {
99 @chmod($path, 0664);
100 self::$cache = $doc;
101 self::$cacheMtime = is_file($path) ? (int)@filemtime($path) : 0;
102 self::$cachePath = $path;
103 }
104 return $ok;
105 }
106
107 public static function isEncrypted(string $folder): bool
108 {

Callers 13

setJobMethod · 0.95
setEncryptedMethod · 0.95
migrateSubtreeMethod · 0.95
removeSubtreeMethod · 0.95
callbackMethod · 0.45
deleteFilesMethod · 0.45
saveFileMethod · 0.45
restoreFilesMethod · 0.45
deleteTrashFilesMethod · 0.45

Calls 1

filePathMethod · 0.95

Tested by

no test coverage detected