]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - application/updater/UpdaterUtils.php
3 namespace Shaarli\Updater
;
8 * Read the updates file, and return already done updates.
10 * @param string $updatesFilepath Updates file path.
12 * @return array Already done update methods.
14 public static function readUpdatesFile($updatesFilepath)
16 if (! empty($updatesFilepath) && is_file($updatesFilepath)) {
17 $content = file_get_contents($updatesFilepath);
18 if (! empty($content)) {
19 return explode(';', $content);
28 * @param string $updatesFilepath Updates file path.
29 * @param array $updates Updates array to write.
31 * @throws \Exception Couldn't write version number.
33 public static function writeUpdatesFile($updatesFilepath, $updates)
35 if (empty($updatesFilepath)) {
36 throw new \
Exception('Updates file path is not set, can\'t write updates.');
39 $res = file_put_contents($updatesFilepath, implode(';', $updates));
41 throw new \
Exception('Unable to write updates in ' . $updatesFilepath . '.');