/** * Display installation errors (if any) on the Dashboard. * * @return void */ function blc_print_installation_errors() { $conf = blc_get_configuration(); if (!$conf->options['installation_failed']) { return; } $logger = new blcOptionLogger('blc_installation_log'); $log = $logger->get_messages(); $message = array('<strong>' . __('Broken Link Checker installation failed', 'broken-link-checker') . '</strong>', '', '<em>Installation log follows :</em>'); foreach ($log as $entry) { array_push($message, $entry); } $message = implode("<br>\n", $message); echo "<div class='error'><p>{$message}</p></div>"; }
/** * This is a hook that's executed when the plugin is activated. * It set's up and populates the plugin's DB tables & performs * other installation tasks. * * @return void */ function activation() { global $blclog; $blclog = new blcOptionLogger('blc_installation_log'); $blclog->clear(); $blclog->info('Plugin activated.'); $this->conf->options['installation_complete'] = false; $this->conf->options['installation_failed'] = true; $this->conf->save_options(); $blclog->info('Installation/update begins.'); $blclog->info('Initializing components...'); blc_init_all_components(); //Prepare the database. $blclog->info('Upgrading the database...'); $this->upgrade_database(); //Mark all new posts and other parse-able objects as unsynchronized. $blclog->info('Updating database entries...'); blc_resynch(); //Turn off load limiting if it's not available on this server. $blclog->info('Updating server load limit settings...'); $load = $this->get_server_load(); if (empty($load)) { $this->conf->options['enable_load_limit'] = false; } //And optimize my DB tables, too (for good measure) $blclog->info('Optimizing the database...'); $this->optimize_database(); $blclog->info('Completing installation...'); $this->conf->options['installation_complete'] = true; $this->conf->options['installation_failed'] = false; $this->conf->save_options(); $blclog->info('Installation/update successfully completed.'); }