core icon indicating copy to clipboard operation
core copied to clipboard

After switching to Postgresql changing any activity checkbox checks all of the boxes

Open alankeny opened this issue 10 years ago • 2 comments

Steps to reproduce

  1. Install OwnCloud 9.0 from the Centos 7 repository
  2. Convert the database from sqlite to pgsql
  3. Login as any user
  4. Navigate to the Personal > Activity options
  5. Change any of the activity checkboxes
  6. Reload the page

Expected behaviour

Only the options I left checked should be checked.

Actual behaviour

All of the options are checked in the Activity user interface. The table oc_preferences contains a mix of 1 for true and f for false where the f values are showing as checked in the user interface.

owncloud=> select * from oc_preferences where appid = 'activity' order by configkey asc;

 userid |  appid   |           configkey           | configvalue 
--------+----------+-------------------------------+-------------
 jsmith | activity | notify_email_comments         | f
 jsmith | activity | notify_email_file_changed     | f
 jsmith | activity | notify_email_file_created     | 1
 jsmith | activity | notify_email_file_deleted     | f
 jsmith | activity | notify_email_file_restored    | f
 jsmith | activity | notify_email_files_favorites  | f
 jsmith | activity | notify_email_public_links     | f
 jsmith | activity | notify_email_remote_share     | 1
 jsmith | activity | notify_email_shared           | 1
 jsmith | activity | notify_email_systemtags       | f
 jsmith | activity | notify_setting_batchtime      | 3600
 jsmith | activity | notify_setting_self           | t
 jsmith | activity | notify_setting_selfemail      | f
 jsmith | activity | notify_stream_comments        | 1
 jsmith | activity | notify_stream_file_changed    | 1
 jsmith | activity | notify_stream_file_created    | 1
 jsmith | activity | notify_stream_file_deleted    | 1
 jsmith | activity | notify_stream_file_restored   | 1
 jsmith | activity | notify_stream_files_favorites | f
 jsmith | activity | notify_stream_public_links    | 1
 jsmith | activity | notify_stream_remote_share    | 1
 jsmith | activity | notify_stream_shared          | 1
 jsmith | activity | notify_stream_systemtags      | 1
(23 rows)

Server configuration

Operating system: CentOS Linux release 7.2.1511

Web server: Apache 2.4.6-40.el7.centos

Database: Postgresql 9.2.15-1.el7_2

PHP version: 5.4.16-36.el7_1

ownCloud version: ownCloud 9.0.0 (stable)

Updated from an older ownCloud or fresh install: Fresh install

Where did you install ownCloud from: Centos 7 Repository

Signing status (ownCloud 9.0 and above):

No errors have been found.

List of activated apps:

Enabled:
  - activity: 2.2.1
  - comments: 0.2
  - dav: 0.1.5
  - documents: 0.12.0
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_external: 0.5.2
  - files_pdfviewer: 0.8
  - 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
  - notifications: 0.2.3
  - provisioning_api: 0.4.1
  - systemtags: 0.2
  - templateeditor: 0.1
  - updatenotification: 0.1.0
  - user_external: 0.4
Disabled:
  - calendar
  - contacts
  - encryption
  - external
  - user_ldap

The content of config/config.php:

{
    "system": {
        "instanceid": "ocec1k9m3h32",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "owncloud.example.net"
        ],
        "datadirectory": "\/home\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/owncloud.example.net",
        "dbtype": "pgsql",
        "dbname": "owncloud",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "127.0.0.1",
        "dbtableprefix": "oc_",
        "version": "9.0.0.19",
        "logtimezone": "UTC",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APC",
        "redis": {
            "host": "localhost",
            "port": 6379,
            "timeout": 0
        },
        "mail_smtpmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "enable_previews": true,
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "preview_office_cl_parameters": " ",
        "maintenance": false,
        "loglevel": 2,
        "updatechecker": false
    }
}

alankeny avatar Apr 03 '16 21:04 alankeny

Seems like we can not store booleans in the preference table. Failing test scenario:

    public function testGetUserValueBoolean() {
        $config = $this->getConfig();

        $config->setUserValue('userGetUnset', 'appGetUnset', 'keyGetUnset1', false);
        $config->setUserValue('userGetUnset', 'appGetUnset', 'keyGetUnset2', true);

        $config = $this->getConfig();
        $this->assertEquals(false, $config->getUserValue('userGetUnset', 'appGetUnset', 'keyGetUnset1'));
        $this->assertEquals(true, $config->getUserValue('userGetUnset', 'appGetUnset', 'keyGetUnset2'));
    }

So I will fix this in the activity app so it only stores integers and then casts the value to bool when returning.

nickvergessen avatar Apr 04 '16 14:04 nickvergessen

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[bot] avatar Aug 05 '19 05:08 lock[bot]