delete-all.pl 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (C) 2006-2013 Alex Schroeder <alex@gnu.org>
  2. # This program is free software: you can redistribute it and/or modify it under
  3. # the terms of the GNU General Public License as published by the Free Software
  4. # Foundation, either version 3 of the License, or (at your option) any later
  5. # version.
  6. #
  7. # This program is distributed in the hope that it will be useful, but WITHOUT
  8. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  10. #
  11. # You should have received a copy of the GNU General Public License along with
  12. # this program. If not, see <http://www.gnu.org/licenses/>.
  13. use strict;
  14. use v5.10;
  15. AddModuleDescription('delete-all.pl');
  16. our (%Page, $Now, $OpenPageName, %LockOnCreation);
  17. our ($DeleteAge);
  18. $DeleteAge = 172800; # 2*24*60*60
  19. *OldDelPageDeletable = \&PageDeletable;
  20. *PageDeletable = \&NewDelPageDeletable;
  21. # All pages will be deleted after two days of inactivity!
  22. sub NewDelPageDeletable {
  23. return 1 if $Now - $Page{ts} > $DeleteAge
  24. and not $LockOnCreation{$OpenPageName};
  25. return OldDelPageDeletable(@_);
  26. }