src/Service/Misc/File.php
public function deleteFile($filePath)
    {
        $filePath = realpath($filePath);

        // Check if it is an actual file and if it is writable.
        if (is_file($filePath) === true) {
            set_error_handler(
                function () {
                /* do nothing */
                }
            );
            // Make sure it is unlinkable.
            chmod($filePath, 0777);
            if (unlink($filePath) === true) {
                restore_error_handler();
                return;
            }

            // We have a permission problem here!
            $this->pool->messages->addMessage('fileserviceDelete', array($this->filterFilePath($filePath)));
            restore_error_handler();
        }
    }
public function deleteFile($filePath)
    {
        $filePath = realpath($filePath);

        // Check if it is an actual file and if it is writable.
        if (is_file($filePath) === true) {
            set_error_handler(
                function () {
                /* do nothing */
                }
            );
            // Make sure it is unlinkable.
            chmod($filePath, 0777);
            if (unlink($filePath) === true) {
                restore_error_handler();
                return;
            }

            // We have a permission problem here!
            $this->pool->messages->addMessage('fileserviceDelete', array($this->filterFilePath($filePath)));
            restore_error_handler();
        }
    }
public function deleteFile ( $ filePath ) { $ filePath = realpath ( $ filePath ) ; // Check if it is an actual file and if it is writable. if ( is_file ( $ filePath ) === true ) { set_error_handler ( function ( ) { /* do nothing */ } ) ; // Make sure it is unlinkable. chmod ( $ filePath , 0777 ) ; if ( unlink ( $ filePath ) === true ) { restore_error_handler ( ) ; return ; } // We have a permission problem here! $ this -> pool -> messages -> addMessage ( 'fileserviceDelete' , array ( $ this -> filterFilePath ( $ filePath ) ) ) ; restore_error_handler ( ) ; } }
Tries to delete a file.

@param string $filePath
Tries to delete a file .