You are here

private function FirewallUpdater::createTempTables in Anti Spam by CleanTalk 9.1.x

Same name and namespace in other branches
  1. 8.4 src/lib/Cleantalk/Common/Firewall/FirewallUpdater.php \Cleantalk\Common\Firewall\FirewallUpdater::createTempTables()

Creatin a temporary updating table

Parameters

DB $db database handler:

Throws

\Exception

1 call to FirewallUpdater::createTempTables()
FirewallUpdater::update in src/lib/Cleantalk/Common/Firewall/FirewallUpdater.php

File

src/lib/Cleantalk/Common/Firewall/FirewallUpdater.php, line 375

Class

FirewallUpdater

Namespace

Cleantalk\Common\Firewall

Code

private function createTempTables() {
  $sql = "SHOW TABLES LIKE '%scleantalk_sfw';";
  $sql = sprintf($sql, $this->db->prefix);

  // Adding current blog prefix
  $result = $this->db
    ->fetch($sql);
  if (!$result) {
    $sql = sprintf(Schema::getSchema('sfw'), $this->db->prefix);
    $this->db
      ->execute($sql);
  }
  $this->db
    ->execute('CREATE TABLE IF NOT EXISTS ' . $this->fw_data_table_name . '_temp LIKE ' . $this->fw_data_table_name . ';');
  $this->db
    ->execute('TRUNCATE TABLE ' . $this->fw_data_table_name . '_temp;');
}