Exemplo n.º 1
0
 /**
  * Plugin activation hook
  *
  * Creates tables if needed
  *
  * @return void
  */
 public function on_activate()
 {
     global $wpdb;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     $charset_collate = $wpdb->get_charset_collate();
     $dbstruct = array();
     $dbstruct[] = \WP_Clanwars\Games::schema();
     $dbstruct[] = \WP_Clanwars\Maps::schema();
     $dbstruct[] = \WP_Clanwars\Matches::schema();
     $dbstruct[] = \WP_Clanwars\Rounds::schema();
     $dbstruct[] = \WP_Clanwars\Teams::schema();
     add_option(WP_CLANWARS_CATEGORY, -1);
     add_option(WP_CLANWARS_DEFAULTCSS, true);
     $dbstruct = implode("\n", $dbstruct);
     // update database
     dbDelta($dbstruct);
 }