From 88c31faf7d154cb340cdbfaa2550ee9f4e45d521 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 21 Feb 2010 13:25:42 +0100 Subject: [PATCH] Kill references to obsolete tables. Signed-off-by: Florent Bruneau --- classes/profile.php | 4 +++- classes/userfilter.php | 4 ++-- include/reminder/profile_update.inc.php | 36 +++++++++------------------------ 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/classes/profile.php b/classes/profile.php index f1dc23d..3c782b6 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -442,7 +442,9 @@ class Profile IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary, pd.promo AS promo, pd.short_name, pd.directory_name AS full_name, pd.directory_name, pp.display_tel AS mobile, pp.pub AS mobile_pub, - ph.pub AS photo_pub, ap.uid AS owner_id + ph.attach IS NOT NULL AS has_photo, ph.pub AS photo_pub, + p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old, + ap.uid AS owner_id FROM profiles AS p INNER JOIN profile_display AS pd ON (pd.pid = p.pid) INNER JOIN profile_education AS pe ON (pe.uid = p.pid AND FIND_IN_SET(\'primary\', pe.flags)) diff --git a/classes/userfilter.php b/classes/userfilter.php index fa155f2..cd71249 100644 --- a/classes/userfilter.php +++ b/classes/userfilter.php @@ -1730,12 +1730,12 @@ class UserFilter extends PlFilter if ($promo_min != 0) { $min = new UFC_Promo('>=', self::GRADE_ING, intval($promo_min)); } else { - $min = new UFC_True(); + $min = new PFC_True(); } if ($promo_max != 0) { $max = new UFC_Promo('<=', self::GRADE_ING, intval($promo_max)); } else { - $max = new UFC_True(); + $max = new PFC_True(); } return new UserFilter(new PFC_And($min, $max)); } diff --git a/include/reminder/profile_update.inc.php b/include/reminder/profile_update.inc.php index c853f5f..4efaffb 100644 --- a/include/reminder/profile_update.inc.php +++ b/include/reminder/profile_update.inc.php @@ -48,23 +48,16 @@ class ReminderProfileUpdate extends Reminder public function Prepare(&$page) { parent::Prepare($page); + $profile = $this->user->profile(); - $res = XDB::query('SELECT date < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_profile_old, - date AS profile_date, LENGTH(p.attach) > 0 AS has_photo - FROM auth_user_md5 AS u - LEFT JOIN photo AS p ON (u.user_id = p.uid) - WHERE user_id = {?}', - $this->user->id()); - list($is_profile_old, $profile_date, $has_photo) = $res->fetchOneRow(); - - $page->assign('profile_incitation', $is_profile_old); - $page->assign('profile_last_update', $profile_date); - $page->assign('photo_incitation', !$has_photo); + $page->assign('profile_incitation', $profile->is_old); + $page->assign('profile_last_update', $profile->last_change); + $page->assign('photo_incitation', !$profile->has_photo); $res = XDB::query('SELECT COUNT(*) FROM profile_addresses WHERE pid = {?} AND accuracy = 0', - $this->user->id()); + $profile->id()); $page->assign('geocoding_incitation', $res->fetchOneCell()); } @@ -83,20 +76,11 @@ class ReminderProfileUpdate extends Reminder public static function IsCandidate(User &$user, $candidate) { - $res = XDB::query('SELECT date < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_profile_old, - p.attach AS photo - FROM auth_user_md5 AS u - LEFT JOIN photo AS p ON (u.user_id = p.uid) - WHERE user_id = {?}', - $user->id()); - list($is_profile_old, $has_photo) = $res->fetchOneRow(); - - $res = XDB::query('SELECT COUNT(*) - FROM profile_addresses - WHERE pid = {?} AND accuracy = 0', - $user->id()); - - return ($res->fetchOneCell() || !$has_photo || $is_profile_old); + $profile = $user->profile(); + if (!$profile) { + return false; + } + return !$profile->has_photo || $profile->is_old; } } -- 2.1.4