* 'class' => 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,
*
* @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);
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
*
* @return string
*/
- static function buildTableSQL(&$params) {
+ public static function buildTableSQL(&$params) {
$sql = "CREATE TABLE {$params['name']} (";
if (isset($params['fields']) &&
is_array($params['fields'])
*
* @return string
*/
- static function buildFieldSQL(&$params, $separator, $prefix) {
+ public static function buildFieldSQL(&$params, $separator, $prefix) {
$sql = '';
$sql .= $separator;
$sql .= str_repeat(' ', 8);
* @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;
* @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
*
* @return string
*/
- static function buildIndexSQL(&$params, $separator, $prefix) {
+ public static function buildIndexSQL(&$params, $separator, $prefix) {
$sql = '';
$sql .= $separator;
$sql .= str_repeat(' ', 8);
*
* @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);
* @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;
*
* @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']}";
}
}
- if($triggerRebuild) {
+ if ($triggerRebuild) {
CRM_Core_DAO::triggerRebuild($params['table_name']);
}
/**
* 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);
}
* @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);
}
* @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` ,
* @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;
*
* @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
array(
1 => $tableName,
2 => $columnName,
- 3 => $customFieldID
+ 3 => $customFieldID,
)
));
}
}
}
-