Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support importing arrays using occ config:import #22877

Closed
jerrac opened this issue Mar 4, 2016 · 6 comments
Closed

Support importing arrays using occ config:import #22877

jerrac opened this issue Mar 4, 2016 · 6 comments
Assignees

Comments

@jerrac
Copy link
Contributor

jerrac commented Mar 4, 2016

Steps to reproduce

  1. Make json file with the trusted domains you want.
  2. Run the import command on the file.
    root@vm:/var/www/owncloud# sudo -u www-data /usr/bin/php occ --no-interaction config:import < testimport.json 
    Found invalid entries in root: trusted_domains
    root@vm:/var/www/owncloud# cat testimport.json 
    {
      "trusted_domains": [
      "owncloud.alpha.lab",
      "vm.alpha.lab"
      ]
     }

Expected behaviour

config.php should be updated to contain the list of domains from the json file.

Actual behaviour

The command errors.

Server configuration

Operating system: Ubuntu 14.04

Web server: apache 2.4

Database: mysql

PHP version: 5.5

ownCloud version: from git: tag v9.0.0.0RC1

Updated from an older ownCloud or fresh install: updated from 8.2.2

Where did you install ownCloud from: Git

Signing status (ownCloud 9.0 and above): no idea

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

Integrity checker has been disabled. Integrity cannot be verified.

List of activated apps:

root@vm:/var/www/owncloud# sudo -u www-data php occ app:list
Enabled:
  - comments: 0.2
  - dav: 0.1.4
  - documents: 0.12.0
  - federatedfilesharing: 0.1.0
  - files: 1.4.3
  - files_pdfviewer: 0.7
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_versions: 1.2.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 14.5.0
  - provisioning_api: 0.4.1
  - search_lucene: 0.7.0
  - systemtags: 0.2
  - updatenotification: 0.1.0
Disabled:
  - encryption
  - federation
  - files_external
  - testing
  - user_ldap

The content of config/config.php:

root@vm:/var/www/owncloud# sudo -u www-data php occ config:list system
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "vm.alpha.lab" <<<<manually added after trying to import. >>>>
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbtype": "mysql",
        "version": "9.0.0.16",
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "instanceid": "ock0ec4vz5u0",
        "maintenance": false,
        "loglevel": 2
    }
}
root@vm:/var/www/owncloud# 

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Logs

ownCloud log (data/owncloud.log)

