From 7924d903b08967428656b2b53557063e55a15735 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 12 Oct 2003 09:11:33 +0000 Subject: [PATCH] comment out optimize block (Ashe, please review) moved phpbb_unlink to functions_admin (used in more than one script) git-svn-id: file:///svn/phpbb/trunk@4572 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 52b50b7077..bffe9451a8 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -342,6 +342,8 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE) sync('topic_reported', $where_type, $where_ids); } + // Not an option here, deleting one post takes > 200 seconds for me (only this query) +/* // Optimize/vacuum tables switch (SQL_LAYER) { @@ -358,6 +360,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE) $db->sql_query('VACUUM'); break; } +*/ return $return; } @@ -418,6 +421,8 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE) sync('forum', 'forum_id', $forum_ids, TRUE); } + // Not an option here, deleting one post takes > 200 seconds for me (only this query) +/* // Optimize/vacuum tables switch (SQL_LAYER) { @@ -434,6 +439,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE) $db->sql_query('VACUUM'); break; } +*/ return count($post_ids); } @@ -693,6 +699,32 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = TRUE) } } +// Delete File +function phpbb_unlink($filename, $mode = 'file') +{ + global $config, $user; + + $filename = ($mode == 'thumbnail') ? $config['upload_dir'] . '/thumbs/t_' . $filename : $config['upload_dir'] . '/' . $filename; + $deleted = @unlink($filename); + + if (file_exists($filename)) + { + $filesys = str_replace('/','\\', $filename); + $deleted = @system("del $filesys"); + + if (file_exists($filename)) + { + @chmod($filename, 0777); + if (!($deleted = @unlink($filename))) + { + $deleted = @system("del $filename"); + } + } + } + + return $deleted; +} + // All-encompasing sync function // // Usage: