来源:http://trac.seagullproject.org/wiki/Howto/Upgrading/04

将Seagull从0.3.x版本更新到0.4.x

在0.4版本中做了很多修改,所有如果你想转移现存模块到新的CVS版本,请注意下列这些变化。另外请阅读一下CHANGELOG.txt文件。

重命名的基类

类Base::变成类SGL::

例:

SGL::logMessage(null, PEAR_LOG_DEBUG);

改变的基本方法

Base::logMessage(CLASS . '::' . FUNCTION , null, null, PEAR_LOG_DEBUG);

现在变成

SGL::logMessage(null, PEAR_LOG_DEBUG);

新的行为管理

是,这出现了一些问题,也花费了一引起时间来找出原因。

感谢IRC上所有帮助我的人。

  • 重命名aAllowedActions数组为aActionsMapping
  • 用新的标准重写$this→_aActionsMapping数组
        $this->_aActionsMapping =  array(
            'insert' => array('insert','redirectToDefault'),
            'update' => array('update','redirectToDefault'),
            'list'   => array('list'),
            'send'   => array('send','redirectToDefault'),
        );

重点:将validate($req, $input)函数改成validate($req, &$input)(你看到&符号了吗?)

改变了validate()的参数

在你的模块内validate()函数定义被改成:

  function validate($req, &$input)
  {
      ...
  }

注意参数$input前的&符号

调用DB的方法变了

在0.3.xx版本中,DB连接是通过下列代码获取的:

$dbh = &Base::DB();

现在,在 0.4.xx 版本中是这样:

$dbh = &SGL_DB::singleton();

Changing into www/*.php pages

最后一行通常是:

$process->go(new SGL_HTTP_Request());

现在是:

$process→go();

将generateSelect转移到模板

所有对generateSelect的调用都转移到模板

在你的管理类中,将

$output->aLanguages = SGL_Output::generateSelect($array)

改变成

output->aLanguages = $array

将下列调用放到对应的模板中。

<select name="frmArticleLangs[]" multiple="multiple">
    {generateSelect(aLanguages):h}
</select>

一些方法移到 /lib/SGL/Manager.php 文件中

你可以删除process()和display()方法如果你没有修改它们。它们现在在父类中。

其它移动的方法…

23-01-05 创建了SGL_String类并将适当的方法移到类中 23-01-05 将所有generateSelect()调用移动到模板中 21-01-05 重命名会话DB methods more conventionally 21-01-05 移动URL相关方法到新类SGL_Url中 21-01-05 移动SGL::getPagedData()到SGL_DB::getPagedData()

将SGL_Output::msgSet()移动到SGL::raiseMsg()

SGL_Item 变化

Moved !ArticleViewMgr::getArticleDetail() to SGL_Item::getItemDetail() Moved !ArticleViewMgr::getArticleListByCatID to SGL_Item::getArticleListByCatID Moved !ArticleViewMgr::getDocumentListByCatID to SGL_Item::getDocumentListByCatID Moved !ArticleViewMgr::retrievePaginated to !SGL_Item::retrievePaginated

添加了$input->masterTemplate并删掉$input->rightCol

Be sure to add $input→masterTemplate = $this→masterTemplate; and remove $input→rightCol in your validate method

 
howto/upgrading/04.txt · 最后更改: 2010/05/30 00:21 (外部编辑)
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2