升级 PHP 原生实现的 Olson tz 数据库 [英] Upgrading Olson tz database natively implemented in PHP

查看:49
本文介绍了升级 PHP 原生实现的 Olson tz 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个大量使用时区的网站,该网站需要处于可用的绝对最新 tz 信息的前沿(我已经通过 tz 邮件列表).我不知道如何让 PHP 安装在我的开发机器和我的网络主机上运行,​​以使用更新的 tz 数据而不是它们上已有的旧数据.这并不像升级 PHP 那样简单,因为即使是最新版本的 PHP 也不一定在任何给定时间拥有绝对最新的 tz 数据.

I'm working on a site that makes heavy use of time zones which needs to be on the bleeding edge of the absolute latest tz information available (which I already get through the tz mailing list). What I don't know is how to get the PHP installations running on my development machine and my web host to use more up-to-date tz data instead of the older data already on them. This isn't as simple as just upgrading PHP, since even the newest versions of PHP won't necessarily have the absolute latest tz data at any given time.

有人指出,pecl 中的 timezonedb 包让我获得软件包的最新官方版本,但如果我需要更进一步了解可能尚未正式发布的更新的前沿"怎么办?我很确定更新的 tz 数据必须使用 zic(分布在 tzcode 中)编译,并将生成的二进制文件提供给 pecl.我真的不知道这意味着什么,因此对于各个步骤的见解/链接将不胜感激.

It's been pointed out that the timezonedb package in pecl will get me to the latest official release of the package, but what if I need to go a little further to get to that "bleeding edge" of updates that may not have been officially released yet? I'm pretty sure that the newer tz data would have to be compiled with zic (distributed in tzcode), and the resulting binaries given to pecl. I really don't know all that this entails, so insight/links for individual steps would be appreciated.

如何在 (1) 一台 XAMPP 开发机器和/或 (2) 上升级这个由 PHP 实例本地使用的 Olson 数据库 一种典型的共享托管服务... 同时跳过尽可能少的障碍和管理障碍? 是否有任何细节可能会使共享托管环境变得更加困难,人们应该注意?是否存在数据的多个副本,以便在某个人以某种方式搞砸时可以轻松撤消更改?

How can one upgrade this Olson database that is used natively by one's instances of PHP on (1) a XAMPP development machine and/or (2) a typical shared hosting service... while jumping through as few hoops and administrative hurdles as possible? Are there any particulars which a shared hosting environment might make more difficult that one should be aware of? Is it feasible to have multiple copies of the data present so that changes could easily be undone if one somehow screws them up?

由于更改有时未及时正式发布以使其生效,因此我正在专门寻找一种方法来能够自行进行这些更改.我也有兴趣探索从快速/简单"到严格/最佳"的一系列可能解决方案的潜在权衡.

Since changes sometimes aren't officially released in time for them to take effect, I'm looking specifically for a way to be able to make these changes arbitrarily on my own. I'm also interested in exploring potential tradeoffs over a range of possible solutions from "quick/easy" to "rigorous/best".

推荐答案

最终答案

上面的评论给出了比这更好的答案 - 查看 PECL 包 timezonedb.

我已将其转换为社区 Wiki.

I've converted this to Community Wiki.


来自诸如 php-5.3.8.tar.bz2 之类的包的分发源在 ext/date/lib 目录中包含 Olson 数据库的翻译和文件 timezonedb.htimezonemap.hfallbackmap.h.这意味着 PHP 开发系统中的某处有代码从 Olson 数据库的某个版本生成此信息,但默认情况下不会分发.此外,它并不是作为 SVN 的一部分而明显分布的;我提取了修订版 321876 的 PHP 5.3 源代码,ext/date 目录不包含任何帮助(只有生成的文件).

The distributed source from a package such as php-5.3.8.tar.bz2 contains a translation of the Olson database in the ext/date/lib directory and files timezonedb.h, timezonemap.h, fallbackmap.h. This means that there is code somewhere in the PHP development system that generates this information from a release of the Olson database, but it is not distributed by default. Further, it is not self-evidently distributed as part of SVN; I extracted PHP 5.3 source as of revision 321876 and the ext/date directory contained nothing to assist (just the generated files).

因此,询问 PHP 维护者如何做可能是合适的;这当然应该是可能的,并且应该是自动化的(如果他们没有自动化,那将是愚蠢的).但是我不清楚 PHP 维护者以外的人能告诉我怎么做.

So, it might be appropriate to ask the PHP maintainers how to do it; it certainly should be possible, and it should be automated (it would be silly if they do not have it automated). But it is not clear to me that those outside the PHP maintainers can tell how to do it.

NEWS 文件中的评论表明 Derick Rethans 可能是一个很好的联系人 - 他将数据库更新为 Olson 2010c (2010.3).您可以在源目录顶层的 run-tests.php 文件中在 PHP 中找到他的电子邮件地址;您可以在 ext/date/lib 目录中的源代码中找到备用电子邮件地址.

The comments in the NEWS file indicate that Derick Rethans might be a good person to contact - he updated the database to Olson 2010c (2010.3). You can find his email address at PHP in the run-tests.php file in the top-level of the source directory; you can find an alternative email address in the source in ext/date/lib directory.

Derick Rethans 提供了用于从 Olson 数据库生成文件 timezonedb.h 的转换工具包:

Derick Rethans made available the conversion tool kit used to generate the file timezonedb.h from the Olson database here:

http://svn.xdebug.org/cgi-bin/viewvc.cgi/timelib/trunk/zones/?root=php

截至 2016-12-09,上面的链接是 404,Internet Archive 中的 WayBack Machine 无法提供帮助,因为它不允许通过 robots.txt 文件进行搜索.

As of 2016-12-09, the link above is 404, and the WayBack Machine at the Internet Archive can't help because it was not allowed to search by a robots.txt file.

但是,在 Google 上搜索php timelib"会发现:

However, a Google search for 'php timelib' finds:

这几乎可以肯定是替代品.

which is almost certainly the replacement.

这篇关于升级 PHP 原生实现的 Olson tz 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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