2014-02-28 67 views
0
期间运行

我install.php了在installation.I检查everywhere.To确保不被跑,我跑了install.php了代码的其他地方,效果不错。但在安装过程中只install.php了被跳过somehow.My模块名称是Hotelreservation,因此在install.php了的代码如下所示。为什么在安装过程中没有错误显示?install.php了未安装

<?php 

class Hotelreservation_Installer extends Engine_Package_Installer_Module 
{ 
    public function onInstall() 
    { 
    $this->_hotelroomsBrowsePage(); 

    parent::onInstall(); 

    } 

    protected function _hotelroomsBrowsePage() 
    { 
    $db = $this->getDb(); 

    // profile page 
    $page_id = $db->select() 
     ->from('engine4_core_pages', 'page_id') 
     ->where('name = ?', 'hotelreservation_index_browse') 
     ->limit(1) 
     ->query() 
     ->fetchColumn(); 

    if (!$page_id) { 
     // Insert page 
     $db->insert('engine4_core_pages', array(
     'name' => 'hotelreservation_index_browse', 
     'displayname' => 'HotelRooms Browse Page', 
     'title' => 'Browse Rooms', 
     'description' => 'this page displays rooms', 
     'custom' => 0, 
    )); 
     $page_id = $db->lastInsertId(); 

    // Insert main 
     $db->insert('engine4_core_content', array(
     'type' => 'container', 
     'name' => 'main', 
     'page_id' => $page_id, 
    )); 
     $main_id = $db->lastInsertId(); 

     // Insert middle 
     $db->insert('engine4_core_content', array(
     'type' => 'container', 
     'name' => 'middle', 
     'page_id' => $page_id, 
     'parent_content_id' => $main_id, 
     'order' => 2, 
    )); 
     $middle_id = $db->lastInsertId(); 

     // Insert hotelreservation.browse-menu 
     $db->insert('engine4_core_content', array(
     'type' => 'widget', 
     'name' => 'hotelreservation.browse-menu', 
     'page_id' => $page_id, 
     'parent_content_id' => $middle_id, 
     'order' => 1, 
    )); 

     // Insert core content 
     $db->insert('engine4_core_content', array(
     'type' => 'widget', 
     'name' => 'core.content', 
     'page_id' => $page_id, 
     'parent_content_id' => $middle_id, 
     'order' => 2, 
    )); 

     // Insert left 
     $db->insert('engine4_core_content', array(
     'type' => 'container', 
     'name' => 'left', 
     'page_id' => $page_id, 
     'parent_content_id' => $main_id, 
     'order' => 3, 
    )); 
     $left_id = $db->lastInsertId(); 

    } 

    return $this; 
    } 



}// end class 

回答

0

你有没有add info to mainfest file像这样packages array

'callback' => array(
    'path' => 'Your path to php file', 
    'class' => 'Hotelreservation_Installer', 
), 
0

我阿里夫同意。检查//设置里面的文件manifest.php:

(模块专辑的信息)

 

    'callback' => array(
      'path' => 'application/modules/Album/settings/install.php', 
      'class' => 'Album_Installer', 
    ), 

0

我有这个同样的问题,得到它的工作。 事实证明,安装程序看起来应用/封装/模块yourmodule-x.x.x.json第一。围绕线35,你会发现:

"callback": { 
    "path": null, 
    "class": "Engine_Package_Installer_Module", 
    "priority": 100 
}, 

变化,为:

"callback": { 
    "path": "application/modules/Yourmodule/settings/install.php", 
    "class": "Yourmodule_Installer", 
    "priority": 100 
}, 

现在,当您运行安装程序,你install.php了将被调用。