Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/stats/bin/logprocessor.py

Issue 5438786527821824: Issue 527 - Only process notification requests sent by our own extensions (Closed)
Patch Set: Created May 22, 2014, 7:20 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2014 Eyeo GmbH 4 # Copyright (C) 2006-2014 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 info["fullua"] = "%s %s" % (info["ua"], info["uaversion"]) 390 info["fullua"] = "%s %s" % (info["ua"], info["uaversion"])
391 info["clientid"] = match.group(9) 391 info["clientid"] = match.group(9)
392 392
393 # Additional metadata depends on file type 393 # Additional metadata depends on file type
394 filename = os.path.basename(info["file"]) 394 filename = os.path.basename(info["file"])
395 ext = os.path.splitext(filename)[1] 395 ext = os.path.splitext(filename)[1]
396 if ext == ".txt" or filename == "update.json" or filename == "notification.jso n": 396 if ext == ".txt" or filename == "update.json" or filename == "notification.jso n":
397 # Subscription downloads, libadblockplus update checks and notification 397 # Subscription downloads, libadblockplus update checks and notification
398 # checks are performed by the downloader 398 # checks are performed by the downloader
399 parse_downloader_query(info) 399 parse_downloader_query(info)
400
401 if filename == "notification.json" and info["addonName"] not in ("adblockplu s", "adblockpluschrome", "adblockplusopera", "adblockplussafari"):
Felix Dahlke 2014/05/22 07:35:21 I think we should filter this for all downloads re
Wladimir Palant 2014/05/22 07:44:05 a) We really need to do this for all downloads, ot
Sebastian Noack 2014/05/22 08:40:39 Done.
402 return None
400 elif ext == ".tpl": 403 elif ext == ".tpl":
401 # MSIE TPL download, no additional data here 404 # MSIE TPL download, no additional data here
402 pass 405 pass
403 elif ext in (".xpi", ".crx", ".apk", ".msi", ".exe", ".safariextz"): 406 elif ext in (".xpi", ".crx", ".apk", ".msi", ".exe", ".safariextz"):
404 # Package download, might be an update 407 # Package download, might be an update
405 info["installType"] = parse_update_flag(info["query"]) 408 info["installType"] = parse_update_flag(info["query"])
406 elif filename == "update.rdf": 409 elif filename == "update.rdf":
407 # Gecko update check or a legacy Android update check. The latter doesn't 410 # Gecko update check or a legacy Android update check. The latter doesn't
408 # have usable data anyway so trying the Chrome route won't do any harm. 411 # have usable data anyway so trying the Chrome route won't do any harm.
409 info["addonName"] = parse_addon_name(info["file"]) 412 info["addonName"] = parse_addon_name(info["file"])
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 parser.add_argument("mirror_name", nargs="?", help="Name of the mirror server that the file belongs to") 545 parser.add_argument("mirror_name", nargs="?", help="Name of the mirror server that the file belongs to")
543 parser.add_argument("server_type", nargs="?", help="Server type like download, update or subscription") 546 parser.add_argument("server_type", nargs="?", help="Server type like download, update or subscription")
544 parser.add_argument("log_file", nargs="?", help="Log file path, can be a local file path, http:// or ssh:// URL") 547 parser.add_argument("log_file", nargs="?", help="Log file path, can be a local file path, http:// or ssh:// URL")
545 args = parser.parse_args() 548 args = parser.parse_args()
546 549
547 if args.mirror_name and args.server_type and args.log_file: 550 if args.mirror_name and args.server_type and args.log_file:
548 sources = [(args.mirror_name, args.server_type, args.log_file)] 551 sources = [(args.mirror_name, args.server_type, args.log_file)]
549 else: 552 else:
550 sources = get_stats_files() 553 sources = get_stats_files()
551 parse_sources(sources, args.factor, args.verbose) 554 parse_sources(sources, args.factor, args.verbose)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld