Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36381

Problems editing memcache configuration

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: Caching
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as a admin.
      2. Browse to Settings > Plugins > Caching configuration.
      3. Repeat these steps for each of the following: file, memcache, memcached, and mongodb.
        1. Add an instance of the store
        2. Edit the instance of the store. Make sure the values you entered when you created it are still there.
        3. Change something and save the form.
        4. Edit it again and make sure the change you made is shown.

      Worth noting is that you don't actually need to use the cache instances.
      In order to add instances you need the PHP extensions loaded, installation should be simple for memcache and mongodb.
      For those on Ubuntu it'll be something like this, depending upon how you installed things.

      sudo aptitude install mongodb memcached php5-memcache php5-memcached
      sudo pecl install mongo

      Show
      Log in as a admin. Browse to Settings > Plugins > Caching configuration. Repeat these steps for each of the following: file, memcache, memcached, and mongodb. Add an instance of the store Edit the instance of the store. Make sure the values you entered when you created it are still there. Change something and save the form. Edit it again and make sure the change you made is shown. Worth noting is that you don't actually need to use the cache instances. In order to add instances you need the PHP extensions loaded, installation should be simple for memcache and mongodb. For those on Ubuntu it'll be something like this, depending upon how you installed things. sudo aptitude install mongodb memcached php5-memcache php5-memcached sudo pecl install mongo
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      wip-MDL-36381-m24

      Description

      1. Go to Home ▶ Site administration ▶ Plugins ▶ Caching ▶ Configuration
      2. Add a memcache instance with some config
      3. Click edit store on the added instance

      Two problems:

      1. The configuration for 'Servers' doesn't seem to be present
      2. When submitting get:
        A required parameter (store) was missing

      More information about this error

      Debug info:
      Error code: missingparam
      Stack trace:
      line 467 of /lib/setuplib.php: moodle_exception thrown
      line 523 of /lib/moodlelib.php: call to print_error()
      line 79 of /cache/admin.php: call to required_param()

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            samhemelryk Sam Hemelryk added a comment -

            Hmmm, this affects all plugins that allow instances to be added, not just memcache.
            I forgot in the process to add a means for stores being edited to set data against the form.

            I've created a patch that adds this functionality.

            Many thanks
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Hmmm, this affects all plugins that allow instances to be added, not just memcache. I forgot in the process to add a means for stores being edited to set data against the form. I've created a patch that adds this functionality. Many thanks Sam
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Making a blocker because this needs to be fixed before 2.4

            Show
            samhemelryk Sam Hemelryk added a comment - Making a blocker because this needs to be fixed before 2.4
            Hide
            rajeshtaneja Rajesh Taneja added a comment -

            Thanks Sam,

            Patch looks great. Although you might want to consider few minor things:

            1. config for usesafevalue is not considered in mongodb https://github.com/samhemelryk/moodle/compare/086f5f9...wip-MDL-36381-m24#L4R433
            2. mongodb/lib.php $server says "The server connection string. Comma separated values.". Just wondering how multiple servers will be handled. (Not related)
            3. renaming $class and $form might help readability.
              https://github.com/samhemelryk/moodle/compare/086f5f9...wip-MDL-36381-m24#L0R783

            Please add test Instructions and probably add instructions for testing on all supported cache-stores.

            Show
            rajeshtaneja Rajesh Taneja added a comment - Thanks Sam, Patch looks great. Although you might want to consider few minor things: config for usesafevalue is not considered in mongodb https://github.com/samhemelryk/moodle/compare/086f5f9...wip-MDL-36381-m24#L4R433 mongodb/lib.php $server says "The server connection string. Comma separated values.". Just wondering how multiple servers will be handled. (Not related) renaming $class and $form might help readability. https://github.com/samhemelryk/moodle/compare/086f5f9...wip-MDL-36381-m24#L0R783 Please add test Instructions and probably add instructions for testing on all supported cache-stores.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks for looking at this Raj.

            Regrading the points you raised:

            1. usesafevalue is now handled correctly.
            2. We should get Helen to look over the strings at some point I think would be best.
            3. $class is used frequently throughout the cache and cache stores, at this point I'd rather not be renaming it. I have however renamed $form to $editform now.

            Putting up for integration review now

            Many thanks
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks for looking at this Raj. Regrading the points you raised: usesafevalue is now handled correctly. We should get Helen to look over the strings at some point I think would be best. $class is used frequently throughout the cache and cache stores, at this point I'd rather not be renaming it. I have however renamed $form to $editform now. Putting up for integration review now Many thanks Sam
            Hide
            poltawski Dan Poltawski added a comment -

            Thanks Sam, i've integrated that now.

            Show
            poltawski Dan Poltawski added a comment - Thanks Sam, i've integrated that now.
            Hide
            dmonllao David Monllaó added a comment -

            All works as expected except memcached "Use compression" parameter, if I change the value to 'No' it continues showing 'Yes' when opening the form again. Failing it.

            Show
            dmonllao David Monllaó added a comment - All works as expected except memcached "Use compression" parameter, if I change the value to 'No' it continues showing 'Yes' when opening the form again. Failing it.
            Hide
            poltawski Dan Poltawski added a comment -

            I tried to save Sam some time and fix this, but actually I can't work it out quickly!

            Show
            poltawski Dan Poltawski added a comment - I tried to save Sam some time and fix this, but actually I can't work it out quickly!
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Aha, thanks for picking that up David.
            The problem is the use of empty for fields where an empty value is a valid value, checkboxes/bools etc.

            Dan I've pushed up a commit on top of my branch now to address this issue. It fixes not just the Use compression setting but all other bool settings that would be affected in the same way.

            // Diff:
            https://github.com/samhemelryk/moodle/commit/e0c11b38e2c6f402ec2e51e9954c66b4d85f7e8c
             
            // To pull:
            git fetch git://github.com/samhemelryk/moodle.git wip-MDL-36381-m24 && git cherry-pick FETCH_HEAD

            Cheers
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Aha, thanks for picking that up David. The problem is the use of empty for fields where an empty value is a valid value, checkboxes/bools etc. Dan I've pushed up a commit on top of my branch now to address this issue. It fixes not just the Use compression setting but all other bool settings that would be affected in the same way. // Diff: https://github.com/samhemelryk/moodle/commit/e0c11b38e2c6f402ec2e51e9954c66b4d85f7e8c   // To pull: git fetch git://github.com/samhemelryk/moodle.git wip-MDL-36381-m24 && git cherry-pick FETCH_HEAD Cheers Sam
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            (new commit applied and reset to testing)

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - (new commit applied and reset to testing)
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Eloy

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Eloy
            Hide
            dmonllao David Monllaó added a comment -

            It passes.

            I've tried to set a '!!!' username in a mongo store and it's cleaned, but it works as expected with regular alphanumericext caracters.

            Show
            dmonllao David Monllaó added a comment - It passes. I've tried to set a '!!!' username in a mongo store and it's cleaned, but it works as expected with regular alphanumericext caracters.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Amazed. Inspired. Grateful. That’s how your generosity makes me feel.

            (not really)

            Closing, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Amazed. Inspired. Grateful. That’s how your generosity makes me feel. (not really) Closing, thanks!

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/12