本文整理汇总了PHP中generate_config_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_config_cache函数的具体用法?PHP generate_config_cache怎么用?PHP generate_config_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_config_cache函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore
function restore()
{
global $db;
$db->query('DELETE FROM ' . $db->prefix . 'config WHERE conf_name = \'o_welcome_mp\' LIMIT 1;') or error('Unable to alter DB structure.', __FILE__, __LINE__, $db->error());
$db->query('DELETE FROM ' . $db->prefix . 'config WHERE conf_name = \'o_welcome_message_mp\' LIMIT 1;') or error('Unable to alter DB structure.', __FILE__, __LINE__, $db->error());
// Regenerate the config cache
require_once PUN_ROOT . 'include/cache.php';
generate_config_cache();
}
示例2: install
function install()
{
global $db, $db_type, $pun_config;
//include PUN_ROOT.'include/attach/attach_incl.php';
//first look if we have attachment mod 2.0
if ($pun_config['attach_cur_version'] != '2.0') {
error('You must have the attachment mod 2.0 installed before updating from it.');
}
// ok, update the rules so that no rule is larger than what is max allowed...
$db->query('UPDATE ' . $db->prefix . 'attach_2_rules SET size = \'' . $pun_config['attach_max_size'] . '\' WHERE size > \'' . $pun_config['attach_max_size'] . '\'') or error('Unable to update the maxsize in existing rules to the maxsize for the whole forum');
// and then update the cache ...
$db->query('UPDATE ' . $db->prefix . 'config SET conf_value = \'' . $db->escape('2.0.1') . '\' WHERE conf_name = \'attach_cur_version\'') or error('Unable to edit row "attach_cur_version" in config table', __FILE__, __LINE__, $db->error());
// and now, update the cache...
require_once PUN_ROOT . 'include/cache.php';
generate_config_cache();
}
示例3: install
function install($basepath = '')
{
global $db, $db_type, $pun_config;
//include PUN_ROOT.'include/attach/attach_incl.php';
//first check so that the path seems reasonable
if (!((substr($basepath, 0, 1) == '/' || substr($basepath, 1, 1) == ':') && substr($basepath, -1) == '/')) {
error('The pathname specified doesn\'t comply with the rules set. Go back and make sure that it\'s the complete path, and that it ends with a slash and that it either start with a slash (example: "/home/username/attachments/", on *nix servers (unix, linux, bsd, solaris etc.)) or a driveletter (example: "C:/webpages/attachments/" on windows servers)');
}
// create the neccessary tables
// create the files table
$db->query("CREATE TABLE IF NOT EXISTS `" . $db->prefix . "attach_2_files` (\r\n\t\t`id` int(10) unsigned NOT NULL auto_increment,\r\n\t\t`owner` int(10) unsigned NOT NULL default '0',\r\n \t\t`post_id` int(10) unsigned NOT NULL default '0',\r\n \t\t`filename` varchar(255) NOT NULL default 'error.file',\r\n \t\t`extension` varchar(64) NOT NULL default 'error.file',\r\n \t\t`mime` varchar(64) NOT NULL default '',\r\n \t\t`location` text NOT NULL,\r\n \t\t`size` int(10) unsigned NOT NULL default '0',\r\n \t\t`downloads` int(10) unsigned NOT NULL default '0',\r\n \t\tUNIQUE KEY `id` (`id`)) ENGINE=MyISAM;") or error('Unable to add table "attach_2_files" to database', __FILE__, __LINE__, $db->error());
// create the rules table
$db->query("CREATE TABLE IF NOT EXISTS `" . $db->prefix . "attach_2_rules` (\r\n \t\t`id` int(10) unsigned NOT NULL auto_increment,\r\n \t\t`forum_id` int(10) unsigned NOT NULL default '0',\r\n \t\t`group_id` int(10) unsigned NOT NULL default '0',\r\n \t\t`rules` int(10) unsigned NOT NULL default '0',\r\n \t\t`size` int(10) unsigned NOT NULL default '0',\r\n \t\t`per_post` tinyint(4) NOT NULL default '1',\r\n \t\t`file_ext` text NOT NULL,\r\n \t\tUNIQUE KEY `id` (`id`)) ENGINE=MyISAM;") or error('Unable to add table "attach_2_rules" to database', __FILE__, __LINE__, $db->error());
//ok path could be correct, try to make a subfolder :D
$newname = attach_generate_pathname($basepath);
if (!attach_create_subfolder($newname, $basepath)) {
error('Unable to create new subfolder with name "' . $newname . '", make sure php has write access to that folder!', __FILE__, __LINE__);
}
// ok, add the stuff needed in the config cache
$attach_config = array('attach_always_deny' => 'html"htm"php"php3"php4"exe"com"bat', 'attach_basefolder' => $basepath, 'attach_create_orphans' => '1', 'attach_cur_version' => '2.0.1', 'attach_icon_folder' => 'img/attach/', 'attach_icon_extension' => 'txt"doc"pdf"wav"mp3"ogg"avi"mpg"mpeg"png"jpg"jpeg"gif', 'attach_icon_name' => 'text.png"doc.png"doc.png"audio.png"audio.png"audio.png"video.png"video.png"video.png"image.png"image.png"image.png"image.png', 'attach_max_size' => '2000', 'attach_subfolder' => $newname, 'attach_use_icon' => '1');
foreach ($attach_config as $key => $value) {
$db->query("INSERT INTO " . $db->prefix . "config (conf_name, conf_value) VALUES ('{$key}', '" . $db->escape($value) . "')") or error('Unable to add column "' . $key . '" to config table', __FILE__, __LINE__, $db->error());
}
// and now, update the cache...
require_once PUN_ROOT . 'include/cache.php';
generate_config_cache();
/*
DO MOD INSTALLATION HERE
Here's an example showing how to run different queries depending on $db_type.
NOTE: This is just an example! Replace it with whatever queries your mod needs to run.
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$db->query("ALTER TABLE ".$db->prefix."some_table ADD some_column TINYINT(1) NOT NULL DEFAULT 1") or error('Unable to add column "some_column" to table "some_table"', __FILE__, __LINE__, $db->error());
break;
default:
$db->query('ALTER TABLE ".$db->prefix."some_table ADD some_column INT(10) NOT NULL DEFAULT 1') or error('Unable to add column "some_column" to table "some_table"', __FILE__, __LINE__, $db->error());
break;
}
*/
}
示例4: update_permissions
public function update_permissions()
{
global $lang_admin_permissions;
$form = array_map('intval', $this->request->post('form'));
foreach ($form as $key => $input) {
// Make sure the input is never a negative value
if ($input < 0) {
$input = 0;
}
// Only update values that have changed
if (array_key_exists('p_' . $key, $this->config) && $this->config['p_' . $key] != $input) {
DB::for_table('config')->where('conf_name', 'p_' . $key)->update_many('conf_value', $input);
}
}
// Regenerate the config cache
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require FEATHER_ROOT . 'include/cache.php';
}
generate_config_cache();
redirect(get_link('admin/permissions/'), $lang_admin_permissions['Perms updated redirect']);
}
示例5: install
function install()
{
global $db, $db_type, $pun_config;
$sql1 = 'CREATE TABLE ' . $db->prefix . "chatbox_msg (\r\n id int(10) NOT NULL AUTO_INCREMENT,\r\n poster VARCHAR(200) default NULL,\r\n poster_id INT(10) NOT NULL DEFAULT '1',\r\n poster_ip VARCHAR(15) default NULL,\r\n poster_email VARCHAR(50) default NULL,\r\n message TEXT,\r\n posted INT(10) NOT NULL default '0',\r\n PRIMARY KEY (id)\r\n ) TYPE=MyISAM;";
$db->query($sql1) or error('Unable to create table ' . $db->prefix . 'chatbox_msg.', __FILE__, __LINE__, $db->error());
$sql2 = 'ALTER TABLE ' . $db->prefix . "groups\r\n ADD g_read_chatbox TINYINT(1) default '1' NOT NULL ,\r\n ADD g_post_chatbox TINYINT(1) default '1' NOT NULL ,\r\n ADD g_title_chatbox TEXT default NULL,\r\n ADD g_post_flood_chatbox SMALLINT(6) default '5' NOT NULL";
$db->query($sql2) or error('Unable to add column to groups table.', __FILE__, __LINE__, $db->error());
$sql3 = 'ALTER TABLE ' . $db->prefix . "users\r\n ADD num_posts_chatbox INT(10) NOT NULL default '0',\r\n ADD last_post_chatbox INT(10) default NULL";
$db->query($sql3) or error('Unable to add column to users table.', __FILE__, __LINE__, $db->error());
$chatbox_config = array('cb_height' => '500', 'cb_msg_maxlength' => '300', 'cb_max_msg' => '50', 'cb_disposition' => '<strong><pun_username></strong> - <pun_date> - [ <pun_nbpost><pun_nbpost_txt> ] <pun_admin><br /><pun_message><br /><br />', 'cb_pbb_version' => '1.0');
foreach ($chatbox_config as $key => $value) {
$db->query("INSERT INTO " . $db->prefix . "config (conf_name, conf_value) VALUES ('{$key}', '" . $db->escape($value) . "')") or error('Unable to add column "' . $key . '" to config table', __FILE__, __LINE__, $db->error());
}
$db->query('UPDATE ' . $db->prefix . 'groups SET g_title_chatbox=\'<strong>[Admin]</strong> - \', g_read_chatbox=1, g_post_chatbox=1, g_post_flood_chatbox=0 WHERE g_id=1') or error('Unable to update group', __FILE__, __LINE__, $db->error());
$db->query('UPDATE ' . $db->prefix . 'groups SET g_title_chatbox=\'<strong>[Modo]</strong> - \', g_read_chatbox=1, g_post_chatbox=1, g_post_flood_chatbox=0 WHERE g_id=2') or error('Unable to update group', __FILE__, __LINE__, $db->error());
$db->query('UPDATE ' . $db->prefix . 'groups SET g_read_chatbox=1, g_post_chatbox=0, g_post_flood_chatbox=10 WHERE g_id=3') or error('Unable to update group', __FILE__, __LINE__, $db->error());
$db->query('UPDATE ' . $db->prefix . 'groups SET g_read_chatbox=1, g_post_chatbox=1, g_post_flood_chatbox=5 WHERE g_id=4') or error('Unable to update group', __FILE__, __LINE__, $db->error());
// and now, update the cache...
require_once PUN_ROOT . 'include/cache.php';
generate_config_cache();
/*
DO MOD INSTALLATION HERE
Here's an example showing how to run different queries depending on $db_type.
NOTE: This is just an example! Replace it with whatever queries your mod needs to run.
switch ($db_type)
{
case 'mysql':
case 'mysqli':
$db->query("ALTER TABLE ".$db->prefix."some_table ADD some_column TINYINT(1) NOT NULL DEFAULT 1") or error('Unable to add column "some_column" to table "some_table"', __FILE__, __LINE__, $db->error());
break;
default:
$db->query('ALTER TABLE ".$db->prefix."some_table ADD some_column INT(10) NOT NULL DEFAULT 1') or error('Unable to add column "some_column" to table "some_table"', __FILE__, __LINE__, $db->error());
break;
}
*/
}
示例6: define
define('FORUM_MOD', 2);
define('FORUM_GUEST', 3);
define('FORUM_MEMBER', 4);
// Load DB abstraction layer and connect
require FORUM_ROOT . 'include/dblayer/common_db.php';
// Start a transaction
$db->start_transaction();
// Load cached config
if (file_exists(FORUM_CACHE_DIR . 'cache_config.php')) {
include FORUM_CACHE_DIR . 'cache_config.php';
}
if (!defined('FORUM_CONFIG_LOADED')) {
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require FORUM_ROOT . 'include/cache.php';
}
generate_config_cache();
require FORUM_CACHE_DIR . 'cache_config.php';
}
// Let's guess a base_url
if (!isset($base_url)) {
$base_url_take = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://') . preg_replace('/:80$/', '', $_SERVER['HTTP_HOST']) . str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
if (substr($base_url_take, -1) == '/') {
$base_url_take = substr($base_url_take, 0, -1);
}
if (substr($base_url_take, -10) == '/backstage') {
$base_url_take = substr($base_url_take, 0, -10);
}
$base_url = $base_url_take;
}
// Verify that we are running the proper database schema revision
if (!array_key_exists('o_core_version', $luna_config) || version_compare($luna_config['o_core_version'], Version::FORUM_CORE_VERSION, '<')) {
示例7: update_options
//.........这里部分代码省略.........
}
$styles = forum_list_styles();
if (!in_array($form['default_style'], $styles)) {
message($lang_common['Bad request'], '404');
}
if ($form['time_format'] == '') {
$form['time_format'] = 'H:i:s';
}
if ($form['date_format'] == '') {
$form['date_format'] = 'Y-m-d';
}
require FEATHER_ROOT . 'include/email.php';
if (!is_valid_email($form['admin_email'])) {
message($lang_admin_options['Invalid e-mail message']);
}
if (!is_valid_email($form['webmaster_email'])) {
message($lang_admin_options['Invalid webmaster e-mail message']);
}
if ($form['mailing_list'] != '') {
$form['mailing_list'] = strtolower(preg_replace('%\\s%S', '', $form['mailing_list']));
}
// Make sure avatars_dir doesn't end with a slash
if (substr($form['avatars_dir'], -1) == '/') {
$form['avatars_dir'] = substr($form['avatars_dir'], 0, -1);
}
if ($form['additional_navlinks'] != '') {
$form['additional_navlinks'] = feather_trim(feather_linebreaks($form['additional_navlinks']));
}
// Change or enter a SMTP password
if ($this->request->post('form_smtp_change_pass')) {
$smtp_pass1 = $this->request->post('form_smtp_pass1') ? feather_trim($this->request->post('form_smtp_pass1')) : '';
$smtp_pass2 = $this->request->post('form_smtp_pass2') ? feather_trim($this->request->post('form_smtp_pass2')) : '';
if ($smtp_pass1 == $smtp_pass2) {
$form['smtp_pass'] = $smtp_pass1;
} else {
message($lang_admin_options['SMTP passwords did not match']);
}
}
if ($form['announcement_message'] != '') {
$form['announcement_message'] = feather_linebreaks($form['announcement_message']);
} else {
$form['announcement_message'] = $lang_admin_options['Enter announcement here'];
$form['announcement'] = '0';
}
if ($form['rules_message'] != '') {
$form['rules_message'] = feather_linebreaks($form['rules_message']);
} else {
$form['rules_message'] = $lang_admin_options['Enter rules here'];
$form['rules'] = '0';
}
if ($form['maintenance_message'] != '') {
$form['maintenance_message'] = feather_linebreaks($form['maintenance_message']);
} else {
$form['maintenance_message'] = $lang_admin_options['Default maintenance message'];
$form['maintenance'] = '0';
}
// Make sure the number of displayed topics and posts is between 3 and 75
if ($form['disp_topics_default'] < 3) {
$form['disp_topics_default'] = 3;
} elseif ($form['disp_topics_default'] > 75) {
$form['disp_topics_default'] = 75;
}
if ($form['disp_posts_default'] < 3) {
$form['disp_posts_default'] = 3;
} elseif ($form['disp_posts_default'] > 75) {
$form['disp_posts_default'] = 75;
}
if ($form['feed_type'] < 0 || $form['feed_type'] > 2) {
message($lang_common['Bad request'], '404');
}
if ($form['feed_ttl'] < 0) {
message($lang_common['Bad request'], '404');
}
if ($form['report_method'] < 0 || $form['report_method'] > 2) {
message($lang_common['Bad request'], '404');
}
if ($form['default_email_setting'] < 0 || $form['default_email_setting'] > 2) {
message($lang_common['Bad request'], '404');
}
if ($form['timeout_online'] >= $form['timeout_visit']) {
message($lang_admin_options['Timeout error message']);
}
foreach ($form as $key => $input) {
// Only update values that have changed
if (array_key_exists('o_' . $key, $this->config) && $this->config['o_' . $key] != $input) {
if ($input != '' || is_int($input)) {
DB::for_table('config')->where('conf_name', 'o_' . $key)->update_many('conf_value', $input);
} else {
DB::for_table('config')->where('conf_name', 'o_' . $key)->update_many_expr('conf_value', 'NULL');
}
}
}
// Regenerate the config cache
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require FEATHER_ROOT . 'include/cache.php';
}
generate_config_cache();
clear_feed_cache();
redirect(get_link('admin/options/'), $lang_admin_options['Options updated redirect']);
}
示例8: generate_cache
/**
* Regenerate FluxBB cache after conversion
*/
function generate_cache()
{
// Load the cache script
require_once PUN_ROOT . 'include/cache.php';
// Generate cache
generate_config_cache();
generate_bans_cache();
generate_quickjump_cache();
generate_censoring_cache();
generate_users_info_cache();
clear_feed_cache();
}
示例9: bb2_write_settings
function bb2_write_settings($settings, $install = false)
{
global $db;
while (list($key, $input) = @each($settings)) {
if ($key == 'log_table') {
continue;
}
$input = intval($input);
if ($install) {
$db->query('INSERT INTO ' . $db->prefix . 'config (conf_name, conf_value) VALUES (\'o_badbehavior_' . $db->escape($key) . '\', ' . $input . ')') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
} else {
$db->query('UPDATE ' . $db->prefix . 'config SET conf_value=' . $input . ' WHERE conf_name=\'o_badbehavior_' . $db->escape($key) . '\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
}
}
// Regenerate the config cache
require_once PUN_ROOT . 'include/cache.php';
generate_config_cache();
}
示例10: set_default_group
public function set_default_group($groups)
{
global $lang_admin_groups, $lang_common;
$group_id = intval($this->request->post('default_group'));
// Make sure it's not the admin or guest groups
if ($group_id == FEATHER_ADMIN || $group_id == FEATHER_GUEST) {
message($lang_common['Bad request'], '404');
}
// Make sure it's not a moderator group
if ($groups[$group_id]['g_moderator'] != 0) {
message($lang_common['Bad request'], '404');
}
DB::for_table('config')->where('conf_name', 'o_default_user_group')->update_many('conf_value', $group_id);
// Regenerate the config cache
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require FEATHER_ROOT . 'include/cache.php';
}
generate_config_cache();
redirect(get_link('admin/groups/'), $lang_admin_groups['Default group redirect']);
}