root@vm:/var/www/owncloud# cat data/owncloud.log 
{"reqId":"CRZ+2PzBPv2ZUR4mNSl4","remoteAddr":"","app":"mysql.setup","message":"Specific user creation failed: An exception occurred while executing 'SELECT user FROM mysql.user WHERE user=?' with params [\"oc_owncloud\"]:\n\nSQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'owncloud'@'localhost' for table 'user'","level":3,"time":"2016-02-22T21:56:30+00:00"}
{"reqId":"CRZ+2PzBPv2ZUR4mNSl4","remoteAddr":"","app":"mysql.setup","message":"Database creation failed: An exception occurred while executing 'GRANT ALL PRIVILEGES ON `owncloud` . * TO 'owncloud'':\n\nSQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'owncloud'@'localhost' to database 'owncloud'","level":3,"time":"2016-02-22T21:56:30+00:00"}
{"reqId":"CRZ+2PzBPv2ZUR4mNSl4","remoteAddr":"","app":"PHP","message":"Undefined offset: 0 at \/var\/www\/owncloud\/lib\/private\/setup\/mysql.php#45","level":3,"time":"2016-02-22T21:56:30+00:00"}
{"reqId":"rnnIBnmKK6K+EYF7Maek","remoteAddr":"","app":"core","message":"starting upgrade from 8.2.2.2 to 9.0.0.16","level":0,"time":"2016-03-04T19:40:00+00:00","method":"--","url":"--"}
{"reqId":"rnnIBnmKK6K+EYF7Maek","remoteAddr":"","app":"PHP","message":"file_put_contents(\/var\/www\/owncloud\/data\/.htaccess): failed to open stream: Permission denied at \/var\/www\/owncloud\/lib\/private\/setup.php#458","level":3,"time":"2016-03-04T19:40:00+00:00","method":"--","url":"--"}
{"reqId":"rnnIBnmKK6K+EYF7Maek","remoteAddr":"","app":"PHP","message":"Undefined index: version at \/var\/www\/owncloud\/lib\/private\/installer.php#392","level":3,"time":"2016-03-04T19:40:06+00:00","method":"--","url":"--"}
{"reqId":"rnnIBnmKK6K+EYF7Maek","remoteAddr":"","app":"core","message":"Exception: {\"Exception\":\"Exception\",\"Message\":\"App can't be installed because the version in info.xml is not the same as the version reported from the app store\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(201): OC_Installer::checkAppsIntegrity(Array, '\\\/tmp\\\/oc_tmp_hqx...', '\\\/tmp\\\/oc_tmp_7xb...', false)\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(254): OC_Installer::updateApp(Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(528): OC_Installer::updateAppByOCSId('168709')\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(332): OC\\\\Updater->upgradeAppStoreApps(Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(215): OC\\\\Updater->doUpgrade('9.0.0.16', '8.2.2.2')\\n#5 \\\/var\\\/www\\\/owncloud\\\/core\\\/command\\\/upgrade.php(225): OC\\\\Updater->upgrade()\\n#6 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(259): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#7 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(840): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#8 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(192): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#9 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(123): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#10 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(145): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#11 \\\/var\\\/www\\\/owncloud\\\/console.php(88): OC\\\\Console\\\\Application->run()\\n#12 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#13 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php\",\"Line\":396}","level":3,"time":"2016-03-04T19:40:06+00:00","method":"--","url":"--"}
{"reqId":"rnnIBnmKK6K+EYF7Maek","remoteAddr":"","app":"no app in context","message":"Exception: {\"Exception\":\"DomainException\",\"Message\":\"Contacts tables are missing. Nothing to do.\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/migration\\\/migrateaddressbooks.php(74): OCA\\\\Dav\\\\Migration\\\\AddressBookAdapter->setup()\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/application.php(180): OCA\\\\Dav\\\\Migration\\\\MigrateAddressbooks->setup()\\n#2 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/install.php(26): OCA\\\\Dav\\\\AppInfo\\\\Application->migrateAddressbooks()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(616): include('\\\/var\\\/www\\\/ownclo...')\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(567): OC_Installer::includeAppScript('\\\/var\\\/www\\\/ownclo...')\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(541): OC_Installer::installShippedApp('dav')\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(336): OC_Installer::installShippedApps()\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(215): OC\\\\Updater->doUpgrade('9.0.0.16', '8.2.2.2')\\n#8 \\\/var\\\/www\\\/owncloud\\\/core\\\/command\\\/upgrade.php(225): OC\\\\Updater->upgrade()\\n#9 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(259): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#10 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(840): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(192): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(123): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(145): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#14 \\\/var\\\/www\\\/owncloud\\\/console.php(88): OC\\\\Console\\\\Application->run()\\n#15 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#16 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/migration\\\/addressbookadapter.php\",\"Line\":72}","level":3,"time":"2016-03-04T19:40:06+00:00","method":"--","url":"--"}
{"reqId":"rnnIBnmKK6K+EYF7Maek","remoteAddr":"","app":"no app in context","message":"Exception: {\"Exception\":\"DomainException\",\"Message\":\"Calendar tables are missing. Nothing to do.\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/migration\\\/migratecalendars.php(76): OCA\\\\Dav\\\\Migration\\\\CalendarAdapter->setup()\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/application.php(196): OCA\\\\Dav\\\\Migration\\\\MigrateCalendars->setup()\\n#2 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/install.php(27): OCA\\\\Dav\\\\AppInfo\\\\Application->migrateCalendars()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(616): include('\\\/var\\\/www\\\/ownclo...')\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(567): OC_Installer::includeAppScript('\\\/var\\\/www\\\/ownclo...')\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/installer.php(541): OC_Installer::installShippedApp('dav')\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(336): OC_Installer::installShippedApps()\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/updater.php(215): OC\\\\Updater->doUpgrade('9.0.0.16', '8.2.2.2')\\n#8 \\\/var\\\/www\\\/owncloud\\\/core\\\/command\\\/upgrade.php(225): OC\\\\Updater->upgrade()\\n#9 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Command\\\/Command.php(259): OC\\\\Core\\\\Command\\\\Upgrade->execute(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#10 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(840): Symfony\\\\Component\\\\Console\\\\Command\\\\Command->run(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#11 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(192): Symfony\\\\Component\\\\Console\\\\Application->doRunCommand(Object(OC\\\\Core\\\\Command\\\\Upgrade), Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#12 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/symfony\\\/console\\\/Application.php(123): Symfony\\\\Component\\\\Console\\\\Application->doRun(Object(Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput), Object(Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput))\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/console\\\/application.php(145): Symfony\\\\Component\\\\Console\\\\Application->run(NULL, NULL)\\n#14 \\\/var\\\/www\\\/owncloud\\\/console.php(88): OC\\\\Console\\\\Application->run()\\n#15 \\\/var\\\/www\\\/owncloud\\\/occ(11): require_once('\\\/var\\\/www\\\/ownclo...')\\n#16 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/migration\\\/calendaradapter.php\",\"Line\":68}","level":3,"time":"2016-03-04T19:40:06+00:00","method":"--","url":"--"}
{"reqId":"esjsX6m3mZsjlmN+QQ8Y","remoteAddr":"192.168.88.200","app":"core","message":"Trusted domain error. \"192.168.88.200\" tried to access using \"vm.alpha.lab\" as host.","level":2,"time":"2016-03-04T19:44:17+00:00"}
{"reqId":"TOWJQOUA0ULOZDYf9hFp","remoteAddr":"192.168.88.200","app":"core","message":"Trusted domain error. \"192.168.88.200\" tried to access using \"vm.alpha.lab\" as host.","level":2,"time":"2016-03-04T19:44:17+00:00"}
{"reqId":"0ZrLooHsG1g8Su4XwNqF","remoteAddr":"192.168.88.200","app":"core","message":"Trusted domain error. \"192.168.88.200\" tried to access using \"vm.alpha.lab\" as host.","level":2,"time":"2016-03-04T19:44:18+00:00"}
{"reqId":"83f5v17b3L2RkirNH+gE","remoteAddr":"192.168.88.200","app":"core","message":"Trusted domain error. \"192.168.88.200\" tried to access using \"vm.alpha.lab\" as host.","level":2,"time":"2016-03-04T19:59:18+00:00"}

