Changeset 966


Ignore:
Timestamp:
11/23/08 16:50:33 (3 years ago)
Author:
bogdan2412
Message:

Some cache fixes. Added update-mimetypes script from live.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/cache.php

    r965 r966  
    11<?php 
     2require_once(IA_ROOT_DIR . "common/string.php"); 
    23 
    34// Check if there is something in the cache newer that date. 
     
    1516// Recursively delete directories 
    1617function _recursive_delete($path) { 
     18    $path = realpath($path); 
     19    log_assert($path != IA_ROOT_DIR . "cache/" && 
     20               starts_with($path, IA_ROOT_DIR . "cache/")); 
    1721    foreach (glob($path . "/*") as $file_name) { 
    1822        if (is_dir($file_name)) { 
     
    8387    $file_name = _disk_cache_path($cache_id); 
    8488 
    85     @mkdir(dirname($file_name), 0777, true); 
     89    if (!is_dir(dirname($file_name))) { 
     90        log_assert(!file_exists(dirname($file_name)), 
     91                   "Cache directory contains invalid files"); 
     92 
     93        $old_umask = umask(0); 
     94        @mkdir(dirname($file_name), 0777, true); 
     95        umask($old_umask); 
     96    } 
    8697    $ret = @file_put_contents($file_name, $buffer, LOCK_EX); 
    8798 
Note: See TracChangeset for help on using the changeset viewer.