diff --git a/.gitignore b/.gitignore index 264946d..bd3ce64 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,7 @@ CVS *~ ._* .DS_Store -Thumbs.db \ No newline at end of file +Thumbs.db + +dwsync.xml +/_notes \ No newline at end of file diff --git a/updater.php b/updater.php index b7f1ac7..ee7a2f3 100755 --- a/updater.php +++ b/updater.php @@ -8,8 +8,6 @@ Version: 1.3.7 */ -require_once('assets.php'); - // register the custom stylesheet header add_action( 'extra_theme_headers', 'github_extra_theme_headers' ); function github_extra_theme_headers( $headers ) { @@ -17,12 +15,20 @@ function github_extra_theme_headers( $headers ) { return $headers; } -add_filter('site_transient_update_themes', 'transient_update_themes_filter'); +//disable updater during core wordpress updates +if(!empty($_GET['action']) && $_GET['action'] == 'do-core-reinstall'); +else { + add_filter('site_transient_update_themes', 'transient_update_themes_filter'); + require_once('assets.php'); +} + function transient_update_themes_filter($data){ global $wp_version; - $installed_themes = get_themes( ); + if(function_exists('wp_get_themes')) $installed_themes = wp_get_themes( ); + else $installed_themes = get_themes( ); foreach ( (array) $installed_themes as $theme_title => $_theme ) { + // the WP_Theme object is very different now... // This whole function should be refactored to not directly // rely on the $theme variable the way it does @@ -141,15 +147,29 @@ function upgrader_source_selection_filter($source, $remote_source=NULL, $upgrade Github delivers zip files as --.zip must rename this zip file to the accurate theme folder */ - if(isset($source, $remote_source, $upgrader->skin->theme)){ - $corrected_source = $remote_source . '/' . $upgrader->skin->theme . '/'; + $upgrader->skin->feedback("Executing upgrader_source_selection_filter function..."); + if(isset($upgrader->skin->theme)) + $correct_theme_name = $upgrader->skin->theme; + elseif(isset($upgrader->skin->theme_info->stylesheet)) + $correct_theme_name = $upgrader->skin->theme_info->stylesheet; + elseif(isset($upgrader->skin->theme_info->template)) + $correct_theme_name = $upgrader->skin->theme_info->template; + else + $upgrader->skin->feedback('Theme name not found. Unable to rename downloaded theme.'); + + if(isset($source, $remote_source, $correct_theme_name)){ + $corrected_source = $remote_source . '/' . $correct_theme_name . '/'; if(@rename($source, $corrected_source)){ + $upgrader->skin->feedback("Renamed theme folder successfully."); return $corrected_source; } else { - $upgrader->skin->feedback("Unable to rename downloaded theme."); + $upgrader->skin->feedback("**Unable to rename downloaded theme."); return new WP_Error(); } } + else + $upgrader->skin->feedback('**Source or Remote Source is unavailable.'); + return $source; }