close

前言

以下的文章是從pear官方網站所擷取下來的(應該是沒有版權問題吧 ^^")

是大爺的學習筆記

所以如果翻譯有什麼地方有錯誤,請告知大爺,感恩哩 ^^


Overview (概論)

Post-install scripts (documented here and here) are mostly the same in Pyrus with a few important differences.

The XML format in package.xml is identical, so no change need be made to the <paramgroup> or other tags. The script itself should still follow the naming conventions of PEAR. The only real difference is the naming of methods within the script.


(post-install scripts {文件 這裡這裡) 大部份相同在pyrus中有著少許重要的不同{怪怪…這是什麼意思?}。 XML格式在package.xml是完全相同的,所以沒有改變需要建立<paramgroup>或是其它標籤。script它自已應該依然遵循pear的命名規則。唯一實際的不同是在script之內方法的命名。)


PEAR requires that all post-install scripts implement init(), run() and optionally postProcessPrompts(). Pyrus requires post-install scripts to implement init2(), run2(), and optionally postProcessPrompts2(). This allows PEAR and Pyrus-based post-install scripts to co-exist in the same package without difficulty. Note that post-install scripts must be E_STRICT and E_DEPRECATED compliant, otherwise many PHP warnings will be emitted. One way of handling this issue is to put PHP4 non-E_STRICT-compatible code into a separate file and include it dynamically at run-time. The same should be done for any PHP5+ non-PHP4 compatible code if the post-install script is expected to be able to run in PHP 4.


(pear 要求所有的post-install script實作init()run()和可選擇的postProcessPrompts()。pyrus要求post-install scripts 去實作init2()run2()和可選擇的postProcessPrompts2()。這是允許pear和pyrus-based post-install scripts 沒有困難的並存在相同的套件中。注意post-install scripts 必須被 E_STRICT和E_DEPRECATED 配合使用,否則會產生許多的PHP 警告。操作這個發佈的一個方式是放置PHP4 non-E_STRICT-compatible 碼在一個分開的檔案和自動的配置在執行期間。假如post-install script 預期也要能夠在PHP4中執行,相同應該也要做任何的PHP5+非PHP4相兼容的程式碼。{不懂最後一行是啥意思 @@})


The init2 method (init2 方法)

The init2() method should accept two parameters like so:

(Init2()方法應該接授兩個參數像是這樣:)

<?php
function init2($pkg$lastversion)
{
}
?>

$pkg is an object representing the package, and $lastversion is the last installed version of the package.

($pkg 是一個物件描術這個套件,而$lastversion是這個最後安裝套件的版本。)

 

The run2 and postProcessPrompts2 methods (run2和postProcessPrompts2 方法)

These two methods should accept identical parameters to what the PEAR equivalent accepted. The only reason these are called is to allow easy differentiation between what kind of installer is calling the post-install script.

 

(這兩個方法應該接受同樣的PEAR所接受相等的參數。唯一的理由這是被稱作允許簡單的區別在什麼樣的安裝程式呼叫post-install script之間。)

(這段怪怪的…有看沒有懂 @@)

arrow
arrow
    全站熱搜

    大爺 發表在 痞客邦 留言(0) 人氣()