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
This commit is contained in:
rboren 2005-02-12 19:34:50 +00:00
parent e509af852c
commit 5e68548c89

View File

@ -593,13 +593,17 @@ function make_site_theme_from_default($theme_name, $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');
//$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"))
$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/$file", 0777);
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.