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

Add serialize/deserialize to admin_settings class

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE

      Description

      All settings are stored in database in serialized form. Default config value should be serialized too. But when submitting the form with complex settings are data are in different form - also arrays. I think I found several problems in your implementation (and fix some of them), but the code is not easy to read and understand.

      Proposal:
      1/ add method serialize/deserialize to class admin_setting - with deafult implemenation just returning data as text
      2/ always store defaults in serialized form (only strings - the same as in database)
      2/ make get_setting() to return deserialized form (arrays, strings, etc)
      3/ decide if write_setting() should accept only deserialized, serialized, or both forms
      4/ fix all uses of write_setting() accorning to 3/

      The resulting code should be easier to read, most bugs should be fixed during the conversion, it would be easier to add new complex types.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    7/Nov/06