| OLD | NEW |
| 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, |
| 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
| 14 # | 14 # |
| 15 # You should have received a copy of the GNU General Public License | 15 # You should have received a copy of the GNU General Public License |
| 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 |
| 18 import MySQLdb, hashlib, sys, os, re | 18 import MySQLdb |
| 19 from time import time | |
| 20 from email.utils import parseaddr | 19 from email.utils import parseaddr |
| 21 from sitescripts.utils import get_config, get_template, setupStderr | 20 from sitescripts.utils import get_config, get_template, setupStderr |
| 22 from sitescripts.reports.utils import getReport, saveReport, get_db, executeQuer
y | 21 from sitescripts.reports.utils import getReport, saveReport, get_db, executeQuer
y |
| 23 | 22 |
| 24 def getReports(): | 23 def getReports(): |
| 25 count = 1000 | 24 count = 1000 |
| 26 offset = 0 | 25 offset = 0 |
| 27 while True: | 26 while True: |
| 28 cursor = get_db().cursor(MySQLdb.cursors.DictCursor) | 27 cursor = get_db().cursor(MySQLdb.cursors.DictCursor) |
| 29 executeQuery(cursor, | 28 executeQuery(cursor, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 def processReports(): | 39 def processReports(): |
| 41 for report in getReports(): | 40 for report in getReports(): |
| 42 guid = report.get('guid', None) | 41 guid = report.get('guid', None) |
| 43 reportData = getReport(guid) | 42 reportData = getReport(guid) |
| 44 if 'screenshot' in reportData: | 43 if 'screenshot' in reportData: |
| 45 saveReport(guid, reportData) | 44 saveReport(guid, reportData) |
| 46 | 45 |
| 47 if __name__ == '__main__': | 46 if __name__ == '__main__': |
| 48 setupStderr() | 47 setupStderr() |
| 49 processReports() | 48 processReports() |
| OLD | NEW |