Mercurial > prosody-modules
comparison mod_firewall/mod_firewall.lua @ 6555:d81bb13c0e87
mod_firewall: Report success if script is already loaded and hasn't changed
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 24 May 2026 19:58:55 +0100 |
| parents | 7f3ad8a5b2ab |
| children | 7477e97a9045 |
comparison
equal
deleted
inserted
replaced
| 6554:0002c727e918 | 6555:d81bb13c0e87 |
|---|---|
| 695 local base_name = script:match("[^/]+$"); | 695 local base_name = script:match("[^/]+$"); |
| 696 | 696 |
| 697 local last_modified = (lfs.attributes(script) or {}).modification or os.time(); | 697 local last_modified = (lfs.attributes(script) or {}).modification or os.time(); |
| 698 if loaded_scripts[script] then | 698 if loaded_scripts[script] then |
| 699 if loaded_scripts[script].last_modified == last_modified then | 699 if loaded_scripts[script].last_modified == last_modified then |
| 700 return; -- Already loaded, and source file hasn't changed | 700 return true; -- Already loaded, and source file hasn't changed |
| 701 end | 701 end |
| 702 module:log("debug", "Reloading %s", script); | 702 module:log("debug", "Reloading %s", script); |
| 703 -- Already loaded, but the source file has changed | 703 -- Already loaded, but the source file has changed |
| 704 -- unload it now, and we'll load the new version below | 704 -- unload it now, and we'll load the new version below |
| 705 unload_script(script, true); | 705 unload_script(script, true); |
