| | <?php |
| |
|
| | namespace Kanboard\Model; |
| |
|
| | use Kanboard\Core\Security\Token; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class ConfigModel extends SettingModel |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function get($name, $default_value = '') |
| | { |
| | $options = $this->memoryCache->proxy($this, 'getAll'); |
| | return isset($options[$name]) && $options[$name] !== '' ? $options[$name] : $default_value; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function optimizeDatabase() |
| | { |
| | return $this->db->getConnection()->exec('VACUUM'); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function downloadDatabase() |
| | { |
| | return gzencode(file_get_contents(DB_FILENAME)); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function uploadDatabase($file) |
| | { |
| | $this->db->closeConnection(); |
| | return file_put_contents(DB_FILENAME, gzdecode(file_get_contents($file))) !== false; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getDatabaseSize() |
| | { |
| | return DB_DRIVER === 'sqlite' ? filesize(DB_FILENAME) : 0; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getDatabaseOptions() |
| | { |
| | if (DB_DRIVER === 'sqlite') { |
| | return [ |
| | 'journal_mode' => $this->db->getConnection()->query('PRAGMA journal_mode')->fetchColumn(), |
| | 'wal_autocheckpoint' => $this->db->getConnection()->query('PRAGMA wal_autocheckpoint')->fetchColumn(), |
| | 'synchronous' => $this->db->getConnection()->query('PRAGMA synchronous')->fetchColumn(), |
| | 'busy_timeout' => $this->db->getConnection()->query('PRAGMA busy_timeout')->fetchColumn(), |
| | ]; |
| | } |
| |
|
| | return []; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function regenerateToken($option) |
| | { |
| | return $this->save(array($option => Token::getToken())); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function prepare(array $values) |
| | { |
| | if (! empty($values['application_url']) && substr($values['application_url'], -1) !== '/') { |
| | $values['application_url'] = $values['application_url'].'/'; |
| | } |
| |
|
| | return $values; |
| | } |
| | } |
| |
|