Class: Shellpress::Database

Inherits:
Thor
  • Object
show all
Defined in:
lib/shellpress/database.rb

Constant Summary collapse

ORDER =
3

Instance Method Summary collapse

Methods inherited from Thor

banner, #help

Instance Method Details

#resetObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/shellpress/database.rb', line 12

def reset

  tables = %w(wp_commentmeta wp_comments wp_links wp_options wp_postmeta wp_posts wp_terms wp_term_relationships wp_term_taxonomy)
  if options[:exclude_users]
    tables += %w(wp_usermeta wp_users)
  end

  # doesnt work yet since there's no way to retrieve config settings
  begin
    #wp = Mysql.real_connect(mysql['host'], mysql['user'], mysql['pass'])
    #tables.each do |t|
    #  wp.query("TRUNCATE TABLE #{t}")
    #end
  rescue Mysql::Error => e
    abort e
  ensure
    wp.close if wp
  end

end