A tiny time-saver (not only) for plugin developers
Some time ago I decided to release as open-source a small PHP script that I use for many moths. One moment sufficed to get a reply moving my script forward, so it had actually reached it’s new version a few hours after the release… aaand I’m almost sure it reached the high level of perfection so that I can publish it right here! ;)
Example situation
=============
You develop and provide for download *something*. Script, plugin, perhaps theme, anything that gets sometimes it’s new version.
After finishing *a new version* you probably must: pack it’s folder, rename after new version number, upload, **change every link aiming to the newest file**, eventually: pack, not to mark the file with new version number, but overwrite existing file on the server. But I like marking version out, also in filename. If you don’t mark filename that way, this script won’t help you, sorry. :-)
But for all of you who do it just like me, you might like it. The magic of the script :-) causes that you won’t have to modify every link anymore. Since now you will always **aim links to the newest file**.
How it works & how to use it
=====================
.[important]
The script redirects to the file signed with the highest version. Script is named `index.php` and it’s recommended to reserve one special folder for this script and every “existing .(and not-yet-existing)” file version. You will link to the `/folder/` (with `index.php`) -> you will link to the script -> you will link to the most current file. Thanks to this principle, it’s **not necessary to update each link** after uploading newer file version!
.[download]
At first: **Download the script**:http://kahi.cz/blog/files/download-last/ (*.rar)
Then: open it. Into the first variable called `$base` just paste the beginning of filename you are going to provide. For example you always use name-pattern like `name-of-my-file-{version number}.zip`. Only *version number* changes. So take the piece of name **before the number**, in this case it’s `name-of-my-file-` and insert it into `$base` value. Simple.
[* 21/base-setting.png .(screen of file-editing phase) >]
Create on your site’s space a (sub)folder where you will store product’s versions since now until the end of universe, upload there this modified script. Upload into the same folder every release of your product. Edit every hyperlink that points to a concrete file – now it must link to your folder with the magic index.php file…
Cool, isn’t it? I suppose that since I use this script, it can be a year today, I have saved several hours. These hours I would must invest into routine, annoying links’ updates, if I there were no magic “give me the newest file” script. So now I have a few hours. Oh, no. I’ve just expended them while making this script public. By this article, and the “Czech one”:http://kahi.cz/blog/o-setreni-casem-a-stahovani-posledniho-souboru. :-) Enjoy!
(Additional explanations on demand ;)
Comments
No comments yet.
Add a comment