Inpsyde\MultilingualPress\Database\WPDBTableInstaller::uninstall PHP Метод

uninstall() публичный Метод

Uninstalls the given table.
С версии: 3.0.0
public uninstall ( Inpsyde\MultilingualPress\Database\Table $table = null ) : boolean
$table Inpsyde\MultilingualPress\Database\Table Optional. Table object. Defaults to null.
Результат boolean Whether or not the table was uninstalled successfully.
    public function uninstall(Table $table = null)
    {
        $table = $table ?: $this->table;
        if (!$table) {
            throw InvalidTableException::for_action('uninstall');
        }
        return false !== $this->db->query('DROP TABLE IF EXISTS ' . $table->name());
    }

Usage Example

 /**
  * @return void
  */
 public function reset_table()
 {
     \Inpsyde\MultilingualPress\check_admin_referer($this->nonce);
     $table_prefix = $this->wpdb->base_prefix;
     $table = new LanguagesTable($table_prefix);
     $installer = new WPDBTableInstaller($table);
     $installer->uninstall();
     $installer->install();
     /**
      * Runs after having reset the database table.
      *
      * @param Table $table Languages table object.
      */
     do_action('mlp_reset_table_done', $table);
     $url = add_query_arg('msg', 'resettable', $_REQUEST['_wp_http_referer']);
     wp_safe_redirect($url);
     \Inpsyde\MultilingualPress\call_exit();
 }