自动扩展更新无法处理来自 github 的 zip 文件? [英] automatic extension update can't handle zip file from github?

查看:26
本文介绍了自动扩展更新无法处理来自 github 的 zip 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 github 上托管了一个扩展,我想为其提供自动更新.但是,当我提供附加到发布的文件的 URL 时,Joomla 只会报告以下有关尝试自动更新的信息:

Fehler beim Verbindungsaufbau zum 服务器:错误未知Ungültige Webadresse

翻译

连接服务器时出错:错误未知无效的网址

尝试通过扩展 - 安装页面从网址进行安装时也是如此.但是,从浏览器中,我可以很好地下载文件.有人知道这是为什么吗?这是 github 端的错误,还是 Joomla 的错误?或者是 github 端的某种安全"或安全"机制?我能做些什么来避免它?还是那两个只是不一起玩?

示例网址:https://github.com/codeling/bfstop/releases/download/1.2.0/pkg_bfstop-1.2.0.zip

将 piotr_cz 在回答下方的评论中提到的 downloadPackage 方法 (gist.github.com/piotr-cz/8316210) 的补丁插入到我的 Joomla 安装中.

解析重定向后传入方法的URL:https://s3.amazonaws.com/github-cloud/releases/6794712/f2aa5eb4-7838-11e3-837a-c6be2639e4ca.zip?response-content-disposition=attachment%3B%20filename%3Dpkg_bfstop-1.2.0.zip&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1389455424&Signature=Nnyl6TnWueTqK8bPkPXUidM8UzQ

新插入行后的 URL:https://s3.amazonaws.com/github-cloud/releases/6794712/f2aa5eb4-7838-11e3-837a-c6be2639e4ca.zip?response-content-disposition=attachment;filename=pkg_bfstop-1.2.0.zip&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1389455424&Signature=Nnyl6TnWueTqK8bPkPXUidM8UzQ=

响应仍然是 505 错误:

响应:JHttpResponse 对象([代码] =>505[标题] =>大批([日期] =>2014 年 1 月 11 日星期六 15:49:24 GMT[连接] =>关闭[服务器] =>亚马逊S3)[身体] =>)

所以我认为编码无关紧要.错误 505 确实表示 http 版本问题?为什么 Joomla 和亚马逊会在 HTTP 版本上存在分歧?绝对不是这里的 HTTP 专家,但 1.1 版应该是 10 多年以来未更改的标准版本?

解决方案

结论:

  1. 由 GitHub 的标签发布自动生成的下载目前与 Joomla 安装程序兼容(2014 年 1 月)存储库名称与扩展名(元素)匹配.Joomla 安装程序能够使用以下扩展程序:

    • 直接定位文件和文件夹:

      mod_mymodule.zip:/mod_mymodule.xml/mod_mymodule.php

    • 或者将文件和文件夹放置在与存档同名的文件夹中(参见 JInstallerHelper::unpack):

      mod_mymodule.zip:/mod_mymodule/mod_mymodule/mod_mymodule.xml/mod_mymodule/mod_mymodule.php

      这就是 GitHub TagsReleases 的构建方式.自动生成的存储库 mod_mymodule 下载结果是 mod_mymodule-[tag/branch].zip 存档和 mod_mymodule-[tag/branch] 子文件夹.假设我们标记扩展 1.0.0-beta 时:

      mod_mymodule-1.0.0-beta.zip:/mod_mymodule-1.0.0-beta/mod_mymodule-1.0.0-beta/mod_mymodule.xml/mod_mymodule-1.0.0-beta/mod_mymodule.php

      注意:归档的构建方式发生了一些变化(参见 Automatic扩展更新:未知档案类型)

  2. 手动附加二进制文件添加到 GitHub 发布 托管在 亚马逊网络服务.通过 JInstallerHelper::downloadPackage<请求下载这些/a> 导致响应 505 HTTP Version Not Supported,我们还没有找到解决此问题的可行解决方案.

最终可以使用 GitHub 作为 Joomla 扩展更新服务器(这很方便),只要您使用自动生成的下载即可.

GitHub 提供版本控制服务,而不是更新服务器,因此可下载存档的构建方式将来可能会再次发生变化.

在我们找到一种使用 Joomla 安装程序下载附加二进制文件(其中一个可以完全控制档案的名称和结构)的方法之前,不应将 GitHub 视为 Joomla 扩展更新的可靠工具.我相信有一种方法可以修补 JInstaller 包与 AWS 兼容(使用命令行 curl 下载工作正常).

