-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stream wrapper for migration source files.
Signed-off-by: Stefan Borchert <[email protected]>
- Loading branch information
Stefan Borchert
committed
Jul 1, 2017
1 parent
68532fa
commit 74d3f92
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Drupal\up_migrate\StreamWrapper; | ||
|
||
use Drupal\Core\Site\Settings; | ||
use Drupal\Core\StreamWrapper\LocalReadOnlyStream; | ||
|
||
/** | ||
* Simple read-only stream wrapper for migration files. | ||
*/ | ||
class MigrationStream extends LocalReadOnlyStream { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() { | ||
return t('Migration source files'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDescription() { | ||
return t('Migration files'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getDirectoryPath() { | ||
return static::basePath(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getExternalUrl() { | ||
throw new \LogicException('Migration file URLs are not meant to be public.'); | ||
} | ||
|
||
/** | ||
* Returns the base path for migration:https://. | ||
* | ||
* @return string | ||
* The base path for migration:https://. | ||
*/ | ||
public static function basePath() { | ||
return Settings::get('file_migration_source_path'); | ||
} | ||
|
||
} |