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

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

问题描述

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

  Fehler beim Verbindungsaufbau zum Server:错误未知UngültigeWebadresse 

翻译

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

尝试通过扩展-安装"页面从网址进行安装时相同.从浏览器中,我可以很好地下载文件.有人知道为什么会这样吗?是在github端还是Joomla的错误?还是在github端有某种安全"或安全"机制?我应该怎么做才能避免这种情况?还是那两个只是不一起玩?

示例URL: 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-处置=附件%3B%20文件名%3Dpkg_bfstop-1.2.0.zip& AWSAccessKeyId = AKIAISTNZFOVBIJMK3TQ&Expires = 1389455424& Signature = Nnyl6TnWueTqK8bPkPXUidM8UzQ%3D 新插入的行之后的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对象([code] =>505[标题] =>大批([日期] =>2014年1月11日星期六,格林尼治标准时间[连接] =>关闭[服务器] =>亚马逊S3)[body] =>) 

所以我想编码没关系.错误505确实表示http版本有问题吗?为什么Joomla和Amazon在HTTP版本上存在分歧?绝对不是HTTP专家,但1.1版应该是十多年以来的不变标准版本?

解决方案

结论:

    GitHub的 Tags Releases 生成的
  1. 自动生成的下载目前(2014年1月)与Joomla Installer兼容.存储库名称与扩展名(元素)匹配.Joomla Installer可以使用以下扩展程序:

  2. 添加到GitHub 发布中的
  3. 手动附加的二进制文件托管在 JInstallerHelper :: downloadPackage <下载/a>导致响应 505不支持HTTP版本,我们还没有找到解决此问题的可行解决方案.

最后,只要您使用自动生成的下载,就可以将GitHub用作Joomla Extensions Update服务器(这非常方便).

GitHub提供了版本控制服务,而不是更新服务器,因此将来可下载归档文件的构建方式可能会再次改变.

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

感谢 ccpl

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天全站免登陆