Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show ZenCache version number in Plugin Options #502

Closed
raamdev opened this issue Jun 12, 2015 · 50 comments
Closed

Show ZenCache version number in Plugin Options #502

raamdev opened this issue Jun 12, 2015 · 50 comments

Comments

@raamdev
Copy link
Contributor

@raamdev raamdev commented Jun 12, 2015

The installed ZenCache plugin version should be clearly visible from the ZenCache Plugin Options panel, somewhere at the top:

2015-06-11_20-37-29

@raamdev raamdev added this to the Future Release milestone Jun 12, 2015
@raamdev raamdev modified the milestones: Next Release (Pro), Future Release Jul 10, 2015
@jaswrks
Copy link

@jaswrks jaswrks commented Jul 29, 2015

Next Actions (for Renz on Windows)

Create a directory on your computer (in your $HOME directory) to hold WebSharks-related projects. I suggest ~/projects/websharks; where ~ is your $HOME directory.

Open Git Bash and Create Directories

$ mkdir -p ~/projects/websharks # Make these two directories.

Clone the ZenCache Pro Repo

$ cd ~/projects/websharks # Move into this directory.
$ git clone https://github.com/websharks/zencache-pro

Satisfy Dependencies

$ cd ~/projects/websharks/zencache-pro # Move into the ZenCache repo.
$ composer install # Run composer to install dependencies locally.

Start a New Feature Branch

$ cd ~/projects/websharks/zencache-pro # Move into the ZenCache repo.
$ git checkout 000000-dev # Always start from the dev branch.
$ git checkout -b feature/502 # A new feature branch for this issue; i.e., issue number 502

Make Changes

Following the details outlined by @raamdev above, we need some new HTML markup in this file, somewhere inside of this div, as seen in the files listed below:

Note: I am referencing these files as they exist on GitHub. However, the changes that you make should be in an editor of your choosing; i.e., you work from files in your local repo clone.

Generating the Markup

The current plugin version is a PHP Constant named: VERSION

echo '<div class="plugin-menu-page-version">'.esc_html(VERSION).'</div>'."\n";

That's just a basic example. You might need to dress things up a bit.

Styling this div...

You can add styles in this file: https://github.com/websharks/zencache-pro/blob/150716/src/client-s/css/menu-pages.css


Commit and Push Changes to GitHub

$ cd ~/projects/websharks/zencache-pro # Move into the ZenCache repo.
$ git add --all && git commit -m 'Adding version to menu pages; see: websharks/zencache#502'
$ git push -u origin feature/502 # Push to GitHub

If you get an error when doing the push, please contact @raamdev and ask for permission.


Open a Pull Request @ GitHub

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Aug 5, 2015

I just realized that it would be nice to show both the installed version number and the 'latest' version number, if different. This could also show something like "Upgrade now" if there's a newer version.

@renzms
Copy link

@renzms renzms commented Aug 6, 2015

Taking note of that Raam, and will adjust accordingly as I test and fix the parse error from: wpsharks/comet-cache-pro#126

renzms added a commit to wpsharks/comet-cache-pro that referenced this issue Aug 6, 2015
@renzms
Copy link

@renzms renzms commented Aug 6, 2015

Tested on wordpress installation

502 branch zencache

@jaswrks
Copy link

@jaswrks jaswrks commented Aug 7, 2015

@raamdev writes...

I just realized that it would be nice to show both the installed version number and the 'latest' version number, if different. This could also show something like "Upgrade now" if there's a newer version.

Here is the endpoint URL to acquire the latest pro version:
http://zencache.com/?product_api[action]=latest_pro_version

{"pro_version":150716}

A JSON object is returned by this API with the pro_version property.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Aug 7, 2015

@renzms Cool! It's looking better. :-) Here's some feedback on design and how I feel the various states should affect the text:

Note that I included the CSS style attributes in-line only for demonstration purposes; those styles should, of course, be moved to the appropriate place.


ZenCache Pro (latest version)

2015-08-07_14-20-47

<div class="plugin-menu-page-version" style="
    float: right;
    clear: right;
    min-width: 350px;
    margin: 0.5em 0 0 0;
    text-align: center;
"><span>ZenCache™ Pro v150722 (<a href="https://zencache.com/changelog/">changelog</a>)</span></div>

ZenCache Pro (update available)

2015-08-07_14-22-58

<div class="plugin-menu-page-version" style="
    float: right;
    clear: right;
    min-width: 350px;
    margin: 0.5em 0 0 0;
    text-align: center;
