Log Deprecated Calls v1.2

A new update to my Log Deprecated Calls WordPress plugin.

The newer versions based on Strider Core has had some “teething pains”, for which I apologize; but I believe I’ve worked them out for the most part. Perhaps my primary error was prematurely removing the Strider Core based version from Beta; but this latest should be fully functional.

The primary fix on this one is the settings page — it was not saving properly due to an obscure bug that I fixed by switching to the WordPress Settings API. In the process I may have uncovered a bug in the API, actually. I’ll have to take a closer look to see if it’s really a bug or just a conflict in the way I was using it.

The next pending update is to make more efficient use of the database. Currently I only recommend using the plugin in the short-term while debugging — which you probably do anyways, but if not it can create a very large table. That fix is next on my plate, and then I think I’ll be quite satisfied with what I’ve made here.

It’s a bit odd and — yes — humbling to look at my own code from several years ago. Even just recently I’ve learned some new concepts after reading the excellent book Clean Code — which was almost worth it just for the advice that you make smaller functions and make them each do One Thing Only. It helped in this latest bugfix, as the bug traced back to a function that inappropriately did TWO things. In the process of validating the form before saving it, a function was actually saving the option to the database as soon as it validated — but this was in turn causing the WordPress API to start the validation over again, which saved the setting, which restarted the validation, which saved the setting…. and so on. Once I cleanly separated the act of determining default options from saving default options, the problem was quickly resolved.

The main cause of this is that this plugin has become my main testing ground for the Strider Core framework I’m designing — and in the course of abstracting out some of the repetitive code that goes in all my plugins, some oddities crept in.

This entry was posted in Codecraft and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.