File management
Functions to read, write and modify files in various ways. All the functions do their own locking and error checking. In most cases a read or write error will be fatal and produce a nice error-description for the user in the browser and logs.
To work with text files: FileRead(Raw) FileWrite(Raw) To work with bash shell compatible config files: FileReadSetting(s)/FileWriteSetting(s) To store php array structures in textformat: FileExport/FileImport.
determine appropriate lockfilename for a file.
determines the name of a old backup file.
Downloads $srcurl to $targetpath with progress box and error checking.
Use this if you need to download large stuff from the internet. Also used in the update manager module. Specify $size to give the user an indication of the completion status.
Chgrp a file, catches errors
Chmod a file, catches errors
Chown a file, catches errors
Copy a file.
Delete a file.
Calls Error() on failure.
Exports the php object to a file.
The object can contain any type and any amount of subarrays. Use this to 'serialize' the data in a human readable/editable way. TODO: we zouden hiervoor json->encode moeten gebruiken, maar deze kan (nog) geen mooie human readable output genereren
Imports a php object from a file (see FileExport)
Caution! Make sure you trust the inputfile, since it will be parsed as php code!
lock the filename, by creating a lockfile in workdir. returns a pointer to the lockfile on success.
(false otherwise)
Mkdir, catches errors.
Also creates higher paths.
Moves a file.
reads a textfile safely by locking it first
Errors are fatal and will call the Error() function.
return array with the lines in the file that match the regex.
See preg_match() for more info.
reads a raw file safely by locking it first.
NOTE: doesn't work on pseudo files in /proc ! Errors are fatal and will call the Error() function.
Reads one specific setting
The format of a settings files is parsable by shellscripts and has the following format: settingname="settingsvalue"
Reads a settings file into a hash array
The format of a settings files is parsable by shellscripts and has the following format: settingname="settingsvalue"
Replaces a specific line in a file.
If $searchregex is not found in the file it will just add the line to the file. If $newdata is not specified (false) it will delete the line instead of replacing it. NOTE: Doesn't use locking between the FileRead and FileWrite yet.
Rmdir, catches errors.
Recursively
create a new symlink, replacing any existing files.
unlock the specified file/filepointer combination.
removes the lockfile
write a TEXT file safely by locking it and making a copy of the old file in basedir
Errors are fatal and will call the Error() function.
write a RAW file safely by locking it and making a copy of the old file in basedir
Errors are fatal and will call the Error() function.
Write one specific setting to a settings file
The format of a settings files is parsable by shellscripts and has the following format: settingname="settingsvalue"
Write a hash array with settings to a settings file
The format of a settings files is parsable by shellscripts and has the following format: settingname="settingsvalue"
Removes the data after the last dot from a filename. 'package.tgz' is returned as 'package'.
NOTE: 'package.tar.gz' is returned as 'package.tar'
Returns the files in the directory $start_directory
Documentation generated on Tue, 06 Jan 2009 12:38:13 +0100 by phpDocumentor 1.4.1