ExtensionCrawler/queries/get_added_permissions.sql

49 lines
1.6 KiB
MySQL
Raw Normal View History

2017-09-02 13:16:11 +00:00
select extension_info.downloads, extension_info.extid, extension_info.name, permission
2017-09-01 19:00:28 +00:00
from (
-- We generate a table containing every crx_etag that we crawled within the
-- last day and is an update, and a random date where we encountered the its
-- previous crx_etag. We only use it to find the crx_etag again later.
select
crx_first_date1.crx_etag,
crx_first_date1.extid,
crx_first_date1.md as most_recent_update,
crx_first_date2.md as some_date_with_previous_version
2017-08-16 20:32:09 +00:00
from (
2017-09-01 19:00:28 +00:00
select crx_etag,extid,min(date) as md
2017-08-16 20:32:09 +00:00
from extension
2017-09-01 19:10:50 +00:00
where crx_etag is not null
2017-09-01 19:00:28 +00:00
group by crx_etag
) crx_first_date1
inner join (
select extid,min(date) as md
2017-08-16 20:32:09 +00:00
from extension
2017-09-01 19:10:50 +00:00
where crx_etag is not null
2017-09-01 19:00:28 +00:00
group by crx_etag
) crx_first_date2
on crx_first_date1.extid=crx_first_date2.extid
where crx_first_date1.md>crx_first_date2.md
and DATEDIFF(CURDATE(), crx_first_date1.md) = 0
group by crx_first_date1.crx_etag
) crx_most_recent_and_prev
inner join permission
on crx_most_recent_and_prev.crx_etag=permission.crx_etag
inner join extension extension_info
on crx_most_recent_and_prev.extid=extension_info.extid
and extension_info.date=most_recent_update
and extension_info.crx_etag=crx_most_recent_and_prev.crx_etag
2017-09-02 13:16:11 +00:00
where
permission in (
"<all_url>",
"http://*/*",
"https://*/*",
"webRequest",
"webRequestBlocking"
)
and permission not in (
2017-09-01 19:00:28 +00:00
select permission
from extension natural join permission
where extid=extension_info.extid and date=some_date_with_previous_version
2017-09-01 19:10:50 +00:00
)
2017-09-02 13:16:11 +00:00
order by extension_info.downloads desc;
2017-09-01 19:10:50 +00:00