First off, please do us a favor. We will later update this plugin also with this when next VL is released. This is to fix a few errors.
1) In the file sources/admin/inactive.php
Code:
eval (PluginManager::getPluginManager ()->pluginHooks ('admin_manage_build_page'));
That hook is use by another file already. Please change it to this
Code:
eval (PluginManager::getPluginManager ()->pluginHooks ('admin_manage_inactive_build_page'));
2) Next up in the same file
On a new blank line below it, add
3) Next up still same file
Again, below on blank line, add
4) Then go into the Unclutter plugin folder and change the filename admin_manage_build_page.php to admin_manage_inactive_build_page.php
Then open this file, and replace all content with this
Code:
$ch = curl_init($url);
if (!$ch) {
die("Couldn't initialize a cURL handle");
}
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
$c = curl_exec($ch);
$http_codes = parse_ini_file("./plugins/Unclutter/check.ini");
$http_status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$http_status_text = ($http_status_code > 0) ? $http_codes[curl_getinfo($ch, CURLINFO_HTTP_CODE)] : 'Failed';
$extra .= "<td align=\"center\">{$http_status_code} | {$http_status_text}</td>";
Few changes in this file.
- First off, added a connect timeout, so no url will get called longer than 2 seconds ( usually dead sites ). Would say even 1 second is enough, but for now 2
That is what cause the huge loading time if you have many unreachable members.
It never called each and every member, but only the 20 on current page, but due there being no timeout for unreachable domains, it hanged quite badly.
- Then theres an error ( php notice ) when the curl can not connect ( usually not found domains ). We now return status text "Failed", as generally a status code of zero doesn't exist. Zero can have multiple reason, thus i call it failed.
- And lastly the $extra needed an dot before the equal sign, so that variable can be reused by other plugins
This should improove loading time by quite a bit, next up would be like Mark mentioned Ajax calls so any extra loading time doesn't influence the VL script.
And maybe also use multi curl processing to reduce the servers cpu load also.
Once we made the core changes, the plugin will get these also. Thats why you need to do it manually for now.