"><span>ZenCache™ Pro v150722 (<strong><a href="?page=zencache-pro-updater">update available!</a></strong>)</span></div>

ZenCache Lite (latest version)

2015-08-07_14-15-21

<div class="plugin-menu-page-version" style="
    float: right;
    clear: right;
    min-width: 350px;
    margin: 0.5em 0 0 0;
    text-align: center;
"><span>ZenCache™ Lite v150722 (<a href="http://zencache.com/changelog-lite/">changelog</a>)</span></div>

ZenCache Lite (update available)

2015-08-07_14-17-46

<div class="plugin-menu-page-version" style="
    float: right;
    clear: right;
    min-width: 350px;
    margin: 0.5em 0 0 0;
    text-align: center;
"><span>ZenCache™ Lite v150722 (<strong><a href="https://wordpress.org/plugins/zencache/changelog/">update available!</a></strong>)</span></div>
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Aug 7, 2015

@renzms For the Pro version, when there's an update available, note that you should build the link to the Pro Updater page like this (see this line from the Pro version):

esc_attr(add_query_arg(urlencode_deep(array('page' => GLOBAL_NS.'-pro-updater')), self_admin_url('/admin.php')))
raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Aug 8, 2015
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Aug 8, 2015

@renzms FYI, I just noticed that it looks like you accidentally committed something to the 000000-dev branch (instead of to your feature branch) way back when you started this:

2015-08-08_11-15-55

I reverted the commit (wpsharks/comet-cache-pro@a38fac0) and will merge changes from this PR instead when it's ready.

Please make sure that you're only committing work to your feature branch and not to 000000-dev.

@renzms
Copy link

@renzms renzms commented Aug 8, 2015

@raamdev Thanks for heads up, I apologize for that one, I think that one slipped in when I was first starting on it, and as you said, even with errors it could publish without warning to the 00000 Branch. Won't happen again, been using git status 3 times before I push anything, then I just check once more.

👍 Measure twice, cut once.

@renzms
Copy link

@renzms renzms commented Aug 10, 2015

@raamdev
502 branch zencache2

Both the changelog and the update seem to be showing, how do I make it either/or?

Also, is it redundant to have the Update Available Link show up on the Updater Page?

@renzms
Copy link

@renzms renzms commented Aug 10, 2015

Also, after I polish up the pro - version changes, I'm assuming I will need to open a new branch for the lite version here - https://github.com/websharks/zencache/branches to commit the lite - version changes of #502?

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Aug 10, 2015

Won't happen again,
Measure twice, cut once.

Cool. No worries. :-)


I noticed in the screenshot it says V 150722; it should say v150722.


Also, is it redundant to have the Update Available Link show up on the Updater Page?

No, I think it's fine there. The "Update Available" link is more about indicating to a site owner that an update is, in fact, available, which you cannot tell by the Updater Page alone. So I'd say it's fine to leave that there, even on the Updater Page.


Both the changelog and the update seem to be showing, how do I make it either/or?

Jason mentioned earlier that the latest Pro version could be pulled like this:

Here is the endpoint URL to acquire the latest pro version:
http://zencache.com/?product_api[action]=latest_pro_version

{"pro_version":150716}

A JSON object is returned by this API with the pro_version property.

@jaswsinc Do you by any chance have any code examples for @renzms to look at where you're already using this endpoint?

@jaswsinc Regarding getting the latest Lite version number: Any thoughts on how to best do that? Maybe the answer to that question will depend on the work we still need to do in https://github.com/websharks/zencache.com/issues/61?


Also, after I polish up the pro - version changes, I'm assuming I will need to open a new branch for the lite version here - https://github.com/websharks/zencache/branches to commit the lite - version changes of #502?

Correct. You'll follow the same procedure as you did for creating a feature/502 branch for the ZenCache Pro repo; simply create the same branch for the ZenCache Lite (i.e., websharks/zencache/) repo, make your changes, push, then open a Pull Request for review.

Keep in mind the ZenCache Lite codebase looks quite different from the ZenCache Pro codebase, which was recently restructured.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Aug 22, 2015

@jaswsinc Ping ↑

@jaswrks
Copy link

@jaswrks jaswrks commented Aug 22, 2015

@jaswsinc Do you by any chance have any code examples for @renzms to look at where you're already using this endpoint?

I updated this routine recently, which already does a periodic check for the latest Pro version.

