Пример #1
0
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...');
$blc_config_manager->options['installation_complete'] = true;
$blc_config_manager->options['installation_flag_set_on'] = date('c') . ' (' . microtime(true) . ')';
if ($blc_config_manager->save_options()) {
    $blclog->info('Configuration saved.');
} else {
    $blclog->error('Error saving plugin configuration!');
}
$blclog->info(sprintf('Installation/update completed at %s with %d queries executed.', date_i18n('Y-m-d H:i:s'), $wpdb->num_queries - $queryCnt));
$blclog->info(sprintf('Total time: %.3f seconds', microtime(true) - $activation_start));
$blclog->save();