Class: WPMU::List

Inherits:
Thor
  • Object
show all
Defined in:
lib/wpmu/cli.rb

Instance Method Summary collapse

Instance Method Details

#pluginsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/wpmu/cli.rb', line 27

def plugins
  plugins_options = get_options('active_plugins')
  plugins = {}
  plugins_options.each do |site_id, options|
    encoded_list = options['active_plugins']
    PHP.unserialize(encoded_list).each do |plugin_name|
      plugins[plugin_name] ||= []
      plugins[plugin_name] << site_id
    end
  end

  plugins.each do |plugin_name, site_ids|
    puts "#{plugin_name} - #{site_ids.to_s}"
  end
end

#sitesObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/wpmu/cli.rb', line 44

def sites
  sites_options = get_options(%w{blogname siteurl admin_email template active_plugins})
  sites_options.each do |site_id, site_options|
    site_options.each do |key, value|
      if key == 'active_plugins'
        puts "#{site_id}| #{key}:"
          PHP.unserialize(value).each do |plugin|
          puts "\t#{plugin}"
          end if value
      else
        puts "#{site_id}| #{key}: #{value}"
      end
    end
    puts "\n"
  end
end

#themesObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wpmu/cli.rb', line 12

def themes
  themes_options = get_options('template')
  themes = {}
  themes_options.each do |site_id, options|
    theme_name = options['template']
    themes[theme_name] ||= []
    themes[theme_name] << site_id
  end

  themes.each do |theme_name, site_ids|
    puts "#{theme_name} - #{site_ids.to_s}"
  end
end