1 | <?php |
||
6 | class FileChangesHelper |
||
7 | { |
||
8 | /** |
||
9 | * Create the directory if it doesn't exist. Right:0775 |
||
10 | * @param $dirPath |
||
11 | * @return bool |
||
12 | */ |
||
13 | public static function createDirectory($dirPath){ |
||
19 | |||
20 | /** |
||
21 | * Write the file. The content is already in json. |
||
22 | * @param string $path |
||
23 | * @param string $msg |
||
24 | * @return void |
||
25 | */ |
||
26 | public static function writeFile($path,$msg){ |
||
31 | |||
32 | /** |
||
33 | * Remove the file |
||
34 | */ |
||
35 | public static function removeFile(string $path): void{ |
||
38 | |||
39 | /** |
||
40 | * Save appointments with the timestamp in filename. |
||
41 | * @param string $filePath |
||
42 | * @param string $contents |
||
43 | * @return void |
||
44 | */ |
||
45 | public static function saveAppointmentsFileByHistory($filePath,$contents){ |
||
55 | |||
56 | /** |
||
57 | * Get the content from a file. |
||
58 | * @param $path |
||
59 | * @return string |
||
60 | */ |
||
61 | public static function getContentFile($path){ |
||
76 | |||
77 | /** |
||
78 | * Get the content from a json file by decoding. |
||
79 | * @param string $path |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public static function getJsonContentFromFile($path){ |
||
86 | |||
87 | /** |
||
88 | * Get an file list of appointments by eventCode |
||
89 | * @param string $eventCode |
||
90 | * @param string $pathDir |
||
91 | * @return array |
||
92 | */ |
||
93 | public static function getFilesListHistoryAppointmentsByEventCode($eventCode,$pathDir){ |
||
103 | |||
104 | /** |
||
105 | * Get the last list of appointments. |
||
106 | * @param string $eventCode |
||
107 | * @param string $pathDir |
||
108 | * @return string |
||
109 | */ |
||
110 | public static function getTheLastAppointmentsSaved($eventCode,$pathDir){ |
||
114 | |||
115 | public static function checkDirectory(string $pathDir): string |
||
128 | |||
129 | public static function commandIsLocked(string $pathDir): bool |
||
133 | |||
134 | public static function lockCommand(string $pathDir): void |
||
140 | |||
141 | public static function unlockCommand(string $pathDir): void |
||
147 | } |