Parts of this entry may only apply to those who create hooks for IP.Board. Feel free to skip the sections that may not interest you.
As mentioned in our previous blog entries about IP.Board 3.2 we are focusing not only on adding new features but also on improving some of the current areas as well. In this entry I'll talk about the changes we made for hooks.
Several times it might happen that a hook requires a specific cache on every page (like our IP.Chat hook "Chat Tab Count") but there was no way to do that apart from running a separate query on each page load. In IP.Board 3.2 we have added support in the hooks for a system called "Global Caches" which allows modders to specify a set of caches that the board will always load together with the default ones. Such caches can be selected in a new tab we have added in the hooks form and will help reduce the number of queries run.
Already in IP.Board 3.0 hooks had 4 requirements fields and nothing changed in 3.1: min/max PHP version and min/max IP.Board version. What if the hook was for a third party addon or even one of our official addons? Was that enough? We felt that the answer was no and thus we have implemented an enhanced applications requirements system.
With the new system you can now specify any installed application as a requirement while creating a hook as well as the usual PHP version. Furthermore, you can specify a minimum and/or maximum version or leave both fields set to 0 to only require the application to be installed.
In the example below the hook will require a PHP version between 5.3.0-5.3.5, a minimum IP.Board version of 3.1.1 and IP.Gallery installed.
When installing a hook that doesn't meet the requirements, a warning badge will appear before the title and a count of all the warnings for enabled hooks will be shown as well above the list.
Clicking on the warning badge will redirect you to the hook requirements page where each requirement has its own badge (ok / error) and as you can see the minimum PHP version requirement is not met.
You will also see the same requirements page when trying to enable a hook already installed that doesn't meet the requirements. In this case however you'll have the option to skip the requirements check and still enable the hook regardless.
The update checker for the hooks has been enhanced and now the code can retrieve an 'update url' as well if there is an update available, previously the system simply used the hook website value if one was provided but what if the site got moved or if the modder wants the admins to go to a specific url to get directly the update rather than viewing the main page of their site?
In the old IP.Board 3.0 & 3.1 versions the update script simply returned a 0 value if there was no update or 1 for an update available, now if an update is available IP.Board will explode the string on the character | and take the second value in the array as the url. An example is available below:
Additionally IP.Board 3.2 will now add also the IP.Board long version in the update URL together with the hook long version, in this way the update script can return only 1 for older versions or add also the new 'update url' variable for IP.Board 3.2+:
IP.Board 3.1: http://www.domain.com/checkHookUpdate.php?hookKey=test_hook&version=10000 IP.Board 3.2: http://www.domain.com/checkHookUpdate.php?hookKey=test_hook&boardVersion=32000&version=10000
Install a New Hook
As you may have already noticed from the screenshot above the "Install a New Hook" form is now a tab and you won't need to scroll down to the bottom of the page anymore, especially when you have a large list of hooks installed.
Many other small tweaks and optimizations have been implemented in the layout as you can see from the screenshots and also in the code, finally all the enhancements discussed above are available in the Hook Details page as well which contains a summary of everything concerning the hook.
Feel free to comment on this blog entry below or, if you have feedback unrelated to this blog entry, start a new topic in our feedback forum. Be sure to check the What's New in IP.Board 3.2 topic for a running list of announced changes!