Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
namespace Drupal\Core\File\MimeType;
|
||||
|
||||
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser as SymfonyMimeTypeGuesser;
|
||||
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
|
||||
|
@ -35,11 +36,28 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface {
|
|||
*/
|
||||
protected $sortedGuessers = NULL;
|
||||
|
||||
/**
|
||||
* The stream wrapper manager.
|
||||
*
|
||||
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
|
||||
*/
|
||||
protected $streamWrapperManager;
|
||||
|
||||
/**
|
||||
* Constructs a MimeTypeGuesser object.
|
||||
*
|
||||
* @param StreamWrapperManagerInterface $streamWrapperManager
|
||||
* The stream wrapper manager.
|
||||
*/
|
||||
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager) {
|
||||
$this->streamWrapperManager = $stream_wrapper_manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function guess($path) {
|
||||
if ($wrapper = file_stream_wrapper_get_instance_by_uri($path)) {
|
||||
if ($wrapper = $this->streamWrapperManager->getViaUri($path)) {
|
||||
// Get the real path from the stream wrapper.
|
||||
$path = $wrapper->realpath();
|
||||
}
|
||||
|
@ -100,6 +118,8 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface {
|
|||
* @see \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser
|
||||
*/
|
||||
public static function registerWithSymfonyGuesser(ContainerInterface $container) {
|
||||
// Reset state, so we do not store more and more services during test runs.
|
||||
SymfonyMimeTypeGuesser::reset();
|
||||
$singleton = SymfonyMimeTypeGuesser::getInstance();
|
||||
$singleton->register($container->get('file.mime_type.guesser'));
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ function hook_file_url_alter(&$uri) {
|
|||
}
|
||||
// Public created files.
|
||||
else {
|
||||
$wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
|
||||
$wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($scheme);
|
||||
$path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue