我的包中有以下代码来处理安装:
public function install() {
$pkg = parent::install();
isset($pkg) or die('test to check pkg not null failed');
$this->setup($pkg);
//$this->insertDefaultData();
}
private function setup($pkg) {
$this->setupBlock('my_custom_block', $pkg);
//install anything else
}
private function setupBlock($handle, $pkg) {
$bt = BlockType::getByHandle($handle);
if (!is_object($bt)) {
BlockType::installBlockTypeFromPackage($handle, $pkg);
}
}
安装始终失败并显示以下消息,我看不出原因
Warning: require_once(C:\Users\Me\NetbeansProjects\website\updates\concrete5.6.3.1_updater\concrete/blocks/my_custom_block/controller.php): failed to open stream: No such file or directory in C:\Users\Me\NetbeansProjects\website\updates\concrete5.6.3.1_updater\concrete\core\libraries\loader.php on line 217
Fatal error: require_once(): Failed opening required 'C:\Users\Me\NetbeansProjects\website\updates\concrete5.6.3.1_updater\concrete/blocks/my_custom_block/controller.php' (include_path='C:/Users/Me/NetbeansProjects/website/libraries/3rdparty;C:\Users\Me\NetbeansProjects\website\updates\concrete5.6.3.1_updater\concrete/libraries/3rdparty;.;C:\xampp\php\PEAR') in C:\Users\Me\NetbeansProjects\website\updates\concrete5.6.3.1_updater\concrete\core\libraries\loader.php on line 217
我清除了缓存以防万一我在处理包时遇到任何缓存,然后再添加块(我先在仪表板上创建了一个页面)
文件my_custom_package/blocks/my_custom_block/controller.php
确实存在且die('test to check pkg not null failed')
未触发。知道为什么会这样吗?
答案 0 :(得分:1)
如果您正确扩展了BlockController,请检查您的blocks controller.php。当我有BlockNameController而不是BlockNameBlockController时,我得到了同样的错误。