Search code examples
phpconcrete5

Why does my installer fail on Concrete5 custom package


I have the following code in my package to handle install:

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); 
    }
}

The installation always fails with the following message and I can't see why

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

I cleared my cache in case anything got cached when I was working on the package before I added the block to it (I created a single page on the dashboard first)

The file my_custom_package/blocks/my_custom_block/controller.php does exist and die('test to check pkg not null failed') isnt triggered. Any idea why this is happening?


Solution

  • Check your blocks controller.php if you have correctly extended BlockController. I get the same error when I had BlockNameController instead of BlockNameBlockController.