Exemplo n.º 1
0
// foreach (safe_rows('id, name', 'txp_section', '1=1') as $row) {
//	safe_update('textpattern', "section_id='".doSlash($row['id'])."'", "Section='".doSlash($row['name'])."'");
//}
// fix up the parent field in txp_category
safe_query("alter ignore table " . safe_pfx('txp_category') . " modify parent INT not null");
$types = safe_column('distinct type', 'txp_category', '1=1');
foreach ($types as $type) {
    $root = safe_field('id', 'txp_category', "type='" . doSlash($type) . "' and name='root' and parent=0");
    if (!$root) {
        $root = safe_insert('txp_category', "name='root', type='" . doSlash($type) . "', parent=0");
    }
    safe_update('txp_category', "parent='" . $root . "'", "type='" . doSlash($type) . "' and parent=0 and id != '" . $root . "'");
    tree_rebuild_full('txp_category', "type='" . doSlash($type) . "'");
}
// index on form type
safe_upgrade_index('txp_form', 'type_idx', '', 'type');
// dropdown ui for certain prefs
safe_upgrade_table('txp_prefs', array('choices' => 'varchar(64)'));
safe_update('txp_prefs', "html='checkbox'", "html='yesnoradio'");
safe_update('txp_prefs', "html='text'", "html='text_input'");
safe_update('txp_prefs', "choices='commentmode', html='select'", "html='commentmode'");
safe_update('txp_prefs', "choices='logging', html='select'", "html='logging'");
safe_update('txp_prefs', "choices='production_stati', html='radio'", "html='prod_levels'");
safe_update('txp_prefs', "choices='gmtoffsets', html='select'", "html='gmtoffset_select'");
safe_update('txp_prefs', "choices='weeks', html='select'", "html='weeks'");
safe_update('txp_prefs', "choices='languages', html='select'", "html='languages'");
safe_update('txp_prefs', "choices='permlinkmodes', html='radio'", "html='permlinkmodes'");
safe_update('txp_prefs', "choices='dateformats', html='select'", "html='dateformats'");
// change previous Textile prefs into matching markup class names from classMarkup.php
$use_textile = safe_field('val', 'txp_prefs', "name='use_textile'");
$markups = array('txprawxhtml', 'txptextile', 'txpnl2br');
Exemplo n.º 2
0
 function create_table()
 {
     parent::create_table();
     safe_upgrade_index($this->_table_name, 'prefs_idx', 'UNIQUE', 'prefs_id,name');
     safe_upgrade_index($this->_table_name, 'name', '', 'name');
 }