WpItem::Infos specs

This commit is contained in:
erwanlr
2013-03-25 15:24:46 +01:00
parent 276952ffb9
commit 5bb9aa29fa
4 changed files with 123 additions and 12 deletions

View File

@@ -1,6 +1,8 @@
# encoding: UTF-8
class WpItem
# @uri is used instead of #uri to avoid the presence of the :path into it
module Infos
# @return [ Boolean ]
@@ -8,26 +10,17 @@ class WpItem
Browser.instance.get(readme_url).code == 200 ? true : false
end
# @return [ String ]
# @return [ String ] The url to the readme file
def readme_url
@uri.merge('readme.txt').to_s
end
# @return [ String ]
def wordpress_url
end
def wordpress_org_item?
end
# @return [ Boolean ]
def has_changelog?
Browser.instance.get(changelog_url).code == 200 ? true : false
end
# @return [ String ]
# @return [ String ] The url to the changelog file
def changelog_url
@uri.merge('changelog.txt').to_s
end
@@ -43,16 +36,20 @@ class WpItem
# however can also be found in their specific plugin dir.
# http://www.exploit-db.com/ghdb/3714/
#
# Only the first 700 bytes are checked to avoid the download
# of the whole file which can be very huge (like 2 Go)
#
# @return [ Boolean ]
def has_error_log?
response_body = Browser.instance.get(error_log_url, headers: {'range' => 'bytes=0-700'}).body
response_body[%r{PHP Fatal error}i] ? true : false
end
# @return [ String ]
# @return [ String ] The url to the error_log file
def error_log_url
@uri.merge('error_log').to_s
end
end
end