"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "go/base/fs/Folder.php" between
groupoffice-6.3.62-php-71.tar.gz and groupoffice-6.3.63-php-71.tar.gz

About: GroupOffice is a web-based office suit: Calendar, CRM, E-mail, File sharing, Projects, Synchronization (6.3 series for PHP 7.1; community version).

Folder.php  (groupoffice-6.3.62-php-71):Folder.php  (groupoffice-6.3.63-php-71)
skipping to change at line 90 skipping to change at line 90
} }
} }
/** /**
* Delete the folder * Delete the folder
* *
* @return boolean * @return boolean
*/ */
public function delete(){ public function delete(){
//\GO::debug("DELETE: ".$this->path()); \GO::debug("DELETE: ".$this->path());
if(!$this->exists()) if(!$this->exists()) {
return true; return true;
}
//just delete symlink and not contents of linked folder! //just delete symlink and not contents of linked folder!
if(is_link($this->path)) if(is_link($this->path))
return unlink($this->path); return unlink($this->path);
$items = $this->ls(true); $items = $this->ls(true);
foreach($items as $item){ foreach($items as $item){
if(!$item->delete()) if(!$item->delete())
return false; return false;
skipping to change at line 120 skipping to change at line 121
if(strpos($srcPath.'/', $destPath.'/')===0) if(strpos($srcPath.'/', $destPath.'/')===0)
{ {
$msg = 'The destination is located inside the source dire ctory.'; $msg = 'The destination is located inside the source dire ctory.';
if(\GO::config()->debug) if(\GO::config()->debug)
$msg .= "\n\n".$srcPath.' -> '.$destPath; $msg .= "\n\n".$srcPath.' -> '.$destPath;
throw new \Exception($msg); throw new \Exception($msg);
} }
} }
/** /**
* Rename on folder with contents fails so do a move.
*
* @param string $name
* @return bool
*/
public function rename($name) {
if($this->move($this->parent(), $name)) {
$this->path = dirname($this->path).'/'.$name;
return true;
}
}
/**
* Move the folder to another folder. * Move the folder to another folder.
* *
* @param Folder $destinationFolder * @param Folder $destinationFolder
* @param StringHelper $newFolderName Optionally rename the folder too. * @param StringHelper $newFolderName Optionally rename the folder too.
* @param boolean $appendNumberToNameIfDestinationExists Rename the folde r like "folder (1)" if it already exists. * * @param boolean $appendNumberToNameIfDestinationExists Rename the folde r like "folder (1)" if it already exists. *
* @return Folder $destinationFolder * @return Folder $destinationFolder
*/ */
public function move(Folder $destinationFolder, $newFolderName=false,$app endNumberToNameIfDestinationExists=false){ public function move(Folder $destinationFolder, $newFolderName=false,$app endNumberToNameIfDestinationExists=false){
if(!$this->exists()) if(!$this->exists())
throw new \Exception("Folder '".$this->path()."' does not exist"); throw new \Exception("Folder '".$this->path()."' does not exist");
skipping to change at line 150 skipping to change at line 165
$newPath = $destinationFolder->path().'/'.$newFolderName; $newPath = $destinationFolder->path().'/'.$newFolderName;
if($appendNumberToNameIfDestinationExists){ if($appendNumberToNameIfDestinationExists){
$folder = new Folder($newPath); $folder = new Folder($newPath);
$folder->appendNumberToNameIfExists(); $folder->appendNumberToNameIfExists();
$newPath = $folder->path(); $newPath = $folder->path();
} }
//do nothing if path is the same. //do nothing if path is the same.
if($newPath==$this->path()) if($newPath==$this->path()) {
\GO::debug("Path is the same");
return true; return true;
}
$success = false; $success = false;
try{ try{
$success = rename($this->path(), $newPath); $success = rename($this->path(), $newPath);
} catch(\Exception $e) { } catch(\Exception $e) {
//rename fails accross partitions. Ignore and retry with copy delete. //rename fails accross partitions. Ignore and retry with copy delete.
\GO::debug("Rename failed. Falling back on copy, delete") ; \GO::debug("Rename failed. Falling back on copy, delete") ;
} }
if(!$success){ // Notice suppressed by @ if(!$success){ // Notice suppressed by @
 End of changes. 6 change blocks. 
3 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)