wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
FileUtil Class Reference

Public Member Functions

 getErrorMsg ()
 
 uploadFile ($mediaFile, $destName, $mimeType=null, $maxSize=-1, $override=true)
 
 fputsUnicode ($fp, $str)
 
 getFiles ($directory, $pattern='/./', $prependDirectoryName=false, $recursive=false)
 
 getDirectories ($directory, $pattern='/./', $prependDirectoryName=false, $recursive=false)
 
 copyRec ($source, $dest)
 
 copyRecDir ($source, $dest)
 
 mkdirRec ($dirname)
 
 emptyDir ($dirname)
 
 getRelativePath ($path1, $path2)
 
 sanitizeFilename ($name)
 

Public Attributes

 $_errorMsg = ''
 

Detailed Description

FileUtil provides basic support for file functionality like HTTP file upload.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 31 of file class.FileUtil.php.

Member Function Documentation

FileUtil::getErrorMsg ( )

Get last error message.

Returns
The error string

Definition at line 39 of file class.FileUtil.php.

References $_errorMsg.

FileUtil::uploadFile (   $mediaFile,
  $destName,
  $mimeType = null,
  $maxSize = -1,
  $override = true 
)

Copy an uploaded file to a given destination (only if the mime type mathes the given one).

Parameters
mediaFileAn assoziative array with the following keys: 'name', 'type', 'size', 'tmp_name' (typically a $HTTP_POST_FILES entry)
destNameThe destination file name
mimeTypeAn array holding the allowed mimetypes, null if arbitrary [default: null]
maxSizeThe maximum size of the file (if -1 it's not limited) [default: -1]
overrideTrue/False whether an existing file should be overridden, if false an unque id will be placed in the filename to prevent overriding [default: true]
Returns
The filename of the uploaded file or null if failed, error string provided by getErrorMsg()

Definition at line 52 of file class.FileUtil.php.

References Message\get(), and InifileParser\getInstance().

+ Here is the call graph for this function:

FileUtil::fputsUnicode (   $fp,
  $str 
)

Write unicode to file.

Parameters
fpFile Handle
strString to write

Definition at line 111 of file class.FileUtil.php.

Referenced by XMLExportController\endTags(), XMLExportController\finishExport(), XMLExportController\initExport(), and XMLExportController\writeNode().

FileUtil::getFiles (   $directory,
  $pattern = '/./',
  $prependDirectoryName = false,
  $recursive = false 
)

Definition at line 123 of file class.FileUtil.php.

References Message\get().

Referenced by emptyDir().

+ Here is the call graph for this function:

FileUtil::getDirectories (   $directory,
  $pattern = '/./',
  $prependDirectoryName = false,
  $recursive = false 
)

Definition at line 167 of file class.FileUtil.php.

References Message\get().

Referenced by emptyDir(), and CreateInstanceController\executeKernel().

+ Here is the call graph for this function:

FileUtil::copyRec (   $source,
  $dest 
)

Recursive copy for files/directories.

Parameters
sourceThe name of the source directory/file
destThe name of the destination directory/file

Definition at line 208 of file class.FileUtil.php.

References copyRecDir(), Message\get(), and WCMFException\throwEx().

Referenced by copyRecDir().

+ Here is the call graph for this function:

FileUtil::copyRecDir (   $source,
  $dest 
)

Recursive copy for directories.

Parameters
sourceThe name of the source directory
destThe name of the destination directory

Definition at line 226 of file class.FileUtil.php.

References copyRec(), and mkdirRec().

Referenced by BackupController\backupFiles(), copyRec(), CreateInstanceController\executeKernel(), and BackupController\restoreFiles().

+ Here is the call graph for this function:

FileUtil::mkdirRec (   $dirname)

Recursive directory creation.

Parameters
dirnameThe name of the directory

Definition at line 244 of file class.FileUtil.php.

Referenced by copyRecDir(), SearchUtil\getIndexPath(), SaveController\getUploadDir(), and View\setup().

FileUtil::emptyDir (   $dirname)

Empty a directory.

Parameters
dirnameThe name of the directory

Definition at line 259 of file class.FileUtil.php.

References getDirectories(), and getFiles().

Referenced by BackupController\restoreFiles().

+ Here is the call graph for this function:

FileUtil::getRelativePath (   $path1,
  $path2 
)

Get the relative path between two paths code from http://php.net/manual/en/ref.filesystem.php

Parameters
path1The first path
path2The second path
Returns
string

Definition at line 275 of file class.FileUtil.php.

FileUtil::sanitizeFilename (   $name)

Sanitize a given filename (code from http://drupal.org/node/106377)

Parameters
nameThe file name
Returns
The sanitized name

Definition at line 316 of file class.FileUtil.php.

Referenced by CreateInstanceController\getNewInstanceDatabase().

Member Data Documentation

FileUtil::$_errorMsg = ''

Definition at line 33 of file class.FileUtil.php.

Referenced by getErrorMsg().


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