method delete documentation in bbn\Ide\Directories

Deletes a file or a directory.

function($dir, $path, $name, $type = 'file') { ($root = $this->getRootPath($dir)) ){ $is_file = $type === 'file'; $wtype = $is_file ? 'file' : 'directory'; $delete = []; if ( !empty($cfg['tabs']) ){ foreach ( $cfg['tabs'] as $t ){ if ( empty($t['fixed']) ){ $real = $root . $t['path']; if ( X::dirname($path) !== '.' ){ $real .= X::dirname($path) . '/'; } if ( $is_file ){ foreach ( $t['extensions'] as $e ){ $tmp = $real . $name . '.' . $e['ext']; if ( file_exists($tmp) && !\in_array($tmp, $delete) ){ array_push($delete, $tmp); if ( $t['url'] === 'php' ){ $del_perm = $tmp; } } } } else { $real .= $name; if ( file_exists($real) && !\in_array($real, $delete) ){ array_push($delete, $real); if ( $t['url'] === 'php' ){ $del_perm = $real; } } } } } } else { $real = $root . $path; if ( file_exists($real) ){ array_push($delete, $real); } } $files = []; // Remove permissions if ( !empty($del_perm) ){ $this->deletePerm($del_perm, $type); } foreach ( $delete as $d ){ if ( $is_file ){ // Add it to files to be closed array_push($files, $this->realToUrl($d)); // Delete file if ( !unlink($d) ){ $this->error("Impossible to delete the file $d"); return false; } // Remove file's options $this->options->remove($this->options->fromCode($this->realToId($d), $this->_files_pref())); } else { $f = $this->remDirOpt($d); $files = array_merge($files, $f); // Delete directory if ( !bbn\File\Dir::delete($d) ){ $this->error("Impossible to delete the directory $d"); return false; } } } return ['files' => $files]; } return false; }

Deletes a file or a directory. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.