Ticket #155: phing-dev.delete.symlink.bug.patch

File phing-dev.delete.symlink.bug.patch, 1.6 kB (added by Bruce Weirdan <weirdan@gmail.com>, 1 year ago)
  • classes/phing/system/io/PhingFile.php

    old new  
    530530     */ 
    531531    function delete() { 
    532532        $fs = FileSystem::getFileSystem(); 
    533         if ($fs->checkAccess($this, true) !== true) { 
    534             throw new IOException("No read access to " . $this->path."\n"); 
     533        if ($fs->canDelete($this) !== true) { 
     534            throw new IOException("Cannot delete " . $this->path . "\n"); 
    535535        } 
    536536        return $fs->delete($this); 
    537537    } 
  • classes/phing/system/io/FileSystem.php

    old new  
    128128     */ 
    129129    abstract function fromURIPath($path); 
    130130 
     131       abstract function canDelete(PhingFile $f); 
     132 
    131133    /* -- Path operations -- */ 
    132134 
    133135    /** 
     
    654656            } // end compare 
    655657        } 
    656658    } 
     659 
    657660 
    658661} 
  • classes/phing/system/io/UnixFileSystem.php

    old new  
    262262 
    263263        return $p; 
    264264    } 
     265 
     266       function canDelete(PhingFile $f) 
     267       { 
     268               @clearstatcache(); 
     269               $dir = dirname($f->getAbsolutePath()); 
     270               return (bool) @is_writable($dir); 
     271       } 
    265272 
    266273}