RemoteBridge 0.0.1 Undefined class constant 'onBeforeInstallPlugin'

  • Hi!


    I'm trying to install RemoteBridge from GIT to i-MSCP (git or RC version).


    On both I'm getting this error


    Fatal error: Undefined class constant 'onBeforeInstallPlugin' in /var/www/imscp/gui/plugins/RemoteBridge/RemoteBridge.php on line 48



    Checking that file I found that on this function, the onBeforeInstallPlugin is not defined anywhere.


    Code
    1. public function register(iMSCP_Events_Manager_Interface $eventsManager) { $eventsManager->registerListener( array( iMSCP_Events::onBeforeInstallPlugin, iMSCP_Events::onResellerScriptStart, iMSCP_Events::onAfterDeleteUser ), $this ); }


    The function only does simple version validation:


    Code
    1. public function onBeforeInstallPlugin($event) { if ($event->getParam('pluginName') == $this->getName()) { if (version_compare($event->getParam('pluginManager')->getPluginApiVersion(), '0.2.0', '<')) { set_page_message( tr('Your i-MSCP version is not compatible with this plugin. Try with a newer version.'), 'error' ); $event->stopPropagation(); } } }


    So removing it let me install and activate the plugin.


    Afte doing that, I can see the RemoteBridge link on the reseller page, but the files that should be in reseller and in public folders are missing.


    I don't know if I'm making something wrong or the plugin is not ready enough to be installed.


    Is there any additional help on this issue?


    Thank you!
    [hr]
    Ok, this is what I just made. I added this line to


    Code
    1. require_once 'imscp-lib.php';


    RemoteBridge/RemoteBridge.php
    RemoteBridge/fontend/remotebridge.php
    RemoteBridge/public/remotebridge.php


    Then, commented this line on the first file



    Then, I installed the plugin.


    After that, I copied the RemoteBridge/fontend/remotebridge.php to the public/reseller folder, and RemoteBridge/public/remotebridge.php to the public folder.


    After that I was able to create my secret $bridgeKey, and created a new account.


    So I think there is a problem in the activation of the plugin, because that files should be copied, or at least I suppose that.

    Edited once, last by medisoft ().

  • Hello ;


    All our plugin were updated according the plugin API version 0.2.0, which is not yet integrated in Git Master. The onBeforeInstallPlugin event is not triggered in current i-MSCP versions, nor in current Git Master because this event is part of the plugin API version 0.2.0.


    Anyway, you should never copy any plugin file into the public/* directory (here public/reseller). The problem was simply due to a bug in the plugin (missing return statement) which will be fixed:


    [code=php]
    /**
    * Get routes
    *
    * @return array
    */
    public function getRoutes()
    {
    $pluginDir = PLUGINS_PATH . '/' . $this->getName();


    $this->routes = array(
    '/reseller/remotebridge.php' => $pluginDir . '/frontend/remotebridge.php',
    '/remotebridge.php' => $pluginDir . '/public/remotebridge.php'
    );
    }
    [/php]


    that should be:


    [code=php]
    /**
    * Get routes
    *
    * @return array
    */
    public function getRoutes()
    {
    $pluginDir = PLUGINS_PATH . '/' . $this->getName();


    return array(
    '/reseller/remotebridge.php' => $pluginDir . '/frontend/remotebridge.php',
    '/remotebridge.php' => $pluginDir . '/public/remotebridge.php'
    );
    }
    [/php]


    And therefore, the inclusion of the core library imscp-lib.php in the files become also useless because the plugin file are included by the plugin bootstrap file, which already include the core library.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

    Edited once, last by Nuxwin ().