Changeset 516 in t29-www for lib/cache.php


Ignore:
Timestamp:
Feb 19, 2014, 12:39:35 PM (5 years ago)
Author:
sven
Message:

Bug #51 gefixt (http://labs.technikum29.de/ticket/51).
Jetzt sollten neue Pagestyles gleich beim Erstellen erkannt werden.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/cache.php

    r357 r516  
    3434        public $cache_file; // must be set!
    3535        public $test_files = array(); // must be set!
     36        public $test_conditions = array(); // can be filled with booleans
    3637
    3738        private $mtime_cache_file = null; // needed for cache header output
     
    7879                        print 'Cache file: '; var_dump($this->cache_file);
    7980                        print 'Test files: '; var_dump($this->test_files);
     81                        print 'Test conditions: '; var_dump($this->test_conditions);
    8082                }
    8183
     
    8587                        $this->test_files);
    8688                $mtime_test_max = array_reduce($mtime_test_files, 'max');
     89                // new feature: Testing boolean conditions. If $this->test_conditions is
     90                // an empty array, the calculation gives true.
     91                $test_conditions = array_reduce($this->test_conditions, function($a,$b){ return $a && $b; }, true);
    8792                $this->is_valid = $this->mtime_cache_file
    88                         && $mtime_test_max < $this->mtime_cache_file;
     93                        && $mtime_test_max < $this->mtime_cache_file && $test_conditions;
    8994                       
    9095                if($this->debug) {
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License