StatsPlugin code factoring

This commit is contained in:
erwanlr
2013-03-11 17:52:19 +01:00
parent ae61b95707
commit 64c3c29597

View File

@@ -65,22 +65,21 @@ class StatsPlugin < Plugin
end end
def total_plugins(file=PLUGINS_FULL_FILE, xml=PLUGINS_VULNS_FILE) def total_plugins(file=PLUGINS_FULL_FILE, xml=PLUGINS_VULNS_FILE)
options = {} total('plugins', file, xml)
options[:only_vulnerable_ones] = false
options[:file] = file
options[:vulns_file] = xml
options[:base_url] = "http://localhost"
options[:type] = "plugins"
WpEnumerator.generate_items(options).count
end end
def total_themes(file=THEMES_FULL_FILE, xml=THEMES_VULNS_FILE) def total_themes(file=THEMES_FULL_FILE, xml=THEMES_VULNS_FILE)
options = {} total('themes', file, xml)
options[:only_vulnerable_ones] = false end
options[:file] = file
options[:vulns_file] = xml def total(type, file, xml)
options[:base_url] = "http://localhost" options = {
options[:type] = "themes" type: type,
file: file,
vulns_file: xml,
base_url: 'http://localhost',
only_vulnerable_ones: false
}
WpEnumerator.generate_items(options).count WpEnumerator.generate_items(options).count
end end