.

JCSSCompressedFiles Class Reference

List of all members.

Static Public Member Functions

static  find ($type)
  Find all compressed files of given type.
static  remove ($type, $out_filename)
  Remove a compression from DB.
static  update_db ($type, $out_filename, $sources, $err)
  Update DB to trace what gets compressed.

Detailed Description

Definition at line 2 of file jcsscompressedfiles.facade.php.


Member Function Documentation

static JCSSCompressedFiles::find ( type  )  [static]

Find all compressed files of given type.

Definition at line 6 of file jcsscompressedfiles.facade.php.

00006                                            {
00007                 $dao = new DAOJcsscompressedfiles();
00008                 $dao->type = $type;
00009                 $dao->sort('num_sources', DataObjectBase::DESC);
00010                 return $dao->find_array();
00011         }
static JCSSCompressedFiles::remove ( type,
out_filename  
) [static]

Remove a compression from DB.

Definition at line 56 of file jcsscompressedfiles.facade.php.

00056                                                             {
00057                 $dao = new DAOJcsscompressedfiles();
00058                 $dao->type = $type;
00059                 $dao->filename = $out_filename;
00060                 return $dao->delete();
00061         }
static JCSSCompressedFiles::update_db ( type,
out_filename,
sources,
err  
) [static]

Update DB to trace what gets compressed.

Parameters:
string  $type One of the TYPE_X constants
string  $out_filename Path of compressed file
array  $sources Input files for compression
Status  $err
Returns:
DAOJCsscompressedfiles

Definition at line 22 of file jcsscompressedfiles.facade.php.

00022                                                                                {
00023                 $hash = md5_file($out_filename);
00024                 
00025                 $filename = JCSSManager::make_relativ($out_filename);
00026                 
00027                 $dao = new DAOJcsscompressedfiles();
00028                 $dao->type = $type;
00029                 $dao->filename = $filename;
00030                 if ($dao->find(DataObjectBase::AUTOFETCH)) {
00031                         if ($dao->hash != $hash) {
00032                                 $dao->hash = $hash;
00033                                 $dao->num_sources = count($sources);
00034                                 $dao->sources = $sources;
00035                                 $dao->version++;
00036                                 $err->merge($dao->update());
00037                         }
00038                 }       
00039                 else {
00040                         $dao = new DAOJcsscompressedfiles();
00041                         $dao->type = $type;
00042                         $dao->filename = $filename;
00043                         $dao->version = 1;
00044                         $dao->hash = $hash;
00045                         $dao->num_sources = count($sources);
00046                         $dao->sources = $sources;
00047                         $err->merge($dao->insert());     
00048                 }       
00049                 
00050                 return $dao;
00051         }

The documentation for this class was generated from the following file: