diff options
| author | droy | 2014-07-16 17:03:33 +0000 |
|---|---|---|
| committer | droy | 2014-07-16 17:03:33 +0000 |
| commit | f243c372c8c9ea4b0a4731b4f0c37aab3ea1f7e0 (patch) | |
| tree | 5953ae5606a6d7d4fad8c5fe3ab7c16f120b029e | |
| parent | 7e4953691b7e17fb297fedd0220e70f19e9797be (diff) | |
| download | membership-f243c372c8c9ea4b0a4731b4f0c37aab3ea1f7e0.tar.gz membership-f243c372c8c9ea4b0a4731b4f0c37aab3ea1f7e0.tar.xz membership-f243c372c8c9ea4b0a4731b4f0c37aab3ea1f7e0.zip | |
Bug 421854 - Campaigns: convert Campaign tables to MyISAM
Signed-off-by: droy <denis.roy@eclipse.org>
| -rw-r--r-- | promo/impression.class.php | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/promo/impression.class.php b/promo/impression.class.php index 72c7c70..75a7a17 100644 --- a/promo/impression.class.php +++ b/promo/impression.class.php @@ -1,6 +1,6 @@ <?php /******************************************************************************* - * Copyright (c) 2010 Eclipse Foundation and others. + * Copyright (c) 2010-2014 Eclipse Foundation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,33 +12,13 @@ require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); -class CampaignImpression { - - #***************************************************************************** - # - # impression.class.php - # - # Author: N.Gervais - # Date: 11/10/2010 - # - # Description: functions to provide a method to track ad impressions - # - # HISTORY: - # - #***************************************************************************** - +class CampaignImpression { var $DEBUG; var $campaignKey = 0; var $source = ''; var $hostname = ''; var $timestamp = ''; -// function CampaignImpression() { -// $this->campaignKey = 0; -// $this->source = ''; -// $this->hostname = @gethostbyaddr($_SERVER['REMOTE_ADDR']); -// $this->timestamp = date('Y-m-d H:i:s'); -// } function CampaignImpression($_campaignKey, $_source, $_hostname) { $this->campaignKey = $_campaignKey; @@ -46,14 +26,7 @@ class CampaignImpression { $this->hostname = $_hostname; $this->timestamp = date('Y-m-d H:i:s'); } -// -// function CampaignImpression($_campaignKey, $_source, $_hostname, $_timestamp) { -// $this->campaignKey = $_campaignKey; -// $this->source = $_source; -// $this->hostname = $_hostname; -// $this->timestamp = $_timestamp; -// } - + function recordImpression() { $App = new App(); @@ -62,19 +35,17 @@ class CampaignImpression { if(rand(0, 1000) < 1) { # 1 of every 1,000 hits (0.1%) will clean up - $deleteSql = "delete from CampaignImpressions where TimeImpressed < DATE_SUB(NOW(), INTERVAL 1 YEAR)"; + $deleteSql = "DELETE LOW_PRIORITY FROM CampaignImpressions WHERE TimeImpressed < DATE_SUB(NOW(), INTERVAL 1 YEAR)"; $App->eclipse_sql($deleteSql); } - - $sql = "INSERT INTO CampaignImpressions VALUES ( + + $sql = "INSERT DELAYED INTO CampaignImpressions VALUES ( " . $App->returnQuotedString('') . ", " . $App->returnQuotedString($App->sqlSanitize($this->campaignKey)) . ", " . $App->returnQuotedString($App->sqlSanitize($this->source)) . ", " . $App->returnQuotedString($App->sqlSanitize($this->hostname)) . ", " . $App->returnQuotedString($App->sqlSanitize($this->timestamp)) . ")"; - -// //$sql = $App->sqlSanitize($sql); - // disabled for bug 421854$result = $App->eclipse_sql($sql); + $result = $App->eclipse_sql($sql); return; } }
\ No newline at end of file |
