yana

phpDocumentor v 1.4.0

Class File

Description

checked reading and writing of file sources
This class adds functionality to write changes on the object to the corresponding file.
  • access: public
Object
   |
   --FileSystemResource
      |
      --FileReadonly
         |
         --File
Method Summary

Direct descendents

Class Description
DatFile This class is an alternative to csv files.
DbDesigner4 DBDesigner 4 import class
SML Simple Markup Language (SML) Files

Methods

copy the file to some destination
bool copy (
string $destFile, [bool $overwrite = true], [bool $isRecursive = false], [int $mode = 766]
)
List of parameters:
Name Type Description
$destFile string destination to copy the file to
$overwrite bool setting this to false will prevent existing files from getting overwritten
$isRecursive bool setting this to true will automatically, recursively create directories in the $destFile string, if required
$mode int the access restriction that applies to the copied file, defaults to 0766
Description:
This will create a copy of this file on the filesystem. Bool(true) will be returned on success and bool(false) on error.
Possible errors are:
  • the destination directory does not exist (and $isRecursive is not provided, or set to false)
  • another file with the same name does already exist (and $overwrite is set to false)
  • the destination file is not accessible for some other reason
If the directory the desination file would be place in does not exist, and $isRecursive is set to true, it will automatically, recursively create the missing directories. Newly created directories will be set to access restriction 0766. Note that this is unlike the default behaviour, where there is no restriction at all.
Note: instead of a file name in parameter $destFile, you may also provide the name of a directory. In this case the file the current name of the file will be used. The destination directory needs to be terminated by a forward-slash '/'.
The $destFile parameter must not be any longer than 512 characters. It must not contain any but alphanumeric characters.
If you copy a PHP file, note that for security reasons the $mode parameter defaults to 0766, which means the file will not be executable in a UNIX environment (while it may be executable on windows platforms) until you set the $mode parameter to 0777.
  • since: 2.8.5
  • access: public
create the current file if it does not exist
bool create ()
Description:
  • access: public
delete this file
bool delete ()
Description:
Returns bool(true) on success and bool(false) on error.
  • access: public
failSafe writing of data
bool failSafeWrite ()
Description:
Automatically restarts writing if the file-resource is temporarily not available after waiting for 0.5 seconds.
The process is aborted if it failed 3 times.
  • access: public
get size of this file
int getFilesize ()
Description:
Returns the size of the file in bytes (from cached value). If an error occurs, bool(false) is returned.
  • since: 2.8.5
  • access: public
insert new content
void insert (
scalar $text
)
List of parameters:
Name Type Description
$text scalar
Description:
  • access: public

Redefined in descendants as:
return bool(true) if file is writeable
bool isWriteable ()
Description:
A file is "writeable" if:
  • the file exists
  • it is accessible
  • the script has permission to write data to the file
  • since: 2.9 RC3
  • access: public
get the number of contents inside the file
int length ()
Description:
  • access: public

Redefined in descendants as:
remove an entry from the file
bool remove (
[string $key = ""]
)
List of parameters:
Name Type Description
$key string (optional)
Description:
  • access: public

Redefined in descendants as:
write file to system
bool write ()
Description:
This function will return bool(true) on success. It issues an E_USER_NOTICE and returns bool(false) on error.
  • access: public
inherited from base classes

Inherited From FileReadonly

Inherited From FileSystemResource

Inherited From Object

Documentation generated on Sat, 03 Jan 2009 22:22:24 +0100 by phpDocumentor 1.4.0

yana author: Thomas MeyerHomepage: www.yanaframework.net