YouTube-operational-API icon indicating copy to clipboard operation
YouTube-operational-API copied to clipboard

Add a retrievable instance version

Open Benjamin-Loison opened this issue 3 years ago • 2 comments

Related to these StackOverflow questions:

https://stackoverflow.com/q/3442874 https://stackoverflow.com/q/949314

As there doesn't seem to be perfect solution (for people downloading the source code as .zip directly for instance), I added to the end of index.php a mechanism such that git-powered instances will display their commit hashes.

Instead of the file_get_contents can use exec('git rev-parse HEAD'), as it works even if may produce errors on the backend (a cleaner way would be not to display the paratext uses version: ), cf below.

Note that git rev-parse HEAD returns on stderr but nothing on stdout:

fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

In addition to what is currently done for git-powered instances, ideally for people just downloading .zip, displaying the commit hash would be nice (can only display the previous one) and for people downloading a release having the clean release name would be nice (if there is any release cf #67).

Note that as far as I know just modifying locally a file of the git without committing won't change the version displayed.

Benjamin-Loison avatar Nov 08 '22 02:11 Benjamin-Loison

What if is on another branch? Modifying locally, doing git reset etc?

Note that current file read .git/refs/heads/main is focused on main branch.

Benjamin-Loison avatar Jan 18 '23 12:01 Benjamin-Loison

A way could consists in making the PHP code itself compute a/the fingerprint and then store and use it, but it's a bit too complicated for this purpose.

Benjamin-Loison avatar May 12 '23 16:05 Benjamin-Loison