r78911 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78910‎ | r78911 | r78912 >
Date:18:56, 23 December 2010
Author:rfaulk
Status:deferred
Tags:
Comment:
Fix for cases where hostname is missing in referrer url.
Modified paths:
  • /trunk/fundraiser-statistics/fundraiser-scripts/mine_landing_pages.py (modified) (history)

Diff [purge]

Index: trunk/fundraiser-statistics/fundraiser-scripts/mine_landing_pages.py
@@ -46,11 +46,11 @@
4747 pathIndex = 2;
4848
4949
 50+ # Clear the records for hour ahead of adding
 51+ #timestamp_raw_start = year + month + day + hour + min + '00'
 52+ #timestamp_raw_end = year + month + day + hour + min + '00'
 53+ #clear_recs_query = 'delete from landing_page where request_time >= \'' + +'\' and request_time < \' \'';
5054
51 - # INITIALIZE DB ACCESS
52 - # ===================
53 -
54 -
5555 # SQL Statements
5656
5757 insertStmt_lp = 'INSERT INTO landing_page (utm_source, utm_campaign, utm_medium, landing_page,' + \
@@ -114,8 +114,12 @@
115115 project = hostname[0] # wikimediafoundation.org
116116 source_lang = hostname[0]
117117 else:
118 - project = hostname[0] if ( hostname[1] == 'wikimedia' ) else hostname[1] # species.wikimedia vs en.wikinews
119 - source_lang = hostname[0] if ( len(hostname[1]) < 5 ) else 'en' # pl.wikipedia vs commons.wikimedia
 118+ try:
 119+ project = hostname[0] if ( hostname[1] == 'wikimedia' ) else hostname[1] # species.wikimedia vs en.wikinews
 120+ source_lang = hostname[0] if ( len(hostname[1]) < 5 ) else 'en' # pl.wikipedia vs commons.wikimedia
 121+ except:
 122+ project = ''
 123+ source_lang = 'en'
120124
121125 # Process User agent string
122126 # =====================

Status & tagging log