コード例 #1
0
 * @author		malanciault <marcan@impresscms.org)
 * @version		$Id: update-to-112.php 20426 2010-11-20 22:28:44Z phoenyx $
 */
/*
 * Migrate the db with new changes from 1.1 since 1.0
 * Note: many of these changes have been implemented in the upgrade script, which is essential in 1.1 because
 * of the new dbversion field we have added in the modules table. However, starting with release after 1.1, all
 * upgrade scripts will be added here. Doing so, only the System module will need to be updated by webmaster.
 */
$newDbVersion = 1;
if ($dbVersion <= $newDbVersion) {
    // Now, first, let's increment the conf_order of user option starting at new_user_notify
    $table = new icms_db_legacy_updater_Table('config');
    $criteria = new icms_db_criteria_Compo();
    $criteria->add(new icms_db_criteria_Item('conf_order', 3, '>'));
    $table->addUpdateAll('conf_order', 'conf_order + 2', $criteria, true);
    $icmsDatabaseUpdater->updateTable($table);
    unset($table);
    // create extended date function's config option
    $icmsDatabaseUpdater->insertConfig(ICMS_CONF, 'use_ext_date', '_MD_AM_EXT_DATE', 0, '_MD_AM_EXT_DATEDSC', 'yesno', 'int', 12);
    // create editors config option
    $icmsDatabaseUpdater->insertConfig(ICMS_CONF, 'editor_default', '_MD_AM_EDITOR_DEFAULT', 'default', '_MD_AM_EDITOR_DEFAULT_DESC', 'editor', 'text', 16);
    $icmsDatabaseUpdater->insertConfig(ICMS_CONF, 'editor_enabled_list', '_MD_AM_EDITOR_ENABLED_LIST', ".serialize(array('default')).", '_MD_AM_EDITOR_ENABLED_LIST_DESC', 'editor_multi', 'array', 16);
    // create captcha options
    $icmsDatabaseUpdater->insertConfig(ICMS_CONF, 'use_captchaf', '_MD_AM_USECAPTCHAFORM', 1, '_MD_AM_USECAPTCHAFORMDSC', 'yesno', 'int', 37);
    // create 4 new user config options
    $icmsDatabaseUpdater->insertConfig(ICMS_CONF_USER, 'use_captcha', '_MD_AM_USECAPTCHA', 1, '_MD_AM_USECAPTCHADSC', 'yesno', 'int', 3);
    $icmsDatabaseUpdater->insertConfig(ICMS_CONF_USER, 'welcome_msg', '_MD_AM_WELCOMEMSG', 0, '_MD_AM_WELCOMEMSGDSC', 'yesno', 'int', 3);
    // get the default content of the mail
    $default_msg_content_file = ICMS_ROOT_PATH . '/language/' . $icmsConfig['language'] . '/mail_template/' . 'welcome.tpl';
    if (!file_exists($default_msg_content_file)) {