@jerrac
Copy link
Contributor Author

jerrac commented Mar 4, 2016

After reading #22131 I thought that version 9 would support importing arrays. Is that only with the config:system:set command?

@LukasReschke LukasReschke changed the title Cannot update trusted_domains with config:import Support importing arrays using occ config:import Mar 4, 2016
@LukasReschke
Copy link
Member

After reading #22131 I thought that version 9 would support importing arrays. Is that only with the config:system:set command?

From what I can tell from the source code: Yes. Changed the title thus.

cc @nickvergessen As you seem to have written the importer.

@LukasReschke LukasReschke added this to the backlog milestone Mar 4, 2016
@nickvergessen
Copy link
Contributor

The correct syntax is:

{
  "system": {
    "trusted_domains": [
      "owncloud.alpha.lab",
      "vm.alpha.lab"
    ]
  }
}

The system element is required to tell the command where to store the config (app config or system config).
Youc an also see that when listing your config with occ config:list

@nickvergessen
Copy link
Contributor

But in this case you can also use the delete+set command:

./occ config:system:delete trusted_domains
./occ config:system:set trusted_domains 0 --value="owncloud.alpha.lab"
./occ config:system:set trusted_domains 1 --value="vm.alpha.lab"

@jerrac
Copy link
Contributor Author

jerrac commented Mar 7, 2016

@nickvergessen Thanks! I totally did not realize that was the syntax I needed to use.

@lock
Copy link

lock bot commented Aug 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants