首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在站点服务器上使用Drupal 8中的'Dropzonejs module‘的’'Media upload‘会出现“无法打开输出流”错误

在站点服务器上使用Drupal 8中的'Dropzonejs module‘的’'Media upload‘会出现“无法打开输出流”错误
EN

Stack Overflow用户
提问于 2018-04-11 14:58:51
回答 1查看 415关注 0票数 0

我的网站使用的是Drupal8,我们使用的是Dropzonejs模块的“媒体批量上传”选项。在我的本地环境中,我能够毫无问题地批量上传媒体。然而,在服务器环境下(与本地配置相同),当我尝试批量上传媒体时,它会抛出“无法打开输出流”错误。任何解决方案/答案/建议都是非常受欢迎和迫切需要的。

注意:单项上传工作正常。同样在批量上传期间,一旦进度条达到100%,就会发生错误。

The defect screenshot is here

EN

回答 1

Stack Overflow用户

发布于 2018-10-27 19:46:47

从Drupal8.6开始,我们需要在核心中安装一个补丁才能使此功能正常工作。要进行修复,需要将以下三个文件更改为:

  1. drupal/core/includes/files.inc (第234行)

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行添加)

代码语言:javascript
运行
复制
       * 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行,覆盖以下函数)

代码语言:javascript
运行
复制
   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);
  }
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49768465

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档