Remove file

@param  string  $path  file path
@return bool
@author Dmitry (dio) Levashov
187999
protected function _unlink($path) {
		
		$newkey = $this->_normpath($path);
		$newkey = preg_replace("/\/$/", "", $newkey);

		try {
			$obj = $this->s3->DeleteObject(array('Bucket' => $this->options['bucket'], 'Key' => $newkey));
		} catch (Exception $e) {
		
		}
		
		/*$fp = fopen('/tmp/eltest.txt','a+');
		
		fwrite($fp, 'key='.$newkey);*/
		
		if (is_object($obj)) {
			//fwrite($fp, 'obj='.var_export($obj,true));
			
			if (isset($obj->DeleteObjectResponse->Code)) {
				$rc = $obj->DeleteObjectResponse->Code;
				
				if (substr($rc, 0, 1) == '2') {
					return true;
				}
			}
		}

			
		//fclose($fp);
		
		return false;
	}
1365154
public function removeRoute($path)
    {
        $routeName = ltrim($path, '/');
        if (!isset($this->routes[$routeName])) {
            return false;
        }
        unset($this->routes[$routeName]);
        return true;
    }
1349403
private static function removeDirectoryRecursive($path) : bool
    {
        if ( !file_exists($path) ){
            return true;
        }

        $handle = opendir("$path");
        if ( $handle === FALSE ) {
            return false;
        }
        while ( false !== ($item = readdir($handle)) ) {
            if ($item != "." && $item != "..") {
                if (is_dir("$path/$item")) {
                    $res = self::removeDirectoryRecursive( "$path/$item" );
                    if (!$res){
                        return false;
                    }
                } else {
                    $res = @unlink( "$path/$item" );
                    if (!$res){
                        return false;
                    }
                }
            }
        }
        closedir( $handle );
        return @rmdir($path);
    }
265361
public function delete($path)
  {
    $result = false;
    $parts = $this->split($path);

    $name = array_shift($parts);
    if (!sizeof($parts)) {
      if (isset($this->_ownData[$name])) {
        unset($this->_ownData[$name]);
        $result = true;
      }
    } elseif (isset($this->_subTrees[$name])) {
      $subtree = $this->_subTrees[$name];
      /* @var $subtree Wrapper_FS_Changes */

      $result = $subtree->delete($parts);
      if ($result && !$subtree->count()) {
        unset($this->_subTrees[$name]);
      }
    }

    return $result;
  }
1188128
public function delete($path)
    {
        $paths = is_array($path) ? $path : func_get_args();

        $success = true;

        foreach ($paths as $path) {

            if ($this->isDirectory($path)) {
                $success = $this->laravelFS->deleteDirectory($path);
                continue;
            }
            $success = $this->laravelFS->delete($path);

        }

        return $success;
    }
274431
public function remove($path) {
        // using mark.
        if ('@' == $path[0]) $path = $this->as($path);
        
        // remove file.
        if (is_file($path)) return unlink($path);

        // remove directory.
        $handle = opendir($path);
        while (false !== ($name = readdir($handle))) {
            if ('.' == $name or '..' == $name) continue;
            if (!$this->remove($path.self::DS.$name)) return false;
        }
        closedir($handle);
        return rmdir($path);
    }
1101427
public function delete($path)
	{
		$path = Util::normalizePath($path);

		$this->assertPresent($path);

		return $this->adapter->delete($path);
	}
1323278
public function remove($path)
    {
        if (! $this->adapter->isAbsolute($path)) {
            $path = $this->rootPath . $path;
        }
        if ($this->isFile($path, true)) {
            $this->adapter->unlink($path);
        } else {
            // clean the directory
            $path = rtrim($path, '/') . '/';
            foreach ($this->adapter->glob($path . '*') as $itemPath) {
                $this->remove($itemPath, true);
            }
            // remove it
            $this->adapter->rmdir($path);
        }
        return $this;
    }
1083814
public function deleteDir($path)
    {
        if (strpos($path, $this->directoryList->getPath('var')) === false) {
            return sprintf("Failed to delete directory - '%s'", $path);
        }

        $classFunc = [__CLASS__, __FUNCTION__];
        return is_file($path)
            ?
            @unlink($path)
            :
            array_map($classFunc, glob($path . '/*')) == @rmdir($path);
    }
63284
public static function remove($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return false;
        }

        foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $dir) {
            $dir->isFile() ? @unlink($dir->getPathname()) : @rmdir($dir->getPathname());
        }
        return @rmdir($path);
    }
664259
private function removeExpired($path)
	{
		if ($this->autoremove) {
			$now = new DateTime;
			$file_date = new DateTime('@' . filemtime($path));
			$file_date->setTimezone($now->getTimezone());
			$remove_date = $now->modify($this->autoremove);
			if ($file_date < $remove_date) {
				unlink($path);
				return TRUE;
			}
		}

		return FALSE;
	}
1352613
public function delete($path)
    {
        $location = $this->applyPathPrefix($path);

        try {
            $this->share->del($location);
        } catch (NotFoundException $e) {
            return false;
        } catch (InvalidTypeException $e) {
            return false;
        }

        return true;
    }
108724
static function remove($path, $onlyFiles=false) {
		if (!file_exists($path)) {
			return true;
		}
		if (is_dir($path)) {
			if ($onlyFiles) throw new FileException("$path is a directory!");
			return self::removeDir($path);
		}
		else {
			$ok=unlink($path);
			if (!$ok) throw new FileAccessException("Could not delete file $path");
		}
		return true;
	}
751435
public function unlink(string $path): bool
    {
        $realPath = $this->resolvePath(vfsStream::path($path));
        $content  = $this->getContent($realPath);
        if (null === $content) {
            trigger_error('unlink(' . $path . '): No such file or directory', E_USER_WARNING);
            return false;
        }

        if ($content->getType() !== vfsStreamContent::TYPE_FILE) {
            trigger_error('unlink(' . $path . '): Operation not permitted', E_USER_WARNING);
            return false;
        }

        return $this->doUnlink($realPath);
    }
1261229
public function unlink($path)
    {
        if (false === self::cache()->get($path)) {
            return false;
        }

        self::cache()->delete($path);

        return true;
    }
108465
final public function delete($path)
    {

        //If we have permission to remove this file
        if ($this->isWritable($path)) {
            if (!@unlink($path)) //This is highly unreliable as unlink returns a warning not a bool
            {
                return false;
            }
        } else {
            if (!@unlink($path)) //This is highly unreliable as unlink returns a warning not a bool
            {
                return false;
            }
        }

        return true;
    }
996967
public static function delete($path)
  {
    if (is_file($path)) {
      return unlink($path);
    }

    $files = array_diff(scandir($path), array('.', '..'));

    foreach ($files as $file) {
      (is_dir("$path/$file")) ? Filesystem::delete("$path/$file") : unlink("$path/$file");
    }

    return rmdir($path);
  }