function activateDB()
 {
     $this->createTables();
     $this->updateTables();
     parent::serializeAllFormFields();
     parent::serializeAllFieldOptions();
     $this->insertFixedFields();
 }
 function importFromFile($file, $settings = array('mode' => 'clear_import', 'import_general_settings' => false, 'import_forms' => true, 'import_fields' => true, 'import_field_options' => true, 'import_styles' => true, 'import_saved_submissions' => false))
 {
     $path = CCF_BASE_PATH . 'import/';
     $file_name = basename(time() . $file['name']);
     $file_extension = pathinfo($file['name'], PATHINFO_EXTENSION);
     if (stripos($file_extension, 'sql')) {
         unlink($file['tmp_name']);
         wp_die('You can only import .sql files.');
     }
     if (move_uploaded_file($file['tmp_name'], $path . $file_name)) {
         $data = file_get_contents($path . $file_name);
         $data = preg_replace('/^#.*?[\\n\\r]*$/ims', '', $data);
         $commands = $this->parseMultiQuery($data);
         $errors = 0;
         if ($settings['mode'] == 'clear_import') {
             parent::emptyAllTables();
         }
         foreach ($commands as $command) {
             if (preg_match('/^[\\s]*UPDATE/is', $command)) {
                 if ($settings['import_general_settings']) {
                     if (!parent::query($command)) {
                         $errors++;
                     }
                 }
             } elseif (preg_match('/^[\\s]*INSERT INTO/is', $command)) {
                 $table_name = $this->extractTableFromQuery($command);
                 $no_query = 0;
                 if ($settings['import_forms'] == 0) {
                     if ($table_name == CCF_FORMS_TABLE) {
                         $no_query = 1;
                     }
                 }
                 if ($settings['import_fields'] == 0) {
                     if ($table_name == CCF_FIELDS_TABLE) {
                         $no_query = 1;
                     }
                 }
                 if ($settings['import_field_options'] == 0) {
                     if ($table_name == CCF_FIELD_OPTIONS_TABLE) {
                         $no_query = 1;
                     }
                 }
                 if ($settings['import_styles'] == 0) {
                     if ($table_name == CCF_STYLES_TABLE) {
                         $no_query = 1;
                     }
                 }
                 if ($settings['import_saved_submissions'] == 0) {
                     if ($table_name == CCF_USER_DATA_TABLE) {
                         $no_query = 1;
                     }
                 }
                 if ($no_query == 0) {
                     if (!parent::query($command)) {
                         $errors++;
                     }
                 }
             }
         }
         ccf_utils::load_module('db/custom-contact-forms-activate-db.php');
         CustomContactFormsActivateDB::insertFixedFields();
         parent::serializeAllFormFields();
         parent::serializeAllFieldOptions();
         return $errors == 0 ? true : $errors;
     }
     return false;
 }