See: https://github.com/websharks/zencache-pro/blob/000000-dev/src/includes/closures/Plugin/UpdateUtils.php#L32-L34

So now that this is in place, you can simply print the latest pro version with:

echo $this->plugin->options['latest_pro_version'];
@jaswrks
Copy link

@jaswrks jaswrks commented Aug 22, 2015

@jaswsinc Regarding getting the latest Lite version number: Any thoughts on how to best do that? Maybe the answer to that question will depend on the work we still need to do in websharks/zencache.com#61?

Right. I suspect we can use this API. It's intended for stats, but it also gives us the version.
https://api.wordpress.org/stats/plugin/1.0/zencache

@jaswrks
Copy link

@jaswrks jaswrks commented Aug 23, 2015

See also, full list of WordPress APIs:
https://codex.wordpress.org/WordPress.org_API

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Sep 19, 2015

During v150919-RC testing, I noticed that the version number on the option pages is misaligned on some of the pages. On Plugin Options it looks fine centered, but on Cache Stats and Plugin Updater it looks very odd centered and should instead be right-aligned.

Plugin Options

2015-09-18_20-54-05

Cache Stats

2015-09-18_20-54-19

Plugin Updater

2015-09-18_20-54-30


In fact, if we simply right-align it on all of the pages, that will work too. Here's what it looks like right-aligned on the Plugin Options page:

2015-09-18_20-59-17


The bit of CSS that needs to be changed is:

.plugin-menu-page-heading .plugin-menu-page-version { text-align: center; }

should be:

.plugin-menu-page-heading .plugin-menu-page-version { text-align: right; }
@raamdev raamdev reopened this Sep 19, 2015
renzms added a commit to wpsharks/comet-cache-pro that referenced this issue Sep 23, 2015
@renzms
Copy link

@renzms renzms commented Sep 23, 2015

plugin options renz s test area wordpress 3

@raamdev I used $ git checkout 000000-dev to get the updated copy

version showing is v150821, should I have used v150919-RC as the base?

Created new Branch: feature/502-styling-update

Haven't submitted a pull request yet.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Sep 24, 2015

@renzms I merged your feature/502-styling-update branch into the release/150919 branch and the 000000-dev branch. No need to submit a PR. Thanks! :-)

@raamdev raamdev closed this Sep 24, 2015
@renzms
Copy link

@renzms renzms commented Sep 24, 2015

@raamdev Alright, cool! Thanks.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Oct 2, 2015

ZenCache Pro v151002 has been released and includes changes from this GitHub Issue.

See the ZenCache Pro v151002 release announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#502).

@wpsharks wpsharks locked and limited conversation to collaborators Oct 2, 2015
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Nov 22, 2015

@jaswsinc writes in #502 (comment)...

What comes next is that we need to deal with the lite version, because currently this is dealing only with the pro version. However, let's knock out the pro version logic first, and then we can come back to that later.

Reviewing this issue and the related PRs (wpsharks/comet-cache-pro#144 and wpsharks/comet-cache-pro#136) I see that the Lite version was never addressed, i.e., when we generate a Lite version from the Pro codebase, this enhancement (showing the version number and detecting when there's a new version available) will not be available.

The next Lite release (slated for early December) will be generated from the Pro codebase and I'd like to at least have the installed version showing in Options panel for the Lite version. I'm not so concerned about detecting when an update is available for the Lite version since WordPress already has its own built-in update notification system. I would, however, like to have the "changelog" link in there (linking to http://zencache.com/changelog-lite/ for the Lite version).

cc @renzms

@raamdev raamdev reopened this Nov 22, 2015
@wpsharks wpsharks unlocked this conversation Nov 22, 2015
@raamdev raamdev modified the milestones: Next Release (Lite), v151002 (Pro) Nov 22, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Nov 23, 2015
jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Nov 23, 2015
@jaswrks
Copy link

@jaswrks jaswrks commented Nov 23, 2015

@raamdev I added support for this. Please review: wpsharks/comet-cache-pro#186

jaswrks pushed a commit to wpsharks/comet-cache-pro that referenced this issue Dec 1, 2015
raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Dec 1, 2015
@raamdev raamdev modified the milestones: v150821 (Pro), Next Release (Lite), v151002 (Pro) Dec 1, 2015
@wpsharks wpsharks locked and limited conversation to collaborators Dec 1, 2015
@raamdev raamdev closed this Dec 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants