$blclog->info(sprintf('--- Total: %.3f seconds', microtime(true) - $upgrade_start)); //Remove invalid DB entries $blclog->info('Cleaning up the database...'); $cleanup_start = microtime(true); blc_cleanup_database(); $blclog->info(sprintf('--- Total: %.3f seconds', microtime(true) - $cleanup_start)); //Notify modules that the plugin has been activated. This will cause container //modules to create and update synch. records for all new/modified posts and other items. $blclog->info('Notifying modules...'); $notification_start = microtime(true); $moduleManager->plugin_activated(); blc_got_unsynched_items(); $blclog->info(sprintf('--- Total: %.3f seconds', microtime(true) - $notification_start)); //Turn off load limiting if it's not available on this server. $blclog->info('Updating server load limit settings...'); $load = blcUtility::get_server_load(); if (empty($load)) { $blc_config_manager->options['enable_load_limit'] = false; $blclog->info('Disable load limit. Cannot retrieve current load average.'); } elseif ($blc_config_manager->options['enable_load_limit'] && !isset($blc_config_manager->options['server_load_limit'])) { $fifteen_minutes = floatval(end($load)); $default_load_limit = round(max(min($fifteen_minutes * 2, $fifteen_minutes + 2), 4)); $blc_config_manager->options['server_load_limit'] = $default_load_limit; $blclog->info(sprintf('Set server load limit to %.2f. Current load average is %.2f', $default_load_limit, $fifteen_minutes)); } //And optimize my DB tables, too (for good measure) $blclog->info('Optimizing the database...'); $optimize_start = microtime(true); blcUtility::optimize_database(); $blclog->info(sprintf('--- Total: %.3f seconds', microtime(true) - $optimize_start)); $blclog->info('Completing installation...');
/** * Check if server is currently too overloaded to run the link checker. * * @return bool */ function server_too_busy() { if (!$this->conf->options['enable_load_limit']) { return false; } $loads = blcUtility::get_server_load(); if (empty($loads)) { return false; } $one_minute = floatval(reset($loads)); return $one_minute > $this->conf->options['server_load_limit']; }