当前位置: 首页>>代码示例>>PHP>>正文


PHP DBField::set_default方法代码示例

本文整理汇总了PHP中DBField::set_default方法的典型用法代码示例。如果您正苦于以下问题:PHP DBField::set_default方法的具体用法?PHP DBField::set_default怎么用?PHP DBField::set_default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBField的用法示例。


在下文中一共展示了DBField::set_default方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DBField

<?php

//upgrade from v1.2 to v1.3 (DB 2 -> 3)
//add new config values
set_config('date_format', 'd M Y');
set_config('time_format', 'H:i');
set_config('bbcode_privatemsg', 1);
echo '<li>RV3: Adding new config values... success</li>';
//update database structure
$db->drop_field('users', 'dst');
$new_timezone = new DBField('timezone', 'INT(3)');
$new_timezone->set_default(0);
$db->alter_field('users', $new_timezone);
$archived_fld = new DBField('archived', 'TINYINT(1)');
$archived_fld->add_extra('NOT NULL');
$archived_fld->set_default(0);
$db->add_field('forums', $archived_fld, 'num_posts');
echo '<li>RV3: Updating database structure... success</li>';
//convert all old timezones (just the UTC offset) to the new technique which uses the entire PHP dictionary
//map all UTC offsets to new timezones
$mappings = array(-12 => 383, -11 => 398, -10 => 53, -9 => 94, -8 => 132, -7 => 162, -6 => 144, -5 => 151, -4 => 84, -3 => 57, -2 => 295, -1 => 8, 0 => 415, 1 => 333, 2 => 327, 3 => 340, 4 => 230, 5 => 244, 6 => 266, 7 => 220, 8 => 271, 9 => 279, 10 => 309, 11 => 399, 12 => 385, 13 => 213);
//I hate mass queries as much as anyone, but they have to be done
foreach ($mappings as $oldtime => $newtime) {
    $db->query('UPDATE `#^users` SET timezone=' . $newtime . ' WHERE timezone=' . $oldtime) or enhanced_error('Failed to update timezone', true);
}
echo '<li>RV3: Converting timezones... success</li>';
ExtensionConfig::add_page('/styles', array('file' => 'style.php', 'template' => false, 'admin' => false, 'mod' => false, 'subdirs' => true));
ExtensionConfig::remove_page('/styles/default.css');
ExtensionConfig::remove_page('/styles/default.css/');
ExtensionConfig::remove_page('/styles/embed.css');
echo '<li>RV3: Adding missing pages... success</li>';
开发者ID:Cythral,项目名称:futurebb,代码行数:31,代码来源:3.php

示例2: DBField

$new_fld->add_extra('NOT NULL');
$tables['interface_history']->add_field($new_fld);
$new_fld = new DBField('field', 'VARCHAR(50)');
$new_fld->add_extra('NOT NULL');
$new_fld->set_default('\'\'');
$new_fld->set_default('\'\'');
$tables['interface_history']->add_field($new_fld);
$new_fld = new DBField('user', 'INT');
$new_fld->add_extra('NOT NULL');
$tables['interface_history']->add_field($new_fld);
$new_fld = new DBField('time', 'INT');
$new_fld->add_extra('NOT NULL');
$tables['interface_history']->add_field($new_fld);
$new_fld = new DBField('old_value', 'TEXT');
$new_fld->add_extra('NOT NULL');
$new_fld->set_default('\'\'');
$new_fld->set_default('\'\'');
$tables['interface_history']->add_field($new_fld);
$tables['interface_history']->commit();
echo '<li>RV2: Adding interface history table... success</li>';
//run through stock cache to insert pages and language keys
include FORUM_ROOT . '/app_config/cache/pages.php';
$q = 'INSERT INTO `#^pages`(url,file,template,nocontentbox,admin,moderator,subdirs) VALUES';
$page_insert_data = array();
$orig_pages = $pages;
$orig_pagessubdirs = $pagessubdirs;
include FORUM_ROOT . '/app_config/pages.php';
$pages = array_merge($pages, $orig_pages);
foreach ($pages as $url => $info) {
    $page_insert_data[] = '(\'' . $db->escape($url) . '\',\'' . $db->escape($info['file']) . '\',' . ($info['template'] ? '1' : '0') . ',' . (isset($info['nocontentbox']) ? '1' : '0') . ',' . (isset($info['admin']) && $info['admin'] ? '1' : '0') . ',' . (isset($info['mod']) && $info['mod'] ? '1' : '0') . ',0)';
}
开发者ID:Cythral,项目名称:futurebb,代码行数:31,代码来源:2.php

示例3: array

ExtensionConfig::add_page('/myimages', array('file' => 'myimages.php', 'template' => true));
set_config('user_image_maxwidth', 1024);
set_config('user_image_maxheight', 768);
set_config('user_image_maxsize', 512);
$table = new DBTable('userimages');
$new_fld = new DBField('id', 'INT');
$new_fld->add_key('PRIMARY');
$new_fld->add_extra('NOT NULL');
$new_fld->add_extra('AUTO_INCREMENT');
$table->add_field($new_fld);
$new_fld = new DBField('filename', 'VARCHAR(256)');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('user', 'INT');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('ip_addr', 'VARCHAR(50)');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('time', 'INT');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('extension', 'VARCHAR(10)');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$table->commit();
$new_fld = new DBField('g_upload_images', 'TINYINT(1)');
$new_fld->add_extra('NOT NULL');
$new_fld->set_default(0);
$db->add_field('user_groups', $new_fld, 'g_post_images');
$db->query('UPDATE `#^user_groups` SET g_upload_images=1 WHERE g_permanent=1') or enhanced_error('Failed to update user groups', true);
开发者ID:futuresight,项目名称:futurebb-image-uploading-extension,代码行数:31,代码来源:database.php

示例4: DBField

 $tables['user_groups']->add_field($new_fld);
 $new_fld = new DBField('g_access_board', 'TINYINT(1)');
 $new_fld->add_extra('NOT NULL');
 $new_fld->set_default('1');
 $tables['user_groups']->add_field($new_fld);
 $new_fld = new DBField('g_view_forums', 'TINYINT(1)');
 $new_fld->add_extra('NOT NULL');
 $new_fld->set_default('1');
 $tables['user_groups']->add_field($new_fld);
 $new_fld = new DBField('g_post_topics', 'TINYINT(1)');
 $new_fld->add_extra('NOT NULL');
 $new_fld->set_default('1');
 $tables['user_groups']->add_field($new_fld);
 $new_fld = new DBField('g_post_replies', 'TINYINT(1)');
 $new_fld->add_extra('NOT NULL');
 $new_fld->set_default('1');
 $tables['user_groups']->add_field($new_fld);
 $tables['user_groups']->commit();
 unset($tables);
 unset($new_fld);
 //add database data
 set_config('board_title', get_cookie_data('board_title'));
 set_config('announcement_text', '');
 set_config('announcement_enable', 0);
 set_config('online_timeout', 300);
 set_config('show_post_count', 1);
 set_config('sig_max_length', 0);
 set_config('sig_max_lines', 0);
 set_config('sig_max_height', 0);
 set_config('default_language', 'English');
 set_config('default_user_group', 3);
开发者ID:Cythral,项目名称:futurebb,代码行数:31,代码来源:install.php


注:本文中的DBField::set_default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。