Ejemplo n.º 1
0
 /**
  * Delete cache files for a given content item
  *
  * @param array $pContentId
  * @access public
  * @return TRUE on success, FALSE on failure
  */
 function expungeCacheFile($pContentId = NULL)
 {
     global $gBitSystem;
     if ($gBitSystem->isFeatureActive('liberty_cache') && @BitBase::verifyId($pContentId)) {
         // we need to unlink all files with the same id and any extension
         if ($dh = opendir($cacheDir = LibertyContent::getCachePath($pContentId))) {
             while (FALSE !== ($file = readdir($dh))) {
                 if ($file != '.' && $file != '..' && (preg_match("/^" . $pContentId . "\$/", $file) || preg_match("/^" . $pContentId . "\\..*/", $file))) {
                     @unlink($cacheDir . $file);
                 }
             }
         }
     }
     return TRUE;
 }