[英]how to migrate to utf8 for a multi-customer shared codeBase in PHP
in our company we use a proprietary CMS, this CMS is in use for almoust a thousand websites and is aged of approximatively 15 years. 在我们公司中,我们使用专有的CMS,该CMS已用于近一千个网站,并且其使用期限大约为15年。 (it has evolved but is very features rich)
(它已经进化,但是功能非常丰富)
until now whe have always used iso-8859-1 as charset, but whe have the nescessity to use utf-8 for one project. 到目前为止,一直使用iso-8859-1作为字符集,但是有必要在一个项目中使用utf-8。
there are my questions : 我的问题是:
TLDR infos : TLDR信息:
in this configuration, we cannot migrate every website on a single time (ie : because there is local code). 在这种配置下,我们无法一次迁移每个网站(即::因为存在本地代码)。 So I want to make two version of our core : one in iso-8859-1 and the other in utf8.
因此,我想制作两个内核版本:一个在iso-8859-1中,另一个在utf8中。 From now I think that I'm going to develop a script on our deployement system, this script, will create a copy utf8 encoded of our core before the rsynch-ing.
从现在开始,我认为我将在部署系统上开发一个脚本,该脚本将在rsynching之前创建一个对我们核心进行编码的utf8副本。
My concern is for example about all the "mb_ " stuff in PHP that won't be called, so i'll have to search/replace every php native fucntion to replace it by a custome one that will use the "mb_ " version if nescessary (furthermore, the overloding of those functions must be in the php.ini file, it cannot be defined in the .htaccess of a particulare website ( source )) 例如,我担心的是PHP中所有“ mb_ ”内容都不会被调用,因此我将不得不搜索/替换每个php本机功能,以将其替换为将使用“ mb_ ”版本的自定义脚本。不必要的(此外,这些功能的覆盖必须在php.ini文件中,无法在特定网站的.htaccess中定义它( 源 ))
PS : sorry for my poor english, it's not my native language :( PS:对不起,我的英语不好,那不是我的母语:(
So here is how I handled it : 所以这是我的处理方式:
for each individual CMS, a convertion tool exist, it convert filesystem, database charset/collation, configuration (ie : connect to mysql with utf8), .... 对于每个单独的CMS,都有一个转换工具,可以转换文件系统,数据库字符集/排序规则,配置(即:使用utf8连接到mysql),...。
for non compatible functions such as utf8_encode, I search/replaced it with a function who is in charge to not call the function if the server is utf8 对于不兼容的功能(例如utf8_encode),我将其搜索/替换为负责的功能(如果服务器为utf8,则该功能不调用该功能)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.