Example #1
0
 /**
  * Initiate a full recheck - reparse everything and check all links anew. 
  *
  * @return void
  */
 function initiate_recheck()
 {
     global $wpdb;
     /** @var wpdb $wpdb */
     //Delete all discovered instances
     $wpdb->query("TRUNCATE {$wpdb->prefix}blc_instances");
     //Delete all discovered links
     $wpdb->query("TRUNCATE {$wpdb->prefix}blc_links");
     //Mark all posts, custom fields and bookmarks for processing.
     blc_resynch(true);
 }
Example #2
0
 /**
  * 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.');
 }