apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: File_Archive

Source Location: /File_Archive-0.1.0/File/Archive.php

Class Overview


Factory to access the most common File_Archive features


Methods


Inherited Variables

Inherited Methods


Class Details

[line 43]
Factory to access the most common File_Archive features

It uses lazy include, so you dont have to include the files from File/Archive/* directories



[ Top ]


Method Detail

filter   [line 328]

void filter( $predicate, $source)

  • See: File_Archive_Reader_Filter

Parameters:

   $predicate   — 
   $source   — 

[ Top ]

predAnd   [line 352]

void predAnd( )

  • See: File_Archive_Predicat_And

[ Top ]

predCustom   [line 432]

void predCustom( $expression)

  • See: File_Archive_Predicat_Custom

Parameters:

   $expression   — 

[ Top ]

predEreg   [line 416]

void predEreg( $ereg)

  • See: File_Archive_Predicat_Ereg

Parameters:

   $ereg   — 

[ Top ]

predEregi   [line 424]

void predEregi( $ereg)

  • See: File_Archive_Predicat_Eregi

Parameters:

   $ereg   — 

[ Top ]

predExtension   [line 408]

void predExtension( $list)

  • See: File_Archive_Predicat_Extension

Parameters:

   $list   — 

[ Top ]

predFalse   [line 344]

void predFalse( )

  • See: File_Archive_Predicat_False

[ Top ]

predMaxDepth   [line 400]

void predMaxDepth( $depth)

  • See: File_Archive_Predicat_MaxDepth

Parameters:

   $depth   — 

[ Top ]

predMinSize   [line 384]

void predMinSize( $size)

  • See: File_Archive_Predicat_MinSize

Parameters:

   $size   — 

[ Top ]

predMinTime   [line 392]

void predMinTime( $time)

  • See: File_Archive_Predicat_MinTime

Parameters:

   $time   — 

[ Top ]

predNot   [line 376]

void predNot( $pred)

  • See: File_Archive_Predicat_Not

Parameters:

   $pred   — 

[ Top ]

predOr   [line 364]

void predOr( )

  • See: File_Archive_Predicat_Or

[ Top ]

predTrue   [line 336]

void predTrue( )

  • See: File_Archive_Predicat_True

[ Top ]

read   [line 147]

void read( $URL, [ $symbolic = null], [ $uncompression = 0], [ $directoryDepth = -1])

Create a reader to read the URL $URL

If the URL is a directory, it will recursively read that directory If $uncompressionLevel is not null, the archives (files with extension tar, zip, gz or tgz) will be considered as directories (up to a depth of $uncompressionLevel if $uncompressionLevel > 0) The reader will only read files with a directory depth of $directoryDepth The reader will replace the given URL ($URL) with $symbolic in the public filenames The default symbolic name will be the last filename in the URL (or '' for directories)

Examples: Considere the following file system

 a.txt
 b.tar (archive that contains the following files)
     c.txt
     d.tgz (archive that contains the following files)
         e.txt
         dir1/
             f.txt
 dir2/
     g.txt
     dir3/
         h.tar (archive that contains the following files)
             i.txt

readUncompress('.') will return a reader that gives access to following files (recursively read current dir):

 a.txt
 b.tar
 dir2/g.txt
 dir2/dir3/h.tar

readUncompress('.', 'myBaseDir') will return the following reader:

 myBaseDir/a.txt
 myBaseDir/b.tar
 myBaseDir/dir2/g.txt
 myBaseDir/dir2/dir3/h.tar

readUncompress('.', '', -1) will return the following reader (uncompress everything)

 a.txt
 b.tar/c.txt
 b.tar/d.tgz/e.txt
 b.tar/d.tgz/dir1/f.txt
 dir2/g.txt
 dir2/dir3/h.tar/i.txt

readUncompress('.', '', 1) will uncompress only one level (so d.tgz will not be uncompressed):

 a.txt
 b.tar/c.txt
 b.tar/d.tgz
 dir2/g.txt
 dir2/dir3/h.tar/i.txt

readUncompress('.', '', 0, 0) will not recurse into subdirectories

 a.txt
 b.tar

readUncompress('.', '', 0, 1) will recurse only one level in subdirectories

 a.txt
 b.tar
 dir2/g.txt

readUncompress('.', '', -1, 2) will uncompress everything and recurse in only 2 levels in subdirectories or archives

 a.txt
 b.tar/c.txt
 b.tar/d.tgz/e.txt
 dir2/g.txt

The recursion level is determined by the real path, not the symbolic one. So readUncompress('.', 'myBaseDir', -1, 2) will result to the same files:

 myBaseDir/a.txt
 myBaseDir/b.tar/c.txt
 myBaseDir/b.tar/d.tgz/e.txt (the public name is depth 3, but the real one is 2, so it is accepted)
 myBaseDir/dir2/g.txt

To read a single file, you can do read('a.txt', 'public_name.txt') If no public name is provided, the default one is the name of the file read('dir2/g.txt') contains the single file named 'g.txt' read('b.tar/c.txt') contains the single file named 'c.txt'

Note: This function uncompress files reading their extension The compressed files must have a tar, zip, gz or tgz extension Since it is impossible for some URLs to use is_dir or is_file, this function may not work with URLs containing folders which name ends with such an extension


Parameters:

   $URL   — 
   $symbolic   — 
   $uncompression   — 
   $directoryDepth   — 

[ Top ]

readConcat   [line 319]

void readConcat( &$source, $filename)

  • See: File_Archive_Reader_Concat

Parameters:

   &$source   — 
   $filename   — 

[ Top ]

readMemory   [line 292]

void readMemory( $memory, $filename, [ $stat = array()], [ $mime = "application/octet-stream"])

  • See: File_Archive_Reader_Memory

Parameters:

   $memory   — 
   $filename   — 
   $stat   — 
   $mime   — 

[ Top ]

readMulti   [line 302]

void readMulti( [ &$sources = array()], array $sources)

  • See: File_Archive_Reader_Multi File_Archive::read

Parameters:

array   $sources   —  Array of strings or readers that will be added to the multi reader If the parameter is a string, a reader will be built thanks to the read function
   &$sources   — 

[ Top ]

toArchive   [line 482]

void toArchive( $type $type, $filename, &$innerWriter, [ $stat = array()], [ $autoClose = true])


Parameters:

$type   $type   —  can be one of Tar, Gzip, Tgz, Zip The case of this parameter is not important
   $filename   — 
   &$innerWriter   — 
   $stat   — 
   $autoClose   — 

[ Top ]

toFiles   [line 449]

void toFiles( [ $baseDir = ""])

  • See: File_Archive_Writer_Files

Parameters:

   $baseDir   — 

[ Top ]

toMail   [line 441]

void toMail( $to, $headers, $message, [ &$mail = null])

  • See: File_Archive_Writer_Mail

Parameters:

   $to   — 
   $headers   — 
   $message   — 
   &$mail   — 

[ Top ]

toMemory   [line 457]

void toMemory( [ &$data = null])

  • See: File_Archive_Writer_Memory

Parameters:

   &$data   — 

[ Top ]

toMulti   [line 465]

void toMulti( &$a, &$b)

  • See: File_Archive_Writer_Multi

Parameters:

   &$a   — 
   &$b   — 

[ Top ]

toOutput   [line 473]

void toOutput( [ $sendHeaders = true])

  • See: File_Archive_Writer_Output

Parameters:

   $sendHeaders   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:24:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.