From 81524d177d0605e2ae41865442174087015abec8 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 21 Nov 2015 15:38:09 -0500 Subject: [PATCH] Remove unused functions --- CRM/Core/BAO/CMSUser.php | 93 ---------------------------------------- 1 file changed, 93 deletions(-) diff --git a/CRM/Core/BAO/CMSUser.php b/CRM/Core/BAO/CMSUser.php index 2b9dbab19c..6db4cad210 100644 --- a/CRM/Core/BAO/CMSUser.php +++ b/CRM/Core/BAO/CMSUser.php @@ -35,8 +35,6 @@ * This file contains functions for synchronizing cms users with CiviCRM contacts. */ -require_once 'DB.php'; - /** * Class CRM_Core_BAO_CMSUser */ @@ -387,95 +385,4 @@ class CRM_Core_BAO_CMSUser { return (!empty($errors)) ? $errors : TRUE; } - /** - * @deprecated - * This function is not used anywhere - * - * @param array $contact - * Array of contact-details. - * - * @return int|bool - * uid if user exists, false otherwise - * - */ - public static function userExists(&$contact) { - $config = CRM_Core_Config::singleton(); - - $isDrupal = $config->userSystem->is_drupal; - $isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE; - $isWordPress = $config->userFramework == 'WordPress' ? TRUE : FALSE; - - if (!$isDrupal && !$isJoomla && !$isWordPress) { - die('Unknown user framework'); - } - - // Use UF native framework to fetch data from UF user table - if ($isDrupal) { - $uid = db_query( - "SELECT uid FROM {users} where mail = :email", - array(':email' => $contact['email']) - )->fetchField(); - - if ($uid) { - $contact['user_exists'] = TRUE; - $result = $uid; - } - } - elseif ($isJoomla) { - $mail = $contact['email']; - - $JUserTable = &JTable::getInstance('User', 'JTable'); - - $db = $JUserTable->getDbo(); - $query = $db->getQuery(TRUE); - $query->select('username, email'); - $query->from($JUserTable->getTableName()); - $query->where('(LOWER(email) = LOWER(\'' . $email . '\'))'); - $db->setQuery($query, 0, $limit); - $users = $db->loadAssocList(); - - $row = array();; - if (count($users)) { - $row = $users[0]; - } - - if (!empty($row)) { - $uid = CRM_Utils_Array::value('id', $row); - $contact['user_exists'] = TRUE; - $result = $uid; - } - } - elseif ($isWordPress) { - if (email_exists($params['mail'])) { - $contact['user_exists'] = TRUE; - $userObj = get_user_by('email', $params['mail']); - return $userObj->ID; - } - } - - return $result; - } - - /** - * @param $config - * - * @return object - */ - public static function &dbHandle(&$config) { - $errorScope = CRM_Core_TemporaryErrorScope::ignoreException(); - $db_uf = DB::connect($config->userFrameworkDSN); - unset($errorScope); - if (!$db_uf || - DB::isError($db_uf) - ) { - $session = CRM_Core_Session::singleton(); - $session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1')); - CRM_Core_Error::statusBounce(ts("Cannot connect to UF db via %1. Please check the CIVICRM_UF_DSN value in your civicrm.settings.php file", - array(1 => $db_uf->getMessage()) - )); - } - $db_uf->query('/*!40101 SET NAMES utf8 */'); - return $db_uf; - } - } -- 2.25.1