method move documentation in bbn\Ide\Actions
function($data)
{
(strpos($data['dpath'], '../') === false) &&
(strpos($data['spath'], '../') === false) ){
$directories = new Directories($this->db);
$dirs = $directories->dirs();
if ( isset($dirs[$data['dir']]) ){
$cfg =& $dirs[$data['dir']];
$spath = $data['spath'];
$dpath = $data['dpath'];
if ( $this->isMvc($cfg) ){
$type = is_dir($cfg['files']['Controller']['fpath'].$spath) ? 'dir' : 'file';
}
else {
$type = is_dir($cfg['root_path'].$spath) ? 'dir' : 'file';
}
$dir = X::dirname($spath).'/';
if ( $dir === './' ){
$dir = '';
}
$name = bbn\Str::fileExt($spath, 1)[0];
$ext = bbn\Str::fileExt($spath);
$todo = [];
if ( $this->isMvc($cfg) ){
foreach ( $cfg['files'] as $f ){
if ( $f != 'CTRL' ){
$src = $f['fpath'].$dir.$name;
if ( $type === 'file' ){
$src .= '.'.$f['ext'];
}
$is_dir = ($type === 'dir') && is_dir($src);
$is_file = ($type === 'dir') || $is_dir ? false : is_file($src);
if ( $is_dir || $is_file ){
bbn\File\Dir::createPath($f['fpath'].$dpath);
$dest = $f['fpath'].$dpath.'/'.$name;
if ( $type === 'file' ){
$dest .= '.'.$f['ext'];
}
if ( file_exists($dest) ){
return $this->error("Un fichier du meme nom existe déjà $dest");
}
else{
$todo[$src] = $dest;
}
}
}
}
}
else {
$src = $cfg['root_path'].$dir.$name.($type === 'file' ? '.'.$ext : '');
$is_dir = ($type === 'dir') && is_dir($src);
$is_file = ($type === 'dir') || $is_dir ? false : is_file($src);
if ( $is_dir || $is_file ){
bbn\File\Dir::createPath($cfg['root_path'].$dpath);
$dest = $cfg['root_path'].$dpath.'/'.$name.($type === 'file' ? '.'.$ext : '');
if ( file_exists($dest) ){
return $this->error("Un fichier du meme nom existe déjà $dest");
}
else{
$todo[$src] = $dest;
}
}
}
foreach ( $todo as $src => $dest ){
if ( !rename($src, $dest) ){
return $this->error("Impossible de déplacer le fichier $src");
}
}
return 1;
}
}
return $this->error();
}
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.
© 2011-2025
BBN Solutions