/** * (Re)create synchronization records for all containers and mark them all as unparsed. * * @param bool $forced If true, the plugin will recreate all synch. records from scratch. * @return void */ function blc_resynch($forced = false) { global $wpdb, $blclog; /* @var wpdb $wpdb */ if ($forced) { $blclog->info('... Forced resynchronization initiated'); //Drop all synchronization records $wpdb->query("TRUNCATE {$wpdb->prefix}blc_synch"); } else { $blclog->info('... Resynchronization initiated'); } //Remove invalid DB entries blc_cleanup_database(); //(Re)create and update synch. records for all container types. $blclog->info('... (Re)creating container records'); blcContainerHelper::resynch($forced); $blclog->info('... Setting resync. flags'); blc_got_unsynched_items(); //All done. $blclog->info('Database resynchronization complete.'); }
} unset($blc_config_manager->options['check_comment_links']); } if (empty($blc_config_manager->options['custom_fields'])) { $moduleManager->deactivate('custom_field'); } //Prepare the database. $blclog->info('Upgrading the database...'); $upgrade_start = microtime(true); require_once BLC_DIRECTORY . '/includes/admin/db-upgrade.php'; blcDatabaseUpgrader::upgrade_database(); $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'])) {