From edba2f1082eb4018b8270eec158d6f37b15f736e Mon Sep 17 00:00:00 2001 From: nikitozzzzzzz Date: Thu, 7 Jun 2018 23:02:18 +0300 Subject: [PATCH] - fixed email templates upgrade; --- .../core/packages/2.0-beta1/email_templates.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/admin/core/packages/2.0-beta1/email_templates.php b/includes/admin/core/packages/2.0-beta1/email_templates.php index ba09c9d4..fa046e5e 100644 --- a/includes/admin/core/packages/2.0-beta1/email_templates.php +++ b/includes/admin/core/packages/2.0-beta1/email_templates.php @@ -147,6 +147,20 @@ function um_upgrade20beta1_email_templates_process() { if ( file_exists( $theme_template_path_html ) ) { + $temp_path = str_replace( trailingslashit( get_stylesheet_directory() ), '', $theme_template_path ); + $temp_path = str_replace( '/', DIRECTORY_SEPARATOR, $temp_path ); + $folders = explode( DIRECTORY_SEPARATOR, $temp_path ); + $folders = array_splice( $folders, 0, count( $folders ) - 1 ); + $cur_folder = ''; + $theme_dir = trailingslashit( get_stylesheet_directory() ); + foreach ( $folders as $folder ) { + $prev_dir = $cur_folder; + $cur_folder .= $folder . DIRECTORY_SEPARATOR; + if ( ! is_dir( $theme_dir . $cur_folder ) && wp_is_writable( $theme_dir . $prev_dir ) ) { + mkdir( $theme_dir . $cur_folder, 0777 ); + } + } + if ( copy( $theme_template_path_html, $theme_template_path ) ) { um_upgrade20beta1_insert_content( $theme_template_path, $setting_value );