From 5e68548c897612972c9fdd389b708b7bb308c28b Mon Sep 17 00:00:00 2001 From: rboren Date: Sat, 12 Feb 2005 19:34:50 +0000 Subject: [PATCH] Copy searchform and images when creating site theme from default theme. http://mosquito.wordpress.org/view.php?id=852 git-svn-id: http://svn.automattic.com/wordpress/trunk@2293 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/upgrade-functions.php | 35 +++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index f4ba437b0f..49ffc79e84 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -592,14 +592,18 @@ function make_site_theme_from_default($theme_name, $template) { $site_dir = ABSPATH . "wp-content/themes/$template"; $default_dir = ABSPATH . 'wp-content/themes/default'; -// Copy files from the default theme to the site theme. - $files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css'); + // Copy files from the default theme to the site theme. + //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css'); - foreach ($files as $file) { - if (! @copy("$default_dir/$file", "$site_dir/$file")) - return; - - chmod("$site_dir/$file", 0777); + $theme_dir = @ dir("$default_dir"); + if ($theme_dir) { + while(($theme_file = $theme_dir->read()) !== false) { + if (is_dir("$default_dir/$theme_file")) + continue; + if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file")) + return; + chmod("$site_dir/$theme_file", 0777); + } } // Rewrite the theme header. @@ -617,6 +621,23 @@ function make_site_theme_from_default($theme_name, $template) { } fclose($f); } + + // Copy the images. + umask(0); + if (! mkdir("$site_dir/images", 0777)) { + return false; + } + + $images_dir = @ dir("$default_dir/images"); + if ($images_dir) { + while(($image = $images_dir->read()) !== false) { + if (is_dir("$default_dir/images/$image")) + continue; + if (! @copy("$default_dir/images/$image", "$site_dir/images/$image")) + return; + chmod("$site_dir/images/$image", 0777); + } + } } // Create a site theme from the default theme.