安装期间未运行install.php

时间:2014-02-28 19:12:13

标签: socialengine

我的install.php在安装过程中没有运行。我检查过各处。可以肯定的是,我在其他地方运行install.php中的代码并且运行良好。但是在安装过程中只会以某种方式跳过install.php。我的模块名称是Hotelreservation,因此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

3 个答案:

答案 0 :(得分:0)

add info to mainfest file

中的 packages array 是这样的吗?
'callback' => array(
  'path' => 'Your path to php file',
  'class' => 'Hotelreservation_Installer',
),

答案 1 :(得分:0)

我同意Arif。检查// settings:

中的文件manifest.php

(模块专辑信息)


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

答案 2 :(得分:0)

我遇到了同样的问题,并让它发挥作用。 事实证明,安装程序首先在application / packages / module-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。