Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Zahner committed Nov 12, 2019
1 parent 1fdeb93 commit 5d4dfba
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Flysystem adapter for fallback filesystems


[![Author](http://img.shields.io/badge/[email protected]?style=flat-square)](https://twitter.com/castarco)
[![Build Status](https://img.shields.io/travis/Litipk/flysystem-fallback-adapter/master.svg?style=flat-square)](https://travis-ci.org/Litipk/flysystem-fallback-adapter)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/litipk/flysystem-fallback-adapter/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/litipk/flysystem-fallback-adapter)
[![Build Status](https://img.shields.io/travis/jenszahner/flysystem-fallback-adapter/master.svg?style=flat-square)](https://travis-ci.org/jenszahner/flysystem-fallback-adapter)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/jenszahner/flysystem-fallback-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/jenszahner/flysystem-fallback-adapter/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://scrutinizer-ci.com/g/jenszahner/flysystem-fallback-adapter)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Packagist Version](https://img.shields.io/packagist/v/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://packagist.org/packages/litipk/flysystem-fallback-adapter)
[![Total Downloads](https://img.shields.io/packagist/dt/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://packagist.org/packages/litipk/flysystem-fallback-adapter)
[![Packagist Version](https://img.shields.io/packagist/v/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://packagist.org/packages/jenszahner/flysystem-fallback-adapter)
[![Total Downloads](https://img.shields.io/packagist/dt/litipk/flysystem-fallback-adapter.svg?style=flat-square)](https://packagist.org/packages/jenszahner/flysystem-fallback-adapter)


This adapter has been created to allow using a fallback filesystem for read operations when the files can't be accessed
Expand All @@ -17,7 +15,7 @@ through the main adapter.
## Installation

```bash
composer require litipk/flysystem-fallback-adapter
composer require jenszahner/flysystem-fallback-adapter
```

## Usage
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "litipk/flysystem-fallback-adapter",
"name": "jenszahner/flysystem-fallback-adapter",
"description": "Flysystem adapter for fallback filesystems",
"license": "MIT",
"authors": [
{
"name": "Andrés Correa Casablanca",
"email": "[email protected]"
"name": "Jens Zahner",
"email": "[email protected]"
}
],
"support": {
"email": "[email protected]",
"issues": "http://github.com/Litipk/flysystem-fallback-adapter/issues",
"source": "http://github.com/Litipk/flysystem-fallback-adapter"
"email": "[email protected]",
"issues": "http://github.com/jenszahner/flysystem-fallback-adapter/issues",
"source": "http://github.com/jenszahner/flysystem-fallback-adapter"
},
"require": {
"php": ">=5.4.0",
Expand Down
19 changes: 11 additions & 8 deletions src/FallbackAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ public function has($path)
*/
public function read($path)
{
$result = $this->mainAdapter->read($path);

if (false !== $result) {
return $result;
if ($this->mainAdapter->has($path)) {
$result = $this->mainAdapter->read($path);
if (false !== $result) {
return $result;
}
}

$result = $this->fallback->read($path);
Expand All @@ -238,10 +239,12 @@ public function read($path)
*/
public function readStream($path)
{
$result = $this->mainAdapter->readStream($path);

if (false !== $result) {
return $result;
if ($this->mainAdapter->has($path)) {
$result = $this->mainAdapter->readStream($path);

if (false !== $result) {
return $result;
}
}

$result = $this->fallback->readStream($path);
Expand Down

0 comments on commit 5d4dfba

Please sign in to comment.