Browse Source

add a script to import config

develop
Simon Vieille 1 month ago
parent
commit
9f7d6c931e
Signed by: deblan GPG Key ID: 03383D15A1D31745
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      bin/import_config.php

+ 24
- 0
bin/import_config.php View File

@ -0,0 +1,24 @@
<?php
/**
* Imports a json configuration into a sqlite database.
*
* Usage:
* php bin/import_config.php /path/to/config.json /path/to/owncloud.db
*/
$configFile = $argv[1];
$databaseFile = $argv[2];
$content = file_get_contents($configFile);
$config = json_decode($content, true);
$pdo = new \Pdo(sprintf('sqlite:%s', $databaseFile));
$stmt = $pdo->prepare('UPDATE oc_appconfig SET configvalue=:value WHERE configkey=:key and appid=:appId');
foreach ($config as $key => $value) {
$stmt->execute([
'appId' => 'side_menu',
'key' => $key,
'value' => $value,
]);
}

Loading…
Cancel
Save