我的网站使用的是Drupal8,我们使用的是Dropzonejs模块的“媒体批量上传”选项。在我的本地环境中,我能够毫无问题地批量上传媒体。然而,在服务器环境下(与本地配置相同),当我尝试批量上传媒体时,它会抛出“无法打开输出流”错误。任何解决方案/答案/建议都是非常受欢迎和迫切需要的。
注意:单项上传工作正常。同样在批量上传期间,一旦进度条达到100%,就会发生错误。
发布于 2018-10-27 19:46:47
从Drupal8.6开始,我们需要在核心中安装一个补丁才能使此功能正常工作。要进行修复,需要将以下三个文件更改为:
getExternalUrl @var \Drupal\Core\StreamWrapper\StreamWrapperInterface \Drupal::service('stream_wrapper_manager')->getViaUri($uri)) */ if ($wrapper = /* {\Drupal::service(‘stream_wrapper_manager’)->getViaUri($uri))$ $wrapper->getExternalUrl();}返回替换函数(第48行)
公共函数getExternalUrl() {返回FALSE;
}
3.drupal/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php (在第365行添加)
* Tests that imported PO files aren't break the UI provided by "views".
*
* @throws \Behat\Mink\Exception\ExpectationException
*
* @link https://www.drupal.org/project/drupal/issues/2449895
*/
public function testPoFileImportAndAccessibilityOfFilesOverviewViewsPage() {
$this->container
->get('module_installer')
->install(['system', 'user', 'file', 'views']);
// Create and log in a user that's able to upload/import translations
// and has an access to the overview of files in a system.
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
'access files overview',
'administer languages',
'translate interface',
]));
// Import a dummy PO file.
$this->importPoFile($this->getPoFile(), [
'langcode' => 'fr',
]);
// The problem this test cover is exposed in an exception that is thrown
// by the "\Drupal\locale\StreamWrapper\TranslationsStream" when "views"
// module provides a page of files overview. Refer to the issue to find
// more information.
$this->drupalGet('admin/content/files');
$this->assertSession()->statusCodeEquals(200);
}(在第373行,覆盖以下函数)
public function importPoFile($contents, array $options = []) {
$file_system = $this->container->get('file_system');
$file_path = $file_system->tempnam('temporary://', 'po_') . '.po';
file_put_contents($file_path, $contents);
$options['files[file]'] = $file_path;
$this->drupalPostForm('admin/config/regional/translate/import', $options,
t('Import'));
$file_system->unlink($file_path);
}https://stackoverflow.com/questions/49768465
复制相似问题