Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions developer_manual/basics/storage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ The config that allows the app to set global, app and user settings can be injec
System values
-------------

System values are saved in the :file:`config/config.php` and allow the app to modify and read the global configuration:
System values are saved in the :file:`config/config.php` and allow the app to modify and read the global configuration. Please note that **setSystemValue** might throw a **OCP\HintException** when the config file is read-only.

.. code-block:: php

<?php
namespace OCA\MyApp\Service;

use \OCP\HintException;
use \OCP\IConfig;


Expand All @@ -68,7 +69,11 @@ System values are saved in the :file:`config/config.php` and allow the app to mo
}

public function setSystemValue($key, $value) {
$this->config->setSystemValue($key, $value);
try {
$this->config->setSystemValue($key, $value);
} catch (HintException $e) {
// Handle exception, e.g. when config file is read-only
}
}

}
Expand Down