public mixed
delete
(mixed $filename, mixed $context = null, mixed $usePrefix = true, mixed $relative = false)
/**
* Delete a file
*
* @param string $filename The file path to delete.
* @param resource $context A valid context resource (optional) created with stream_context_create.
* @param boolean $usePrefix Controls the use of a prefix (optional).
* @param boolean $relative Determines if the filename given is relative. Relative paths do not have JPATH_ROOT stripped.
*
* @return mixed
*
* @since 1.7.0
*/
public function delete($filename, $context = null, $usePrefix = true, $relative = false)
{
// Capture PHP errors
$php_errormsg = '';
$track_errors = ini_get('track_errors');
ini_set('track_errors', true);
$filename = $this->_getFilename($filename, 'w', $usePrefix, $relative);
if ($context) {
// Use the provided context
$res = @unlink($filename, $context);
} elseif ($this->context) {
// Use the object's context
$res = @unlink($filename, $this->context);
} else {
// Don't use any context
$res = @unlink($filename);
}
if (!$res && $php_errormsg) {
$this->setError($php_errormsg());
}
// Restore error tracking to what it was before.
ini_set('track_errors', $track_errors);
return $res;
}