Netbeans / PHP版本在保存时增加

So first off, this may be way too complicated, but I'll ask it in the hopes that there is a reasonably easy answer.

I have an .htaccess with the following:

#load php define file
php_value auto_prepend_file /home/p28004/domains/fvheeswijk.nl/public_html/warframe2/definer.php

<?php 
define("ROOT", $_SERVER['DOCUMENT_ROOT']);
define("VERSION", "1.0.129");
?>

This ensures that every php script calls definer.php, which can define several variables. I am wanting to define a version number here.

One of the reasons I want a version number with small minors (like 1.0.129) is to be able to cache javascript files when needed, and reload them on update.

The version would in case denote:

  • 1: The major update version
  • 0: The minor update version
  • 129: The number of saves happened since the start of 1.0, should be reset on any new major/minor version.

I want that on every Save of any file on the server, that some script increments the last version by 1, for example to 1.0.130. I foresee two possibilities already:

  • Have some NetBeans plugin that does this for me.
  • Do it in some other way by storing the Last-modified of all files that can be found on the server, and checking it after every upload/periodically.

Is this, in any way, feasible? Any general tips and/or explanation would be appreciated.

UPDATE: I forgot to mention it, but I am creating the PHP project from Remote Sources, so it automatically uploades the file already on save. I want to hook in after the save or upload somewhere, and there be able to change the version number.