예제 #1
0
 function rename($new_name)
 {
     if (strstr($new_name, "/") !== false) {
         throw new InvalidParameterException("Il nome contiene caratteri non ammessi ( / )!!");
     }
     $parent_dir = $this->getParentDir();
     $target_path = $parent_dir->getPath() . "/" . $new_name;
     $target_dir = new Dir($target_path);
     if ($target_dir->exists()) {
         return false;
     }
     return rename($this->__full_path, $target_dir->getFullPath());
 }
예제 #2
0
 public static function expandArchive($zip_file, $target_folder)
 {
     $zip_archive = new ZipArchive();
     if ($zip_file instanceof File) {
         $real_zip_file = $zip_file;
     } else {
         $real_zip_file = new File($zip_file);
     }
     if ($target_folder instanceof Dir) {
         $target_dir = $target_folder;
     } else {
         $target_dir = new Dir($target_folder);
     }
     $zip_archive->open($real_zip_file->getFullPath());
     $zip_archive->extractTo($target_dir->getFullPath());
     $zip_archive->close();
 }
예제 #3
0
파일: Dir.php 프로젝트: mbcraft/piol
 /**
  * 
  * Renames this directory without moving it.
  * 
  * @param string $new_name The new name to assign to this folder.
  * @return boolean true if the operation was succesfull, false otherwise.
  * @throws \Mbcraft\Piol\IOException if the name contains invalid characters (path components).
  * 
  * @api
  */
 public function rename($new_name)
 {
     FileSystemUtils::checkValidFilename($new_name);
     $parent_dir = $this->getParentDir();
     $target_path = $parent_dir->getPath() . "/" . $new_name;
     $target_dir = new Dir($target_path);
     if ($target_dir->exists()) {
         return false;
     }
     return rename($this->__full_path, $target_dir->getFullPath());
 }