Since the only effect of these changes should be a silent reduction in the number of calls to set_field(), I wrote up a test script to help me with testing it. I've attached the test script here. You can apply it to your Mahara site by downloading it to a file called "testpatch.txt", and then applying it using the "patch" command:
cd /path/to/mahara patch -p0 < /path/to/testpatch.txt It causes the set_config* methods to be called with the same argument twice, using a number of different data types. It also adds a call to "debug_print_backtrace()" into set_field() to make it visible when it is being called. To test with this: 1. Apply the patch as described above 2. In your web browser, navigate to <yourmaharasite>/test.php 3. Refresh the test.php page at least twice (the first time it runs it will insert these records rather than calling set_field(), making the results less apparent) On a successful run, you should see stacktraces indicating that the set_field() was called 15 times (5 different config values x 3 different functions). You should see that it only ran on the first call with each config value, and not on the second call. You should not see any warning messages or error messages except for the stacktraces generated by the test script. ** Attachment added: "Patch with some test cases" https://bugs.launchpad.net/mahara/+bug/1526073/+attachment/4534821/+files/testpatch.txt -- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1526073 Title: set_config() writes to the database even if it's not necessary Status in Mahara: In Progress Bug description: Mahara's set_config() methods updates the database every single time you call it, even if you haven't actually changed the value of the field. It would be more efficient if it did not do this. Especially since it already does a SELECT statement to check whether it needs to do an UPDATE or INSERT, it would be trivial to also make it check to see if the value in the database is the same as the value passed by the user, and skip that UPDATE if so. To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1526073/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : [email protected] Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp

