<?php global $blclog, $blc_config_manager, $wpdb; $queryCnt = $wpdb->num_queries; //Completing the installation/upgrade is required for the plugin to work, so make sure //the script doesn't get aborted by (for example) the browser timing out. set_time_limit(300); //5 minutes should be plenty, anything more would probably indicate an infinite loop or a deadlock ignore_user_abort(true); //Log installation progress to a DB option $blclog = new blcCachedOptionLogger('blc_installation_log'); register_shutdown_function(array(&$blclog, 'save')); //Make sure the log is saved even if the plugin crashes $blclog->clear(); $blclog->info(sprintf('Plugin activated at %s.', date_i18n('Y-m-d H:i:s'))); $activation_start = microtime(true); //Reset the "installation_complete" flag $blc_config_manager->options['installation_complete'] = false; $blc_config_manager->options['installation_flag_cleared_on'] = date('c') . ' (' . microtime(true) . ')'; //Note the time of the first installation (not very accurate, but still useful) if (empty($blc_config_manager->options['first_installation_timestamp'])) { $blc_config_manager->options['first_installation_timestamp'] = time(); } $blc_config_manager->save_options(); $blclog->info('Installation/update begins.'); //Load the base classes and utilities require_once BLC_DIRECTORY . '/includes/links.php'; require_once BLC_DIRECTORY . '/includes/link-query.php'; require_once BLC_DIRECTORY . '/includes/instances.php'; require_once BLC_DIRECTORY . '/includes/utility-class.php'; //Load the module subsystem
<?php global $blclog, $blc_config_manager, $wpdb; $queryCnt = $wpdb->num_queries; //Completing the installation/upgrade is required for the plugin to work, so make sure //the script doesn't get aborted by (for example) the browser timing out. set_time_limit(300); //5 minutes should be plenty, anything more would probably indicate an infinite loop or a deadlock ignore_user_abort(true); //Log installation progress to a DB option $blclog = new blcCachedOptionLogger('blc_installation_log'); register_shutdown_function(array(&$blclog, 'save')); //Make sure the log is saved even if the plugin crashes $blclog->clear(); $blclog->info(sprintf('Plugin activated at %s.', date_i18n('Y-m-d H:i:s'))); //Reset the "installation_complete" flag $blc_config_manager->options['installation_complete'] = false; $blc_config_manager->options['installation_flag_cleared_on'] = date('c') . ' (' . microtime(true) . ')'; //Note the time of the first installation (not very accurate, but still useful) if (empty($blc_config_manager->options['first_installation_timestamp'])) { $blc_config_manager->options['first_installation_timestamp'] = time(); } $blc_config_manager->save_options(); $blclog->info('Installation/update begins.'); //Load the base classes and utilities require_once BLC_DIRECTORY . '/includes/links.php'; require_once BLC_DIRECTORY . '/includes/link-query.php'; require_once BLC_DIRECTORY . '/includes/instances.php'; require_once BLC_DIRECTORY . '/includes/utility-class.php'; //Load the module subsystem require_once BLC_DIRECTORY . '/includes/modules.php';