X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FCore%2FBAO%2FSchemaHandler.php;h=4fa3c4dc1d6df8cb4016c1bf90624836757e090f;hb=dc195289d598fae6feedab517c4ababcdb840541;hp=9dcae8fcdabe02c14b66aab0ebe4d81f7bdeb4e8;hpb=771e2548641c460d0f7a244ad0aefb05c703b478;p=civicrm-core.git diff --git a/CRM/Core/BAO/SchemaHandler.php b/CRM/Core/BAO/SchemaHandler.php index 9dcae8fcda..4fa3c4dc1d 100644 --- a/CRM/Core/BAO/SchemaHandler.php +++ b/CRM/Core/BAO/SchemaHandler.php @@ -1,7 +1,7 @@ FIELD_CLASS_TYPE, * 'primary' => BOOLEAN, * 'required' => BOOLEAN, - * 'searchable' => true, + * 'searchable' => TRUE, * 'fk_table_name' => FOREIGN_KEY_TABLE_NAME, * 'fk_field_name' => FOREIGN_KEY_FIELD_NAME, * 'comment' => COMMENT, @@ -66,12 +66,11 @@ class CRM_Core_BAO_SchemaHandler { * * @param array $params * - * @return true if successfully created, false otherwise + * @return TRUE if successfully created, FALSE otherwise * * @static - * @access public */ - static function createTable(&$params) { + public static function createTable(&$params) { $sql = self::buildTableSQL($params); // do not i18n-rewrite $dao = CRM_Core_DAO::executeQuery($sql, array(), TRUE, NULL, FALSE, FALSE); @@ -81,7 +80,7 @@ class CRM_Core_BAO_SchemaHandler { if ($config->logging) { // logging support $logging = new CRM_Logging_Schema; - $logging->fixSchemaDifferencesFor($params['name'], null, FALSE); + $logging->fixSchemaDifferencesFor($params['name'], NULL, FALSE); } // always do a trigger rebuild for this table @@ -95,7 +94,7 @@ class CRM_Core_BAO_SchemaHandler { * * @return string */ - static function buildTableSQL(&$params) { + public static function buildTableSQL(&$params) { $sql = "CREATE TABLE {$params['name']} ("; if (isset($params['fields']) && is_array($params['fields']) @@ -132,7 +131,7 @@ class CRM_Core_BAO_SchemaHandler { * * @return string */ - static function buildFieldSQL(&$params, $separator, $prefix) { + public static function buildFieldSQL(&$params, $separator, $prefix) { $sql = ''; $sql .= $separator; $sql .= str_repeat(' ', 8); @@ -165,9 +164,9 @@ class CRM_Core_BAO_SchemaHandler { * @param $separator * @param $prefix * - * @return null|string + * @return NULL|string */ - static function buildPrimaryKeySQL(&$params, $separator, $prefix) { + public static function buildPrimaryKeySQL(&$params, $separator, $prefix) { $sql = NULL; if (!empty($params['primary'])) { $sql .= $separator; @@ -184,9 +183,9 @@ class CRM_Core_BAO_SchemaHandler { * @param $prefix * @param bool $indexExist * - * @return null|string + * @return NULL|string */ - static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) { + public static function buildSearchIndexSQL(&$params, $separator, $prefix, $indexExist = FALSE) { $sql = NULL; // dont index blob @@ -218,7 +217,7 @@ class CRM_Core_BAO_SchemaHandler { * * @return string */ - static function buildIndexSQL(&$params, $separator, $prefix) { + public static function buildIndexSQL(&$params, $separator, $prefix) { $sql = ''; $sql .= $separator; $sql .= str_repeat(' ', 8); @@ -250,7 +249,7 @@ class CRM_Core_BAO_SchemaHandler { * * @return bool */ - static function changeFKConstraint($tableName, $fkTableName) { + public static function changeFKConstraint($tableName, $fkTableName) { $fkName = "{$tableName}_entity_id"; if (strlen($fkName) >= 48) { $fkName = substr($fkName, 0, 32) . "_" . substr(md5($fkName), 0, 16); @@ -278,9 +277,9 @@ ALTER TABLE {$tableName} * @param $prefix * @param string $tableName * - * @return null|string + * @return NULL|string */ - static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) { + public static function buildForeignKeySQL(&$params, $separator, $prefix, $tableName) { $sql = NULL; if (!empty($params['fk_table_name']) && !empty($params['fk_field_name'])) { $sql .= $separator; @@ -304,7 +303,7 @@ ALTER TABLE {$tableName} * * @return bool */ - static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) { + public static function alterFieldSQL(&$params, $indexExist = FALSE, $triggerRebuild = TRUE) { $sql = str_repeat(' ', 8); $sql .= "ALTER TABLE {$params['table_name']}"; @@ -354,7 +353,7 @@ ALTER TABLE {$tableName} } } - if($triggerRebuild) { + if ($triggerRebuild) { CRM_Core_DAO::triggerRebuild($params['table_name']); } @@ -364,14 +363,15 @@ ALTER TABLE {$tableName} /** * Delete a civiCRM-table * - * @param String $tableName name of the table to be created. + * @param string $tableName + * Name of the table to be created. * - * @return true if successfully deleted, false otherwise + * @return bool + * TRUE if successfully deleted, FALSE otherwise. * * @static - * @access public */ - static function dropTable($tableName) { + public static function dropTable($tableName) { $sql = "DROP TABLE $tableName"; $dao = CRM_Core_DAO::executeQuery($sql); } @@ -380,7 +380,7 @@ ALTER TABLE {$tableName} * @param string $tableName * @param string $columnName */ - static function dropColumn($tableName, $columnName) { + public static function dropColumn($tableName, $columnName) { $sql = "ALTER TABLE $tableName DROP COLUMN $columnName"; $dao = CRM_Core_DAO::executeQuery($sql); } @@ -389,7 +389,7 @@ ALTER TABLE {$tableName} * @param string $tableName * @param bool $dropUnique */ - static function changeUniqueToIndex($tableName, $dropUnique = TRUE) { + public static function changeUniqueToIndex($tableName, $dropUnique = TRUE) { if ($dropUnique) { $sql = "ALTER TABLE $tableName DROP INDEX `unique_entity_id` , @@ -408,7 +408,7 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )"; * @param string $createIndexPrefix * @param array $substrLenghts */ - static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array()) { + public static function createIndexes(&$tables, $createIndexPrefix = 'index', $substrLenghts = array()) { $queries = array(); require_once 'CRM/Core/DAO/Domain.php'; $domain = new CRM_Core_DAO_Domain; @@ -475,7 +475,7 @@ ADD UNIQUE INDEX `unique_entity_id` ( `entity_id` )"; * * @throws Exception */ - static function alterFieldLength($customFieldID, $tableName, $columnName, $length) { + public static function alterFieldLength($customFieldID, $tableName, $columnName, $length) { // first update the custom field tables $sql = " UPDATE civicrm_custom_field @@ -517,10 +517,9 @@ MODIFY {$columnName} varchar( $length ) array( 1 => $tableName, 2 => $columnName, - 3 => $customFieldID + 3 => $customFieldID, ) )); } } } -