| 1 |
<?php |
<?php |
| 2 |
// $Id: filter.install,v 1.33 2010/03/04 21:42:00 dries Exp $ |
// $Id: filter.install,v 1.34 2010/03/05 13:32:09 dries Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 54 |
), |
), |
| 55 |
), |
), |
| 56 |
'primary key' => array('format', 'name'), |
'primary key' => array('format', 'name'), |
|
'unique keys' => array( |
|
|
'fmn' => array('format', 'module', 'name'), |
|
|
), |
|
| 57 |
'indexes' => array( |
'indexes' => array( |
| 58 |
'list' => array('weight', 'module', 'name'), |
'list' => array('weight', 'module', 'name'), |
| 59 |
), |
), |
| 158 |
*/ |
*/ |
| 159 |
|
|
| 160 |
/** |
/** |
| 161 |
* Add a weight column to the filter formats table. |
* Increase the size of {filters}.weight and add {filter_formats}.weight. |
| 162 |
*/ |
*/ |
| 163 |
function filter_update_7000() { |
function filter_update_7000() { |
| 164 |
db_add_field('filter_formats', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')); |
// The list index will be recreated by filter_update_7003(). |
| 165 |
db_add_index('filter_formats', 'weight', array('weight')); |
db_drop_index('filters', 'list'); |
| 166 |
|
|
| 167 |
|
// Change the weight column of the filter table to normal (ie. non tiny) int. |
| 168 |
|
db_change_field('filters', 'weight', 'weight', array( |
| 169 |
|
'type' => 'int', |
| 170 |
|
'not null' => TRUE, |
| 171 |
|
'default' => 0, |
| 172 |
|
'description' => 'Weight of filter within format.', |
| 173 |
|
)); |
| 174 |
|
|
| 175 |
|
// Add a new filter_format.weight column. |
| 176 |
|
db_add_field('filter_formats', 'weight', array( |
| 177 |
|
'type' => 'int', |
| 178 |
|
'not null' => TRUE, |
| 179 |
|
'default' => 0, |
| 180 |
|
'description' => 'Weight of text format to use when listing.', |
| 181 |
|
), array( |
| 182 |
|
'indexes' => array( |
| 183 |
|
'weight' => array('weight'), |
| 184 |
|
), |
| 185 |
|
)); |
| 186 |
} |
} |
| 187 |
|
|
| 188 |
/** |
/** |
| 234 |
), |
), |
| 235 |
); |
); |
| 236 |
|
|
| 237 |
// Rename field 'delta' to 'name'. |
// The unique key on (filter, module, delta) is not necessary anymore, |
| 238 |
|
// as filter_update_7004() will add a primary key on (filter, name). |
| 239 |
db_drop_unique_key('filter', 'fmd'); |
db_drop_unique_key('filter', 'fmd'); |
| 240 |
db_drop_index('filter', 'list'); |
|
| 241 |
|
// Rename field 'delta' to 'name'. |
| 242 |
db_change_field('filter', 'delta', 'name', |
db_change_field('filter', 'delta', 'name', |
| 243 |
array( |
array( |
| 244 |
'type' => 'varchar', |
'type' => 'varchar', |
| 248 |
'description' => 'Name of the filter being referenced.', |
'description' => 'Name of the filter being referenced.', |
| 249 |
), |
), |
| 250 |
array( |
array( |
|
'unique keys' => array( |
|
|
'fmn' => array('format', 'module', 'name'), |
|
|
), |
|
| 251 |
'indexes' => array( |
'indexes' => array( |
| 252 |
'list' => array('format', 'weight', 'module', 'name'), |
'list' => array('weight', 'module', 'name'), |
| 253 |
), |
), |
| 254 |
) |
) |
| 255 |
); |
); |
| 424 |
} |
} |
| 425 |
|
|
| 426 |
/** |
/** |
|
* Remove the 'format' column from 'list' index on {filter}. |
|
|
*/ |
|
|
function filter_update_7006() { |
|
|
db_drop_index('filter', 'list'); |
|
|
db_add_index('filter', 'list', array('weight', 'module', 'name')); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Change the weight columns to normal int. |
|
|
*/ |
|
|
function filter_update_7007() { |
|
|
db_drop_index('filter', 'list'); |
|
|
db_change_field('filter', 'weight', 'weight', array( |
|
|
'type' => 'int', |
|
|
'not null' => TRUE, |
|
|
'default' => 0, |
|
|
'description' => 'Weight of filter within format.', |
|
|
), array( |
|
|
'indexes' => array( |
|
|
'list' => array('weight', 'module', 'name'), |
|
|
), |
|
|
)); |
|
|
|
|
|
db_drop_index('filter_format', 'weight'); |
|
|
db_change_field('filter_format', 'weight', 'weight', array( |
|
|
'type' => 'int', |
|
|
'not null' => TRUE, |
|
|
'default' => 0, |
|
|
'description' => 'Weight of text format to use when listing.', |
|
|
), array( |
|
|
'indexes' => array( |
|
|
'weight' => array('weight'), |
|
|
), |
|
|
)); |
|
|
} |
|
|
|
|
|
/** |
|
| 427 |
* Grant usage of all text formats to user roles having the 'administer filters' permission. |
* Grant usage of all text formats to user roles having the 'administer filters' permission. |
| 428 |
*/ |
*/ |
| 429 |
function filter_update_7008() { |
function filter_update_7008() { |