diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/FileUtils.php | 2 | ||||
-rw-r--r-- | application/LinkDB.php | 3 | ||||
-rw-r--r-- | application/Updater.php | 1 | ||||
-rw-r--r-- | application/config/ConfigJson.php | 2 | ||||
-rw-r--r-- | application/config/ConfigManager.php | 2 | ||||
-rw-r--r-- | application/config/ConfigPhp.php | 2 | ||||
-rw-r--r-- | application/exceptions/IOException.php | 5 |
7 files changed, 13 insertions, 4 deletions
diff --git a/application/FileUtils.php b/application/FileUtils.php index b89ea12b..ba409821 100644 --- a/application/FileUtils.php +++ b/application/FileUtils.php | |||
@@ -1,5 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Shaarli\Exceptions\IOException; | ||
4 | |||
3 | require_once 'exceptions/IOException.php'; | 5 | require_once 'exceptions/IOException.php'; |
4 | 6 | ||
5 | /** | 7 | /** |
diff --git a/application/LinkDB.php b/application/LinkDB.php index 4bbc2950..87a53e2e 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -1,4 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
3 | use Shaarli\Exceptions\IOException; | ||
4 | |||
2 | /** | 5 | /** |
3 | * Data storage for links. | 6 | * Data storage for links. |
4 | * | 7 | * |
diff --git a/application/Updater.php b/application/Updater.php index 6b94c5e3..c0d541b4 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -2,6 +2,7 @@ | |||
2 | use Shaarli\Config\ConfigJson; | 2 | use Shaarli\Config\ConfigJson; |
3 | use Shaarli\Config\ConfigPhp; | 3 | use Shaarli\Config\ConfigPhp; |
4 | use Shaarli\Config\ConfigManager; | 4 | use Shaarli\Config\ConfigManager; |
5 | use Shaarli\Exceptions\IOException; | ||
5 | use Shaarli\Thumbnailer; | 6 | use Shaarli\Thumbnailer; |
6 | 7 | ||
7 | /** | 8 | /** |
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php index 8c8d5610..4509357c 100644 --- a/application/config/ConfigJson.php +++ b/application/config/ConfigJson.php | |||
@@ -47,7 +47,7 @@ class ConfigJson implements ConfigIO | |||
47 | $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; | 47 | $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; |
48 | $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); | 48 | $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); |
49 | if (!file_put_contents($filepath, $data)) { | 49 | if (!file_put_contents($filepath, $data)) { |
50 | throw new \IOException( | 50 | throw new \Shaarli\Exceptions\IOException( |
51 | $filepath, | 51 | $filepath, |
52 | t('Shaarli could not create the config file. '. | 52 | t('Shaarli could not create the config file. '. |
53 | 'Please make sure Shaarli has the right to write in the folder is it installed in.') | 53 | 'Please make sure Shaarli has the right to write in the folder is it installed in.') |
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index 32aaea48..e6c35073 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php | |||
@@ -207,7 +207,7 @@ class ConfigManager | |||
207 | * | 207 | * |
208 | * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf. | 208 | * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf. |
209 | * @throws UnauthorizedConfigException: user is not authorize to change configuration. | 209 | * @throws UnauthorizedConfigException: user is not authorize to change configuration. |
210 | * @throws \IOException: an error occurred while writing the new config file. | 210 | * @throws \Shaarli\Exceptions\IOException: an error occurred while writing the new config file. |
211 | */ | 211 | */ |
212 | public function write($isLoggedIn) | 212 | public function write($isLoggedIn) |
213 | { | 213 | { |
diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index 9625fe1a..9ed5d31f 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php | |||
@@ -124,7 +124,7 @@ class ConfigPhp implements ConfigIO | |||
124 | if (!file_put_contents($filepath, $configStr) | 124 | if (!file_put_contents($filepath, $configStr) |
125 | || strcmp(file_get_contents($filepath), $configStr) != 0 | 125 | || strcmp(file_get_contents($filepath), $configStr) != 0 |
126 | ) { | 126 | ) { |
127 | throw new \IOException( | 127 | throw new \Shaarli\Exceptions\IOException( |
128 | $filepath, | 128 | $filepath, |
129 | t('Shaarli could not create the config file. '. | 129 | t('Shaarli could not create the config file. '. |
130 | 'Please make sure Shaarli has the right to write in the folder is it installed in.') | 130 | 'Please make sure Shaarli has the right to write in the folder is it installed in.') |
diff --git a/application/exceptions/IOException.php b/application/exceptions/IOException.php index 18e46b77..2aa25e5c 100644 --- a/application/exceptions/IOException.php +++ b/application/exceptions/IOException.php | |||
@@ -1,4 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Exceptions; | ||
3 | |||
4 | use Exception; | ||
2 | 5 | ||
3 | /** | 6 | /** |
4 | * Exception class thrown when a filesystem access failure happens | 7 | * Exception class thrown when a filesystem access failure happens |
@@ -17,6 +20,6 @@ class IOException extends Exception | |||
17 | { | 20 | { |
18 | $this->path = $path; | 21 | $this->path = $path; |
19 | $this->message = empty($message) ? t('Error accessing') : $message; | 22 | $this->message = empty($message) ? t('Error accessing') : $message; |
20 | $this->message .= ' "' . $this->path .'"'; | 23 | $this->message .= ' "' . $this->path . '"'; |
21 | } | 24 | } |
22 | } | 25 | } |