modglob

Been working on this the last couple days. It’s “a trivial but hopefully useful PHP file modification notifier” that can holler if your files get modified without you knowing. It can be run via browser or command line.

https://github.com/rocktronica/modglob

Relative to its location, modglob will recursively check folders for PHP files then order them by their last modification date. You can reselect by those modified within the last hour, day, week, month, infinity.

URL Params and CLI Arguments

  • Limit
    Number of files and folders to stop at. Default is a ridiculous million.
  • Hours
    Default is 1. Crank it up to 24 if you’ll be running the script daily, etc.
  • Format
    Options: text, html, dump. Will try to detect and show HTML/text for web/CLI, respectively. Dump is good for testing.
  • Mail
    Give it a valid email address, and it will email the text results. If none, it won’t. This is handy when the script is run via cron job.
  • Ignore
    Array of folders to ignore if it finds them. I’ve got a “cache” folder with a billion text files in it, so that’s the default.

CLI args are the first letters of each param, hyphened. So:
php modglob.php -h 168 -i foo -l 100
will show all files modified within the last week (168 = 24 * 7), ignoring the “foo” folder, and stopping when it’s seen 100 files or folders.

Attribution, License, Responsibility

Made with PHP, jQuery, TinySort. Requires PHP5, I’d bet. MIT/GPL licensed or as components allow.

Please be careful with how you use this. Obviously, indexing a gergillion files on a live server can use up some resources. Try to test in an inconspicuous place first, set proper limit and ignore variables, etc. Always be prepared!

Comments and concerns welcome via the project’s issues page.

Link: https://github.com/rocktronica/modglob