Piwik\Filesystem::deleteFileIfExists PHP Метод

deleteFileIfExists() публичный статический Метод

Deletes the given file if it exists.
public static deleteFileIfExists ( string $pathToFile ) : boolean
$pathToFile string
Результат boolean true in case of success or if file does not exist, false otherwise. It might fail in case the file is not writeable.
    public static function deleteFileIfExists($pathToFile)
    {
        if (!file_exists($pathToFile)) {
            return true;
        }
        return @unlink($pathToFile);
    }

Usage Example

Пример #1
0
 private static function deleteIfLastModifiedBefore14August2014($path)
 {
     $modifiedTime = filemtime($path);
     if ($modifiedTime && $modifiedTime < 1408000000) {
         Filesystem::deleteFileIfExists($path);
     }
 }
All Usage Examples Of Piwik\Filesystem::deleteFileIfExists