Esempio n. 1
0
 /**
  * Checks input, creates a sql backup file, shows changes and download button.
  *
  * @param        $search
  * @param        $replace
  * @param        $tables
  * @param bool   $domain_replace
  * @param string $new_table_prefix
  */
 protected function create_backup_file($search, $replace, $tables, $domain_replace = FALSE, $new_table_prefix = '')
 {
     $report = $this->dbe->db_backup($search, $replace, $tables, $domain_replace, $new_table_prefix);
     if ($search !== '' && $search !== $replace) {
         echo '<div class="updated notice is-dismissible">';
         //show changes if there are any
         if (count($report['changes']) > 0) {
             $this->show_changes($report);
         }
         //if no changes found report that
         if (0 === count($report['changes'])) {
             echo '<p>' . esc_html__('Search pattern not found.', 'search-and-replace') . '</p>';
         }
         echo '</div>';
     }
     $compress = (bool) (isset($_POST['compress']) && 'on' === $_POST['compress']);
     $this->show_download_button($report['filename'], $compress);
 }