* @static
* @access public
*/
- static function getFieldValue($daoName, $searchValue, $returnColumn = 'name', $searchColumn = 'id', $force = false) {
+ static function getFieldValue($daoName, $searchValue, $returnColumn = 'name', $searchColumn = 'id', $force = FALSE) {
if (
empty($searchValue) ||
trim(strtolower($searchValue)) == 'null'
}
if(in_array($FKClassName, CRM_Core_DAO::$_testEntitiesToSkip)){
$depObject = new $FKClassName();
- $depObject->find(true);
+ $depObject->find(TRUE);
} elseif ($daoName == 'CRM_Member_DAO_MembershipType' && $name == 'member_of_contact_id') {
// FIXME: the fields() metadata is not specific enough
$depObject = CRM_Core_DAO::createTestObject($FKClassName, array('contact_type' => 'Organization'));
return (empty($errors)) ? FALSE : TRUE;
}
+
+ /**
+ * Lookup the value of a MySQL global configuration variable.
+ *
+ * @param string $name e.g. "thread_stack"
+ * @param mixed $default
+ * @return mixed
+ */
+ public static function getGlobalSetting($name, $default = NULL) {
+ // Alternatively, SELECT @@GLOBAL.thread_stack, but
+ // that has been reported to fail under MySQL 5.0 for OS X
+ $escapedName = self::escapeString($name);
+ $dao = CRM_Core_DAO::executeQuery("SHOW VARIABLES LIKE '$escapedName'");
+ if ($dao->fetch()) {
+ return $dao->Value;
+ } else {
+ return $default;
+ }
+ }
}
$error = ts('CiviCRM %1 requires MySQL trigger privileges.',
array(1 => $latestVer));
}
-
- if (CRM_Core_DAO::singleValueQuery('SELECT @@GLOBAL.thread_stack') < (1024*self::MINIMUM_THREAD_STACK)) {
+
+ if (CRM_Core_DAO::getGlobalSetting('thread_stack', 0) < (1024*self::MINIMUM_THREAD_STACK)) {
$error = ts('CiviCRM %1 requires MySQL thread stack >= %2k', array(
1 => $latestVer,
2 => self::MINIMUM_THREAD_STACK,
return;
}
- $result = mysql_query('SELECT @@GLOBAL.thread_stack', $conn); // bytes => kb
+ $result = mysql_query("SHOW VARIABLES LIKE 'thread_stack'", $conn); // bytes => kb
if (!$result) {
$testDetails[2] = 'Could not query thread_stack.';
$this->error($testDetails);
} else {
$values = mysql_fetch_row($result);
- if ($values[0] < (1024*$minValueKB)) {
- $testDetails[2] = 'MySQL "thread_stack" is ' . ($values[0]/1024) . 'k';
+ if ($values[1] < (1024*$minValueKB)) {
+ $testDetails[2] = 'MySQL "thread_stack" is ' . ($values[1]/1024) . 'k';
$this->error($testDetails);
}
}