Generate version number of application automatically [autoversionCls] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Generate version number of application automatically [autoversionCls] (/showthread.php?tid=17184) |
Generate version number of application automatically [autoversionCls] - El Forum - 03-28-2009 [eluser]ayukawaa[/eluser] The trick is to show when was the site last updated but instead of display something ugly like 'last updated 1 year ago' or 'last updated 03/04/2008', display a more friendly text like v1.3.15 (major.minor.build). The class checks the directories specified searching for the most recent file and then generates a version number based on the date of this file, so with a view to the version we can quickly see the last time we updated the app. You should call this only once, and then have the result cached to SESSION, etc. QUICK EXAMPLE (no need for CI): Code: //check if we have already cached the version number If the most recent file is dated 27-04-2009 then with parameter year=2008: Code: echo $autoversionObj->version(); //return: 1.4.27 (default) And without the parameter year, the year becomes the major number: Code: echo $autoversionObj->version(); //return: 9.4.27 (default) I know it's not really usefull but for me works fine... ^_^ Generate version number of application automatically [autoversionCls] - El Forum - 03-28-2009 [eluser]xwero[/eluser] I think it's not a good idea to use the date as a version number. Version numbers follow an other logic than chronography. If people see the version number changed they want to know what has changed and as your code only changes version numbers this will result in a lot of questions about the changes. If you can connect this to a documentation generator i think you are on to something. |