Comments (6)
Some untested code for class-theme-updater.php.
private function append_theme_actions_content( $theme ){
$details_url = self_admin_url( "theme-install.php?tab=theme-information&theme=$theme->repo&TB_iframe=true&width=270&height=400" );
$theme_update_transient = get_site_transient( 'update_themes' );
//if the theme is outdated, display the custom theme updater content
//if theme is not present in theme_update transient response ( theme is not up to date )
ob_start();
if ( empty( $theme_update_transient->up_to_date[$theme->repo] ) ) {
$update_url = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . urlencode( $theme->repo ), 'upgrade-theme_' . $theme->repo );
?>
<strong>There is a new version of <?php echo $theme->name; ?> available now. <a href="<?php echo $details_url; ?>" class="thickbox" title="<?php echo $theme->name; ?>">View version <?php echo $theme->remote_version; ?> details</a> or <a href="<?php echo $update_url; ?>">update now</a>.</strong>
<?php
}
//display the custom rollback/beta version updater all the time
$rollback_url = sprintf( '%s%s', wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . urlencode( $theme->repo ), 'upgrade-theme_' . $theme->repo ), '&rollback=' );
?>
<p>Try <a href="#" onclick="jQuery('#ghu_versions').toggle();return false;">another version?</a></p>
<div id="ghu_versions" style="display:none; width: 100%;">
<select style="width: 60%;"
onchange="if(jQuery(this).val() != '') {
jQuery(this).next().show();
jQuery(this).next().attr('href','<?php echo $rollback_url ?>'+jQuery(this).val());
}
else jQuery(this).next().hide();
">
<option value="">Choose a Version...</option>
<option><?php echo $theme->branch; ?></option>
<?php foreach ( $theme_update_transient->up_to_date[$theme->repo]['rollback'] as $version => $url ){echo'<option>'.$version.'</option>';}?></select>
<a style="display: none;" class="button-primary" href="?">Install</a>
</div>
<?php
return trim( ob_get_clean(), '1' );
}
from git-updater.
Firstly you must remember rollback is only for themes, not plugins.
I'm not sure I like the aesthetic of seeing the rollback all the time. In the instance you show, if you have an update pending and still want to rollback to a previous version, you could just do the update and then do a rollback right after. There's no time delay.
@scarstens what do you think?
At this time I'm not convinced of the need as this can be accomplished already, just with an extra click or two.
from git-updater.
Indeed. The purpose of the rollback function is to enable you to "update without worry" since you can always go back to the previous version if it doesn't work. Thus, its an end user function more then a developer function. While we do enable the updates to development versions (for developers) the goal is not to serve developers as a way to move around.
One would hope if you are using GIT to bounce between versions, that GIT already allows you to move your local code between tags. Develop locally and as you move between tags you will automatically update your site with the version you desire. Since this is already the development model built around GIT I don't see any reason to rebuilt it into the web GUI.
Its not to say your use case isn't viable, but the workaround of clicking update before you rollback should not prohibit you from moving between versions should you decide not to use GIT the way it was intended to be used on local development.
@afragen I do believe the rollback functionality for plugins should be enabled, since a plugin could break a site and need to be rolled back as well. Any idea where we should start to accomplish this? I'll be happy to find a way to build the UI in the admin area if you will provide a means of pulling the rollback on the server side.
from git-updater.
That being said, you could develop your own plugin to extend the updater that you would use and install on development sites only. Should you decide to do that, and run into any issues please let me know and I'll do what I can to assist you in your extension.
from git-updater.
@scarstens perhaps a new issue re: plugin rollback to get a sense of what others think.
from git-updater.
Not a problem guys, thanks for your efforts. I am using it for development purposes (and not for scheduled, bug tested roll outs). I came across a bug that you would click 'update' because there was a new version, and it would go to do update but then would say the theme is already up-to-date. I assumed it was because of the limited number of times you could poll github for changes, and just wanted a 'force pull' button, which is what the rollback also conveniently provides.
If the use case is particular to me, I'll just modify my own code and use it in that way. Thanks again, it's been super helpful.
from git-updater.
Related Issues (20)
- Version 12.1.3 and WordPress 6.2 causes PHP error in backend (PHP8.0) HOT 1
- 'We made a few tweaks to the plugin, Opt in to make "Git Updater" better'! link broken HOT 4
- Problem of CSS layout in changelog tab HOT 6
- Version number issue: Version: 0.2.41 does not update to Version: 0.2.5 HOT 1
- 404 Error can't get updates HOT 4
- An error occurred while updating WebHeroe: Update package not available. HOT 4
- Persistent license reminder on network admin screens on multisite installs HOT 4
- Cron refresh never finishes HOT 1
- GitHub Updater Error Code: 401 HOT 1
- Consider `main` as default branch (instead of `master`) HOT 1
- Possible to include branch name in assets? HOT 2
- "Doing it wrong" message in Query Monitor HOT 2
- GitHub Access Token disappears HOT 5
- Análisis Auth
- discouraged Improvements HOT 1
- Please be patient while WP-Cron finishes making API calls. HOT 5
- Header information HOT 1
- Theme deleted during update HOT 8
- Dockerized Project - style.css not in the root of the repo HOT 25
- Git-Updater website login HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-updater.