classes/Utilities/Logging/DatabaseLogger.php
protected function insureTable() {
        global $wpdb;

        $this->table = $wpdb->prefix.'ilab_mc_logging';

        $tableSchema = <<<SQL
        create table {$this->table} (
          id bigint not null auto_increment,
          date datetime not null,
          channel varchar(32) not null,
          level varchar(16) not null,
          message text,
          context text,
          primary key(id)
        );
SQL;

        global $wpdb;

        $query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($this->table));

        $this->enabled = ($wpdb->get_var($query) == $this->table);

        if (!$this->enabled) {
            $wpdb->query($tableSchema);

            $this->enabled = ($wpdb->get_var($query) == $this->table);
        }
    }
protected function insureTable() {
        global $wpdb;

        $this->table = $wpdb->prefix.'ilab_mc_logging';

        $tableSchema = <<<SQL
        create table {$this->table} (
          id bigint not null auto_increment,
          date datetime not null,
          channel varchar(32) not null,
          level varchar(16) not null,
          message text,
          context text,
          primary key(id)
        );
SQL;

        global $wpdb;

        $query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($this->table));

        $this->enabled = ($wpdb->get_var($query) == $this->table);

        if (!$this->enabled) {
            $wpdb->query($tableSchema);

            $this->enabled = ($wpdb->get_var($query) == $this->table);
        }
    }
protected function insureTable ( ) { global $ wpdb ; $ this -> table = $ wpdb -> prefix . 'ilab_mc_logging' ; $ tableSchema =  <<<SQL
        create table {$this->table} (
          id bigint not null auto_increment,
          date datetime not null,
          channel varchar(32) not null,
          level varchar(16) not null,
          message text,
          context text,
          primary key(id)
        );
SQL ; global $ wpdb ; $ query = $ wpdb -> prepare ( "SHOW TABLES LIKE %s" , $ wpdb -> esc_like ( $ this -> table ) ) ; $ this -> enabled = ( $ wpdb -> get_var ( $ query ) == $ this -> table ) ; if ( ! $ this -> enabled ) { $ wpdb -> query ( $ tableSchema ) ; $ this -> enabled = ( $ wpdb -> get_var ( $ query ) == $ this -> table ) ; } }
Insures the table exists
Insures the table exists