Contributions are ready for review
| From: | doc-zh at lists dot php dot net | Date: | Mon, 07 Apr 2014 12:00:02 +0000 |
| Subject: | Contributions are ready for review | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-4140@lists.php.net to get a copy of this message | ||
Hello PHP ZH Documentation team,
There are contributions within the online editor queue for this language.
Please review, then commit or delete these patches.
Patches for review :
-----------------------
New file: zh/reference/yaf/setup.xml
By: Carbyn Wu on 2013-11-28 23:13:11
===================================================================
--- zh/reference/yaf/setup.xml
+++ zh/reference/yaf/setup.xml
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 317663 $ -->
+<!-- $Revision: $ -->
+<!-- EN-Revision: 317663 Maintainer: Carbyn Wu Status: ready -->
+<!-- Reviewed: no -->
<chapter xml:id="yaf.setup" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
- <!-- {{{ Requirements -->
+ <!-- {{{ 需求 -->
<section xml:id="yaf.requirements">
&reftitle.required;
&no.requirement;
</section>
<!-- }}} -->
- <!-- {{{ Installation -->
+ <!-- {{{ 安装 -->
<section xml:id="yaf.installation">
&reftitle.install;
<para>
@@ -27,11 +29,11 @@
</section>
<!-- }}} -->
- <!-- {{{ Configuration -->
+ <!-- {{{ 配置 -->
&reference.yaf.ini;
<!-- }}} -->
- <!-- {{{ Resources -->
+ <!-- {{{ 资源 -->
<section xml:id="yaf.resources">
&reftitle.resources;
&no.resource;
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=51117
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=51117
------------------------------------------------------------------
New file: zh/reference/yaf/book.xml
By: Carbyn Wu on 2013-11-28 23:14:50
===================================================================
--- zh/reference/yaf/book.xml
+++ zh/reference/yaf/book.xml
@@ -1,25 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 327532 $ -->
+<!-- $Revision: $ -->
+<!-- EN-Revision: 332156 Maintainer: Carbyn Wu Status: ready -->
+<!-- Reviewed: no -->
<book xml:id="book.yaf" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
- <title>Yet Another Framework</title>
+ <title>Yaf</title>
<titleabbrev>Yaf</titleabbrev>
<preface xml:id="intro.yaf">
&reftitle.intro;
<para>
- <literal>Yet Another Framework</literal> (<acronym>Yaf</acronym>)
扩展是一个用来开发web应用的php框架
+ The <literal>Yet Another Framework</literal> (<acronym>Yaf</acronym>)
扩展是一个用来开发web应用的php框架。
</para>
<para>
- 运行Yaf的php版本需要大于等于5.2.1,更早期的版本可能不能正常工作.
+ Yaf需要5.2.1及以上版本PHP,早期版本可能不能正常工作。
</para>
<para>
- 这里有一个简单的性能对比资料 <link
- xlink:href="&url.yaf.benchmarks;">Yaf Performance</link>.
+ 这里有一个简单的Yaf性能测试。<link
+ xlink:href="&url.yaf.benchmarks;">Yaf性能 </link>.
</para>
<para>
快速入门请参见 <link
- linkend="yaf.tutorials">Turorials</link>.
+ linkend="yaf.tutorials">教程</link> .
</para>
</preface>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=51116
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=51116
------------------------------------------------------------------
New file: zh/reference/yaf/configure.xml
By: Carbyn Wu on 2013-11-28 23:15:16
===================================================================
--- zh/reference/yaf/configure.xml
+++ zh/reference/yaf/configure.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 317663 $ -->
+<!-- $Revision: $ -->
+<!-- EN-Revision: 317663 Maintainer: Carbyn Wu Status: ready -->
+<!-- Reviewed: no -->
<section xml:id="yaf.installation" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=51118
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=51118
------------------------------------------------------------------
New file: zh/reference/yaf/constants.xml
By: Carbyn Wu on 2013-11-28 23:16:13
===================================================================
--- zh/reference/yaf/constants.xml
+++ zh/reference/yaf/constants.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 323624 $ -->
+<!-- $Revision: $ -->
+<!-- EN-Revision: 323624 Maintainer: Carbyn Wu Status: ready -->
+<!-- Reviewed: no -->
<appendix xml:id="yaf.constants" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=51119
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=51119
------------------------------------------------------------------
New file: zh/reference/yaf/tutorials.xml
By: Carbyn Wu on 2013-11-28 23:25:28
===================================================================
--- zh/reference/yaf/tutorials.xml
+++ zh/reference/yaf/tutorials.xml
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 327532 $ -->
+<!-- $Revision: $ -->
+<!-- EN-Revision: 329535 Maintainer: Carbyn Wu Status: ready -->
+<!-- Reviewed: no -->
<chapter xml:id="yaf.tutorials" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section role="examples">
<example>
- <title>一个典型的目录结构</title>
+ <title>一个典型的应用目录结构</title>
<screen>
<![CDATA[
- index.php
@@ -31,8 +33,8 @@
<section role="examples">
<example>
- <title>一个经典的入口文件</title>
- <para>入口文件是所有请求的入口, 一般都借助于rewrite规则,
把所有的请求都重定向到这个入口文件.</para>
+ <title>入口文件</title>
+
<para>顶层目录下的index.php是整个应用的唯一入口,应该把所有请求都重定向到这个文件(在Apache+php_mod模式下可以使用.htaccess)。</para>
<programlisting role="php">
<![CDATA[
<?php
@@ -82,7 +84,7 @@
<section role="examples">
<example>
- <title>一个简单的配置文件</title>
+ <title>应用配置文件</title>
<programlisting role="ini">
<![CDATA[
[yaf]
@@ -106,7 +108,9 @@
class IndexController extends Yaf_Controller_Abstract {
/* default action */
public function indexAction() {
- $this->view->word = "hello world";
+ $this->_view->word = "hello world";
+ //or
+ // $this->getView()->word = "hello world";
}
}
?>
@@ -117,7 +121,7 @@
<section role="examples">
<example>
- <title>默认的视图文件</title>
+ <title>默认视图文件</title>
<programlisting role="php">
<![CDATA[
<html>
@@ -135,7 +139,7 @@
<section role="examples">
<example>
- <title>运行结果</title>
+ <title>运行应用</title>
&example.outputs.similar;
<screen>
<![CDATA[
@@ -151,8 +155,7 @@
</screen>
<note>
<para>
- you can also generate above example by use Yaf codes generator, which
- could be found here yaf@github.
+ 在yaf@github上有Yaf代码生成器,你也可以用它来生成上面的例子。
</para>
</note>
</example>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=51120
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=51120
------------------------------------------------------------------
New file: zh/reference/yaf/appconfig.xml
By: Carbyn Wu on 2013-11-29 15:17:19
===================================================================
--- zh/reference/yaf/appconfig.xml
+++ zh/reference/yaf/appconfig.xml
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision: 327525 $ -->
+<!-- $Revision: $ -->
+<!-- EN-Revision: 329592 Maintainer: Carbyn Wu Status: ready -->
+<!-- Reviewed: no -->
<chapter xml:id="yaf.appconfig" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
- <title xmlns="http://docbook.org/ns/docbook">Application
Configuration</title>
+ <title xmlns="http://docbook.org/ns/docbook">应用配置</title>
<para>
- 你需要给出一个config的数组或者ini文件(参见
- <classname>Yaf_Config_Ini</classname>) 用来传入
+ 你需要传递一个config数组或ini配置文件(参见
+ <classname>Yaf_Config_Ini</classname>) 给
<methodname>Yaf_Application::__construct</methodname>.
</para>
<para>
- Yaf和用户共用一个配置空间,
也就是在Yaf_Application初始化时刻给出的配置文件中的配置. 作为区别,
Yaf的配置项都以"yaf."或者"application."开头,如果同一个配置项同时使用了"yaf."和"application.",那么"application."会生效,而"yaf."不会.
+
Yaf的配置文件会和用户的配置文件合并。区别在于,Yaf的配置文件是以"yaf."或"application."开头,如果两项都存在,则"application."生效。
<example>
<title>config为数组的例子</title>
<programlisting role="php">
@@ -153,12 +155,12 @@
</term>
<listitem>
<para>
- 用来指定"controllers", "views", "models",
"plugins"的目录.
+ 应用程序的目录,包含"controllers", "views",
"models", "plugins"等子目录。
</para>
<para>
<note>
<para>
- 这是唯一一个没有默认值的配置项,你需要手动指定它.
+ 这是唯一一个没有默认值的配置项,你需要手动指定它。
</para>
</note>
</para>
@@ -171,8 +173,8 @@
</term>
<listitem>
<para>
- PHP脚本的扩展名
- <classname>Yaf_Loader</classname>).
+ PHP脚本的扩展名,类的自动加载需要用到它(
+ <classname>Yaf_Loader</classname>)。
</para>
</listitem>
</varlistentry>
@@ -183,7 +185,7 @@
</term>
<listitem>
<para>
- 视图模板扩展名
+ 视图模板扩展名。
</para>
</listitem>
</varlistentry>
@@ -194,10 +196,10 @@
</term>
<listitem>
<para>
- 声明存在的模块名,尤其是路径超过3段的模块.
+
注册的模块列表,以逗号分隔,用于路由处理,特别是当PATH_INFO超过三段的时候,
</para>
<para>
- Yaf以此来找出路径第一段是否是一个模块的名称.
+ Yaf需要用它来判断第一段是否是一个模块。
</para>
</listitem>
</varlistentry>
@@ -208,14 +210,13 @@
</term>
<listitem>
<para>
- 本地(自身)类库的绝对目录地址, 参见
<classname>Yaf_Loader</classname> 和
- <link linkend="ini.yaf.library">yaf.library</link>.
+ 本地类库的目录,参见<classname>Yaf_Loader</classname> 和
+ <link linkend="ini.yaf.library">yaf.library</link>。
</para>
<note>
<para>
- Yaf
2.1.6之后,这个配置项可以是一个数组,当它是数组的时候,类库的路径将尝试使用
<link
-
linkend="configuration.yaf.library.directory">application.library.directory</link>
- 的值
+
Yaf2.1.6以后,该配置项也可以是一个数组,当它是数组的时候,类库的路径将尝试使用<link
+
linkend="configuration.yaf.library.directory">application.library.directory</link>的值。
</para>
</note>
</listitem>
@@ -227,7 +228,9 @@
</term>
<listitem>
<para>
- Yaf 2.1.6加入
+ Alias of <link
+ linkend="configuration.yaf.library">application.library</link>.
Introduced
+ in Yaf 2.1.6
</para>
</listitem>
</varlistentry>
@@ -238,10 +241,10 @@
</term>
<listitem>
<para>
- 以逗号分隔的本地库命名空间前缀。
+ 逗号分隔的本地类库命名空间前缀。
</para>
<para>
- Yaf 2.1.6加入
+ Yaf2.1.6以后加入
</para>
</listitem>
</varlistentry>
@@ -252,7 +255,7 @@
</term>
<listitem>
<para>
- Bootstrap路径(绝对路径)
+ Bootstrap类脚本文件的绝对路径。
</para>
</listitem>
</varlistentry>
@@ -263,12 +266,10 @@
</term>
<listitem>
<para>
- 在路由中, 需要忽略的路径前缀.
- 举个例子, 比如"/prefix/controller/action"这样的一个请求.
如果你将application.baseUri设置为"/prefix",
- 那么只有"/controller/action"会被当做路由路径.
+
路由处理中需要忽略的路径前缀。举个例子,请求"/prefix/controller/action"时。如果你将application.baseUri设置为"/prefix",那么只有"/controller/action"会被当做路由路径。
</para>
<para>
- 通常不需要设置, Yaf会自动判断.
+ 通常不需要设置此值。
</para>
</listitem>
</varlistentry>
@@ -279,7 +280,8 @@
</term>
<listitem>
<para>
- 如果设置为On,
Yaf会在发生错误的时候抛出异常,参见<methodname>Yaf_Dispatcher::throwException</methodname>.
+ 开启此项,Yaf会在发生错误的地方抛出异常。参见
+ <methodname>Yaf_Dispatcher::throwException</methodname>。
</para>
</listitem>
</varlistentry>
@@ -290,7 +292,8 @@
</term>
<listitem>
<para>
- 如果设置为On,
Yaf会在捕获到异常的时候跳转到响应的错误页面,参见<methodname>Yaf_Dispatcher::catchException</methodname>.
+ 开启此项,如果有未捕获的异常,Yaf将会把它定向到Error controller, Error
Action。参见
+ <methodname>Yaf_Dispatcher::catchException</methodname>。
</para>
</listitem>
</varlistentry>
@@ -301,7 +304,8 @@
</term>
<listitem>
<para>
- 默认路由, 如果没用定义, 那么将使用静态路由来当做默认路由,
参见<methodname>Yaf_Router::addRoute</methodname>.
+ 默认路由,如果未指定,静态路由会被当做是默认路由,参见:
+ <methodname>Yaf_Router::addRoute</methodname>。
</para>
</listitem>
</varlistentry>
@@ -312,8 +316,8 @@
</term>
<listitem>
<para>
- The default module name, see also
- <methodname>Yaf_Dispatcher::setDefaultModule</methodname>.
+ 默认模块名,参见
+ <methodname>Yaf_Dispatcher::setDefaultModule</methodname>。
</para>
</listitem>
</varlistentry>
@@ -324,8 +328,8 @@
</term>
<listitem>
<para>
- The default controller name, see also
- <methodname>Yaf_Dispatcher::setDefaultController</methodname>.
+ 默认控制器名,参见
+ <methodname>Yaf_Dispatcher::setDefaultController</methodname>。
</para>
</listitem>
</varlistentry>
@@ -336,8 +340,8 @@
</term>
<listitem>
<para>
- The default action name, see also
- <methodname>Yaf_Dispatcher::setDefaultAction</methodname>.
+ 默认动作名,参见
+ <methodname>Yaf_Dispatcher::setDefaultAction</methodname>。
</para>
</listitem>
</varlistentry>
@@ -349,11 +353,11 @@
</term>
<listitem>
<para>
- Set yaf runtime configure in application.ini, like:
+ 在application.ini中设置Yaf运行时配置,如:
<link
linkend="ini.yaf.lowcase-path">application.system.lowcase_path</link>
<note>
<para>
- only those PHP_INI_ALL configures can be set in this way
+ 仅有PHP_INI_ALL配置项能这样设置
</para>
</note>
</para>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=51121
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=51121
------------------------------------------------------------------
Modified: zh/features/gc.xml
By: on 2014-04-02 19:38:31
===================================================================
--- zh/features/gc.xml
+++ zh/features/gc.xml
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 329146 $ -->
<chapter xml:id="features.gc" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
+<!-- Reviewed: no Maintainer: -->
+<!-- Reviewed: no Maintainer: -->
+<!-- Reviewed: no Maintainer: -->
<title>垃圾回收机制</title>
<para>
@@ -286,10 +289,16 @@
</mediaobject>
</para>
<para>
-
为避免不得不检查所有引用计数可能减少的垃圾周期,这个算法把所有可能根(possible
roots 都是zval变量容器),放在根缓冲区(root
buffer)中(用紫色来标记),这样可以同时确保每个可能的垃圾根(possible garbage
root)在缓冲区中只出现一次。仅仅在根缓冲区满了时,才对缓冲区内部所有不同的变量容器执行垃圾回收操作。看上图的步骤
A。
+
为避免不得不检查所有引用计数可能减少的垃圾周期,这个算法把所有可能根(possible
roots 都是zval变量容器),放在根缓冲区(root
buffer)中(用紫色来标记,称为疑似垃圾),这样可以同时确保每个可能的垃圾根(possible
garbage
root)在缓冲区中只出现一次。仅仅在根缓冲区满了时,才对缓冲区内部所有不同的变量容器执行垃圾回收操作。看上图的步骤
A。
</para>
<para>
- 在步骤 B
中,算法使用深度优先搜索查找所有可能的根,找到后将每个变量容器中的引用计数减“1",为确保不会对同一个变量容器减两次"1",用灰色标记已减过“1”的。在步骤
C
中,算法再一次对每个根节点使用深度优先搜索,检查每个变量容器的引用计数。如果引用计数是
0
,变量容器用白色来标记(图中的蓝色)。如果引用次数大于0,则恢复在这个点上使用深度优先搜索而将引用计数减”1“的操作(即引用计数加“1”),然后将它们重新用黑色标记。在最后一步
D 中,算法遍历根缓冲区以从那里删除变量容器根(zval
roots),同时,检查是否有在上一步中被白色标记的变量容器。每个被白色标记的变量容器都被清除。
+ 在步骤 B
中,模拟删除每个紫色变量。模拟删除时可能将不是紫色的普通变量引用数减"1",如果某个普通变量引用计数变成0了,就对这个普通变量再做一次模拟删除。每个变量只能被模拟删除一次,模拟删除后标记为灰(原文说确保不会对同一个变量容器减两次"1",不对的吧)。
+ </para>
+ <para>
+ 在步骤 C
中,模拟恢复每个紫色变量。恢复是有条件的,当变量的引用计数大于0时才对其做模拟恢复。同样每个变量只能恢复一次,恢复后标记为黑,基本就是步骤
B 的逆运算。这样剩下的一堆没能恢复的就是该删除的蓝色节点了,在步骤 D
中遍历出来真的删除掉。
+ </para>
+ <para>
+
算法中都是模拟删除、模拟恢复、真的删除,都使用简单的遍历即可(最典型的深搜遍历)。复杂度为执行模拟操作的节点数正相关,不只是紫色的那些疑似垃圾变量。
</para>
<para>
现在,你已经对这个算法有了基本了解,我们回头来看这个如何与PHP集成。默认的,PHP的垃圾回收机制是打开的,然后有个
&php.ini; 设置允许你修改它:<option>zend.enable_gc</option>。
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=53143
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=53143
------------------------------------------------------------------
Modified: zh/reference/network/functions/fsockopen.xml
By: 周梦康 on 2014-04-05 14:08:54
===================================================================
--- zh/reference/network/functions/fsockopen.xml
+++ zh/reference/network/functions/fsockopen.xml
@@ -91,7 +91,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
-
<function>fsockopen</function>将返回一个文件句柄,之后可以被其他文件类函数调用(例如:<function>fgets</function><function>fgetss</function>,<function>fwrite</function>,<function>fclose</function>还有<function>feof</function>)。如果调用失败,将返回&false;。
+
<function>fsockopen</function>将返回一个文件句柄,之后可以被其他文件类函数调用(例如:<function>fgets</function>,<function>fgetss</function>,<function>fwrite</function>,<function>fclose</function>还有<function>feof</function>)。如果调用失败,将返回&false;。
</para>
</refsect1>
<refsect1 role="errors">
@@ -133,7 +133,7 @@
&reftitle.examples;
<para>
<example>
- <title><function>fsockopen</function> Example</title>
+ <title><function>fsockopen</function>的例子</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -157,7 +157,7 @@
</para>
<para>
<example>
- <title>Using UDP connection使用UDP连接</title>
+ <title>使用UDP连接</title>
<para>
下面这个例子展示了怎么样在自己的机器上通过UDP套接字连接(端口号13)来检索日期和时间。
</para>
=> Put this change into your patches : https://edit.php.net/?project=php&action=putIntoMyPatches&idDB=53181
=> Delete this change: https://edit.php.net/?project=php&action=deleteThisChange&idDB=53181
------------------------------------------------------------------
--
https://edit.php.net/
This email is send automatically by the Php Docbook Online Editor.