Open danyork opened 12 years ago
The upgrader_source_selection_filter function in upgrader.php addresses this issue. If there are a set of steps to reliably reproduce this problem, I can look into it.
I am seeing this as well. New 3.4.1 WP install. Theme directory being renamed based upon git username, git repository and then seven character/digit combination. End result is after theme update the theme is no longer active.
BTW, now after renaming theme folder back, pushing a new tag to see if it works, I get the following error.
An error occurred while updating DRMCMedStaff: Update package not available..
Here's my repo, (https://github.com/afragen/drmcmedstaff) btw I don't think the instructions are correct. If I adde 'repo' to the end of this URI I get a 404 from github.
Update: error no longer present, theme updating and still selected, however theme folder renamed Username-TagName-Hash
Agreed, having the same issue with the plugin. Note that the code I posted on the GIST with the version I use for the Whitelabel theme doesn't have this issue.
**All of this theme’s files are located in /themes/WordPress-Phoenix-whitelabel-framework-63a0b74.
This should just be /themes/whitelabel-framework
I am still unable to reproduce this issue with a fresh WordPress install and the latest version of the theme updater. I even tried it with your theme, Dan, and there was no problem. There only thing I can think of is that there is a conflict with some other plugin involving the upgrader_source_selection filter.
I think this is failing:
if(isset($source, $remote_source, $upgrader->skin->theme)){
As that was the issue for me. I'm trying to get you more information now but this part of the code is much harder to test.
Quick and dirty: add a die(var_dump($source, $remote_source, $upgrader->skin->theme)); above that line to see which one is empty.
Ok, have more info. Reference this GIST I used to debug... which might not be bad to leave in the plugin in general: https://gist.github.com/3219354
I got this response, also note that I have disabled the themes "updater" so there is nothing else running, no plugins except this plugin:
Updating Theme Whitelabel Framework (1/1) Downloading update from https://github.com/WordPress-Phoenix/whitelabel-framework/zipball/1.2.2… Unpacking the update… Installing the latest version… Executing upgrader_source_selection_filter()... !![SOURCE SELECTION FILTER FAILED]!! $source:'/home/ibseth2/public_html/wlwp.sethmatics.com/wp-content/upgrade/1.tmp/WordPress-Phoenix-whitelabel-framework-63a0b74/' $remote_source:'/home/ibseth2/public_html/wlwp.sethmatics.com/wp-content/upgrade/1.tmp'
Notice: Undefined property: Bulk_Theme_Upgrader_Skin::$theme in /home/ibseth2/public_html/wlwp.sethmatics.com/wp-content/plugins/UCF-Theme-Updater/updater.php on line 161 $upgrader->skin->theme:NULL Removing the old version of the theme… Theme updated successfully.
Note that I am using the "bulk theme upgrader" from the updates panel:
/wp-admin/update-core.php
Ah. That may explain the issue. I've been testing it from the Themes panel.
More good info: http://phpdoc.wordpress.org/trunk/WordPress/Upgrader/Bulk_Theme_Upgrader_Skin.html
And the output of this object when upgrading: WP_Theme::__set_state(array( 'theme_root' => '/home/ibseth2/public_html/wlwp.sethmatics.com/wp-content/themes/', 'headers' => array ( 'Github Theme URI' => 'https://github.com/WordPress-Phoenix/whitelabel-framework', 'Name' => 'Whitelabel Framework', 'ThemeURI' => 'http://whitelabelframework.com/?github=updater_installed', 'Description' => 'Whitelabel Framework is designed to be the ideal Parent Theme for child theme development, and for use by freelancers and web developers to easily convert PSD to WordPress child themes. The theme options were built as modules, so turning off theme functionality is easy when you prefer to use a plugin instead.', 'Author' => 'Sethmatics', 'AuthorURI' => 'http://sethmatics.com/', 'Version' => '0.2.3', 'Template' => '', 'Status' => '', 'Tags' => 'white, black, orange, two-columns, left-sidebar, fixed-width, blavatar, custom-background, custom-header, custom-menu, editor-style, featured-image-header, featured-images, full-width-template, post-formats, sticky-post, theme-options, threaded-comments', 'TextDomain' => '', 'DomainPath' => '', ), 'headers_sanitized' => array ( 'Name' => 'Whitelabel Framework', 'TextDomain' => '', ), 'name_translated' => NULL, 'errors' => NULL, 'stylesheet' => 'WordPress-Phoenix-whitelabel-framework-63a0b74', 'template' => 'WordPress-Phoenix-whitelabel-framework-63a0b74', 'parent' => NULL, 'theme_root_uri' => NULL, 'textdomain_loaded' => false, 'cache_hash' => '8ac8410b603ee21d725c7e14d3c43a46', ))
i think we are approaching the solution now
I understand what the issue is but I haven't been able to fix it yet. I won't have any time to work on this again until the end of the week though. Hopefully the issue will be fixed by the end of next week.
I have a fix, a little while I will do a pull request and you can take a look at my solution
I have been having this problem as well :)
your welcome to give my fork of the plugin a try if you can figure out how to update your files: https://github.com/scarstens/Theme-Updater
@scarstens I installed your fork, updated from the core-update.php and watched the plugin indicate that it updated correctly.
Updating Theme DRMCMedStaff (1/1) Downloading update from https://github.com/afragen/drmcmedstaff/zipball/0.8… Unpacking the update… Installing the latest version… Executing upgrader_source_selection_filter function... Renamed theme folder successfully. Removing the old version of the theme… Plugin reactivated successfully.Theme updated successfully.
Then I found that my theme vanished. Folder deleted from server. I tried this twice with same result.
and my twentyeleven folder now has my themes files, totally removing my twentyeleven theme.
On the upside using v.1.3.7 from the Themes page, does update correctly, issue clearly is with the core-update.php part
is this a "child theme" that you are trying to update via GitHub? I definitely did not account for trying to update a childtheme using this plugin and believe I have it coded in to update based on the "template" foldername. honestly it would be better for the plugin to have an option to turn on debugging. I may build that tomorrow as the output used to be much more comprehensive in the version I built for my theme.
yes it is a child theme of twentyeleven, I'm happy to keep installing it and testing, But could you make some change so I can tell from the plugin page that it's your forked version. ;-)
you can try my fork again. No I can't change the plugin to appear different in the repository because I submit my requested changes using the code from the fork. I wouldn't want any of the "temporary" changes to ever get accidently accepted into the main fork of the plugin.
@scarstens I can now confirm that your fork works here under the following conditions from both the Themes update and from core-update.php. In both cases the folder name for the theme stays the same as whatever it was. Example, if the folder name was [user]-[repo]-[hash] it will remain [user]-[repo]-[hash] after the update. If it was [repo] before, it will be [repo] after.
I was expecting the folder to be renamed [repo] as I would expect the script to grab the name from the [repo] and not base it on the name on my server. Is that an unrealistic or unexpected expectation?
Thanks.
@afragen think about what that would do to a parent theme if the parent themes folder name changed on update... you would break all the child themes that reference it by "template" which was the folder name the theme was installed into. I think the way its currently setup works best.
I agree. The only reason I was seeing the [user]-[repo]-[hash] folder in the first place was because of the initial updating error.
Great to see the issue getting sorted out, even if I haven't yet run into it. Thank you all for working on it!
I'll note that the only times I was ever seeing [user]-[repo]-[hash] for the theme folder was when I was having people download the theme using the "Download as zip" button on the main Github page for my repo. This created a zip file using that algorithm for the folder name. When I upload that to the my site, it then installs into a [user]-[repo]-[hash] folder. However, once installed I have NOT seen it change, i.e. it continues to use the name. (And now I have people download a specific ZIP file that I have zipped up with the format of "[repo]", and that name, too, does not change.)
This seems to be exactly what I was seeing re: naming
Yes, we built a "theme installer" for our theme to handle this issue. Your welcome to check it out: https://github.com/WordPress-Phoenix/whitelabel-framework/tree/Installer
It basically just a version of the theme that has no relevant contents, but it knows upon activation to go out and grab the latest version of itself from Github.
I noticed that there is an issue in the WordPress Forums related to the theme directory being renamed after an autoupdate:
http://wordpress.org/support/topic/plugin-theme-updater-changed-theme-path-after-upgrade
I've not experienced this myself, but I thought I'd log the issue here.