感谢 ccplRandolphCarter 获取有关此答案的信息.

I have an extension hosted on github, for which I want to provide automatic updates. However, when I provide the URL to a file attached to a release, Joomla just reports the following on trying to automatically update:

Fehler beim Verbindungsaufbau zum Server: Error Unknown
Ungültige Webadresse

Translation

Error in connecting to server: Error Unknown
Invalid web address

It's the same when trying to install from the web address via the Extensions - Install page. From the browser, I can download the file just fine however. Anybody got an idea why that is? Is it an error on github side, or on Joomla's? Or is it some "safety" or "security" mechanism on github side? What can I do to avoid it? Or do those two just not play along?

Example URL: https://github.com/codeling/bfstop/releases/download/1.2.0/pkg_bfstop-1.2.0.zip

Edit:

Inserted the patch for downloadPackage method (gist.github.com/piotr-cz/8316210) mentioned by piotr_cz in the comments below the answer into my Joomla installation now.

URL passed into the method after resolving the redirect: https://s3.amazonaws.com/github-cloud/releases/6794712/f2aa5eb4-7838-11e3-837a-c6be2639e4ca.zip?response-content-disposition=attachment%3B%20filename%3Dpkg_bfstop-1.2.0.zip&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1389455424&Signature=Nnyl6TnWueTqK8bPkPXUidM8UzQ%3D

URL after the newly inserted lines: https://s3.amazonaws.com/github-cloud/releases/6794712/f2aa5eb4-7838-11e3-837a-c6be2639e4ca.zip?response-content-disposition=attachment; filename=pkg_bfstop-1.2.0.zip&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1389455424&Signature=Nnyl6TnWueTqK8bPkPXUidM8UzQ=

The response is still a 505 error:

response: JHttpResponse Object
(
    [code] => 505
    [headers] => Array
        (
            [Date] => Sat, 11 Jan 2014 15:49:24 GMT
            [Connection] => close
            [Server] => AmazonS3
        )

    [body] =>
)

So I suppose the encoding doesn't matter. The error 505 would indeed indicate http version problems? Why would Joomla and Amazon disagree on HTTP versions? Definitely not an HTTP expert here but version 1.1 should be the unchanged standard version since more than 10 years now?

解决方案

Conclusions:

  1. Automatically generated downloads by GitHub's Tags and Releases are compatible with Joomla Installer at this moment (Jan 2014) as long as the repository name matches extension name (element). Joomla Installer is able to work with an extension which:

    • Have files and folders located directly:

      mod_mymodule.zip:
      
      /mod_mymodule.xml
      /mod_mymodule.php
      

    • Or have files and folders located in a folder of the same name as the archive (see JInstallerHelper::unpack):

      mod_mymodule.zip:
      
      /mod_mymodule
      /mod_mymodule/mod_mymodule.xml
      /mod_mymodule/mod_mymodule.php
      

      This is how GitHub Tags and Releases are built now. Automatically generated downloads of repository mod_mymodule results in mod_mymodule-[tag/branch].zip archive with mod_mymodule-[tag/branch] subfolder. Say when we tag extension 1.0.0-beta:

      mod_mymodule-1.0.0-beta.zip:
      
      /mod_mymodule-1.0.0-beta
      /mod_mymodule-1.0.0-beta/mod_mymodule.xml 
      /mod_mymodule-1.0.0-beta/mod_mymodule.php
      

      Note: There were some changes in how archive is built (see Automatic Extension Update: Unknown Archive type)

  2. Manually attached Binaries added to a GitHub Release are hosted in the Amazon Web Services. Request to download these by JInstallerHelper::downloadPackage results in an response 505 HTTP Version Not Supported and we didn't find a working solution for this problem yet.

In the end one may use GitHub as an Joomla Extensions Update server (it's pretty convenient), as long as you use automatically generated downloads.

GitHub provides Version Control service, not an Update server so the way how downloadable archive is built may change again in future.

Until we find out a way how to download Attached Binaries (where one have full control over archive's name and structure) using Joomla Installer, GitHub should not be perceived as a reliable tool for Joomla extension updates. I believe there's a way to patch the JInstaller package to be compatible with the AWS (download works fine using command-line curl).

Thanks for ccpl and RandolphCarter on getting information for this answer.

这篇关于自动扩展更新无法处理来自 github 的 zip 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