1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

implement new phpbb::$acm object, replacing $cache global

git-svn-id: file:///svn/phpbb/trunk@9240 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2008-12-28 13:27:58 +00:00
parent fbaf2baa8d
commit 889fa87140
57 changed files with 543 additions and 774 deletions

View File

@@ -71,8 +71,8 @@ function phpbb_insert_forums()
$result = $src_db->sql_query($sql);
$prune_enabled = (int) $src_db->sql_fetchfield('config_value');
$src_db->sql_freeresult($result);
// Insert categories
$sql = 'SELECT cat_id, cat_title
FROM ' . $convert->src_table_prefix . 'categories
@@ -543,7 +543,7 @@ function phpbb_copy_table_fields()
*/
function phpbb_convert_authentication($mode)
{
global $db, $src_db, $same_db, $convert, $user, $config, $cache;
global $db, $src_db, $same_db, $convert, $user, $config;
if ($mode == 'start')
{
@@ -968,12 +968,12 @@ function phpbb_convert_authentication($mode)
{
// And now the moderators
// We make sure that they have at least standard access to the forums they moderate in addition to the moderating permissions
$mod_post_map = array(
'auth_announce' => 'f_announce',
'auth_sticky' => 'f_sticky'
);
foreach ($user_access as $forum_id => $access_map)
{
$forum_id = (int) $forum_id;
@@ -1223,7 +1223,7 @@ function phpbb_replace_size($matches)
*/
function phpbb_prepare_message($message)
{
global $db, $convert, $user, $config, $cache, $convert_row, $message_parser;
global $db, $convert, $user, $config, $convert_row, $message_parser;
if (!$message)
{
@@ -1247,7 +1247,7 @@ function phpbb_prepare_message($message)
{
$message = preg_replace('/\[quote="(.*?)"\]/s', '[quote="\1"]', $message);
$message = preg_replace('/\[quote=\\\"(.*?)\\\"\]/s', '[quote="\1"]', $message);
// let's hope that this solves more problems than it causes. Deal with escaped quotes.
$message = str_replace('\"', '"', $message);
$message = str_replace('\"', '"', $message);
@@ -1276,7 +1276,7 @@ function phpbb_prepare_message($message)
// parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')
$message_parser->parse($enable_bbcode, $enable_magic_url, $enable_smilies);
if (sizeof($message_parser->warn_msg))
{
$msg_id = isset($convert->row['post_id']) ? $convert->row['post_id'] : $convert->row['privmsgs_id'];
@@ -1328,7 +1328,7 @@ function phpbb_get_files_dir()
return;
}
global $src_db, $same_db, $convert, $user, $config, $cache;
global $src_db, $same_db, $convert, $user, $config;
if ($convert->mysql_convert && $same_db)
{
@@ -1367,10 +1367,10 @@ function phpbb_get_files_dir()
*/
function phpbb_copy_thumbnails()
{
global $db, $convert, $user, $config, $cache;
global $db, $convert, $user, $config;
$src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/';
if ($handle = @opendir($src_path))
{
while ($entry = readdir($handle))
@@ -1449,13 +1449,13 @@ function phpbb_attachment_forum_perms($forum_permissions)
$pos--;
continue;
}
$forum_auth = substr($forum_permissions, $pos, $auth_len);
$forum_id = base64_unpack($forum_auth);
$forum_ids[] = (int) $forum_id;
}
if (sizeof($forum_ids))
{
return attachment_forum_perms($forum_ids);
@@ -1534,7 +1534,7 @@ function phpbb_import_avatar($user_avatar)
function phpbb_get_avatar_height($user_avatar)
{
global $convert_row;
if (empty($convert_row['user_avatar_type']))
{
return 0;
@@ -1554,7 +1554,7 @@ function phpbb_get_avatar_width($user_avatar)
{
return 0;
}
return get_avatar_width($user_avatar, 'phpbb_avatar_type', $convert_row['user_avatar_type']);
}

View File

@@ -83,7 +83,6 @@ else
}
$user = new user();
$cache = new acm();
$db = new $sql_db();
// Connect to DB
@@ -652,7 +651,7 @@ _write_result($no_updates, $errored, $error_ary);
if (!$inline_update)
{
// Purge the cache...
$cache->purge();
phpbb::$acm->purge();
?>
<p style="color:red"><?php echo $lang['UPDATE_FILES_NOTICE']; ?></p>
@@ -676,7 +675,7 @@ else
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
// Now we purge the session table as well as all cache files
$cache->purge();
phpbb::$acm->purge();
?>

View File

@@ -240,7 +240,6 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle
$user = new user();
$auth = new auth();
$cache = new acm();
$template = new template();
// Set some standard variables we want to force

View File

@@ -90,7 +90,7 @@ class install_convert extends module
function main($mode, $sub)
{
global $lang, $template, $cache, $config, $language, $table_prefix;
global $lang, $template, $config, $language, $table_prefix;
global $convert;
$this->tpl_name = 'install_convert';
@@ -213,7 +213,7 @@ class install_convert extends module
// If we reached this step (conversion completed) we want to purge the cache and log the user out.
// This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
$cache->purge();
phpbb::$acm->purge();
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
@@ -333,7 +333,7 @@ class install_convert extends module
*/
function get_convert_settings($sub)
{
global $lang, $language, $template, $db, $config, $cache;
global $lang, $language, $template, $db, $config;
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
@@ -581,7 +581,7 @@ class install_convert extends module
*/
function convert_data($sub)
{
global $template, $user, $db, $lang, $config, $cache;
global $template, $user, $db, $lang, $config;
global $convert, $convert_row, $message_parser, $skip_rows, $language;
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
@@ -1438,7 +1438,7 @@ class install_convert extends module
*/
function sync_forums($sync_batch)
{
global $template, $user, $db, $config, $cache;
global $template, $user, $db, $config;
global $convert;
$template->assign_block_vars('checks', array(
@@ -1578,7 +1578,7 @@ class install_convert extends module
*/
function final_jump($final_jump)
{
global $template, $user, $src_db, $same_db, $db, $config, $cache;
global $template, $user, $src_db, $same_db, $db, $config;
global $convert;
$template->assign_block_vars('checks', array(
@@ -1617,7 +1617,7 @@ class install_convert extends module
*/
function jump($jump, $last_statement)
{
global $template, $user, $src_db, $same_db, $db, $config, $cache;
global $template, $user, $src_db, $same_db, $db, $config;
global $convert;
$template->assign_block_vars('checks', array(
@@ -1743,7 +1743,7 @@ class install_convert extends module
// TODO: sync() is likely going to bomb out on forums with a considerable amount of topics.
// TODO: the sync function is able to handle FROM-TO values, we should use them here (batch processing)
sync('forum', '', '', false, true);
$cache->destroy('sql', FORUMS_TABLE);
phpbb::$acm->destroy_sql(FORUMS_TABLE);
$template->assign_block_vars('checks', array(
'TITLE' => $user->lang['SYNC_FORUMS'],
@@ -1920,7 +1920,7 @@ class install_convert extends module
*/
function process_row(&$schema, &$sql_data, &$insert_values)
{
global $template, $user, $db, $lang, $config, $cache;
global $template, $user, $db, $lang, $config;
global $convert, $convert_row;
$sql_flag = false;

View File

@@ -70,7 +70,7 @@ class install_update extends module
function main($mode, $sub)
{
global $template, $user, $db, $config, $cache, $auth;
global $template, $user, $db, $config, $auth;
$this->tpl_name = 'install_update';
$this->page_title = 'UPDATE_INSTALLATION';
@@ -122,17 +122,17 @@ class install_update extends module
// If we are within the intro page we need to make sure we get up-to-date version info
if ($sub == 'intro')
{
$cache->destroy('_version_info');
phpbb::$acm->destroy('version_info');
}
// Set custom template again. ;)
$template->set_custom_template('../adm/style', 'admin');
// Get current and latest version
if (($latest_version = $cache->get('_version_info')) === false)
if (($latest_version = phpbb::$acm->get('version_info')) === false)
{
$this->latest_version = $this->get_file('version_info');
$cache->put('_version_info', $this->latest_version);
phpbb::$acm->put('version_info', $this->latest_version);
}
else
{
@@ -224,8 +224,8 @@ class install_update extends module
));
// Make sure the update list is destroyed.
$cache->destroy('_update_list');
$cache->destroy('_diff_files');
phpbb::$acm->destroy('update_list');
phpbb::$acm->destroy('diff_files');
break;
case 'version_check':
@@ -273,7 +273,7 @@ class install_update extends module
}
// Just a precaution
$cache->purge();
phpbb::$acm->purge();
// Redirect the user to the database update script with some explanations...
$template->assign_vars(array(
@@ -289,7 +289,7 @@ class install_update extends module
case 'file_check':
// Make sure the previous file collection is no longer valid...
$cache->destroy('_diff_files');
phpbb::$acm->destroy('diff_files');
$this->page_title = 'STAGE_FILE_CHECK';
@@ -297,8 +297,8 @@ class install_update extends module
$action = request_var('action', '');
// We are directly within an update. To make sure our update list is correct we check its status.
$update_list = (phpbb_request::variable('check_again', false, false, phpbb_request::POST)) ? false : $cache->get('_update_list');
$modified = ($update_list !== false) ? @filemtime($cache->cache_dir . 'data_update_list.' . PHP_EXT) : 0;
$update_list = (phpbb_request::variable('check_again', false, false, phpbb_request::POST)) ? false : phpbb::$acm->get('update_list');
$modified = ($update_list !== false) ? phpbb::$acm->get_modified_date('data', 'update_list') : 0;
// Make sure the list is up-to-date
if ($update_list !== false)
@@ -326,7 +326,7 @@ class install_update extends module
if ($get_new_list)
{
$this->get_update_structure($update_list);
$cache->put('_update_list', $update_list);
phpbb::$acm->put('update_list', $update_list);
// Refresh the page if we are still not finished...
if ($update_list['status'] != -1)
@@ -497,7 +497,7 @@ class install_update extends module
WHERE theme_id = ' . $theme['theme_id'];
$db->sql_query($sql);
$cache->destroy('sql', STYLES_THEME_TABLE);
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
}
}
@@ -505,7 +505,7 @@ class install_update extends module
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
$db->sql_return_on_error(false);
$cache->purge();
phpbb::$acm->purge();
}
break;
@@ -544,7 +544,7 @@ class install_update extends module
}
// Before the user is choosing his preferred method, let's create the content list...
$update_list = $cache->get('_update_list');
$update_list = phpbb::$acm->get('update_list');
if ($update_list === false)
{
@@ -601,7 +601,7 @@ class install_update extends module
// Before we do anything, let us diff the files and store the raw file information "somewhere"
$get_files = false;
$file_list = $cache->get('_diff_files');
$file_list = phpbb::$acm->get('diff_files');
if ($file_list === false || $file_list['status'] != -1)
{
@@ -642,7 +642,7 @@ class install_update extends module
// Refresh if we reach 5 diffs...
if ($processed >= 5)
{
$cache->put('_diff_files', $file_list);
phpbb::$acm->put('diff_files', $file_list);
if (request_var('download', false))
{
@@ -687,8 +687,8 @@ class install_update extends module
break;
}
$file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']);
$cache->put($file_list[$file_struct['filename']], base64_encode($contents));
$file_list[$file_struct['filename']] = 'file_' . md5($file_struct['filename']);
phpbb::$acm->put($file_list[$file_struct['filename']], base64_encode($contents));
$file_list['status']++;
$processed++;
@@ -732,8 +732,8 @@ class install_update extends module
break;
}
$file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']);
$cache->put($file_list[$file_struct['filename']], base64_encode($contents));
$file_list[$file_struct['filename']] = 'file_' . md5($file_struct['filename']);
phpbb::$acm->put($file_list[$file_struct['filename']], base64_encode($contents));
$file_list['status']++;
$processed++;
@@ -745,7 +745,7 @@ class install_update extends module
}
$file_list['status'] = -1;
$cache->put('_diff_files', $file_list);
phpbb::$acm->put('diff_files', $file_list);
if (request_var('download', false))
{
@@ -784,7 +784,7 @@ class install_update extends module
);
// To ease the update process create a file location map
$update_list = $cache->get('_update_list');
$update_list = phpbb::$acm->get('update_list');
$script_path = ($config['force_server_vars']) ? (($config['script_path'] == '/') ? '/' : $config['script_path'] . '/') : $user->page['root_script_path'];
foreach ($update_list as $status => $files)
@@ -974,7 +974,7 @@ class install_update extends module
case 'modified':
$contents = base64_decode($cache->get($file_list[$file_struct['filename']]));
$contents = base64_decode(phpbb::$acm->get($file_list[$file_struct['filename']]));
if ($update_mode == 'download')
{
@@ -990,7 +990,7 @@ class install_update extends module
case 'conflict':
$contents = base64_decode($cache->get($file_list[$file_struct['filename']]));
$contents = base64_decode(phpbb::$acm->get($file_list[$file_struct['filename']]));
if ($update_mode == 'download')
{