src/Core.php
public function reload(\Erebot\Interfaces\Config\Main $config = null)
    {
        $logger = \Plop\Plop::getInstance();

        $msg = $this->gettext('Reloading the configuration');
        $logger->info($msg);

        if (!count($this->connections)) {
            $logger->info($this->gettext('No active connections... Aborting.'));
            return;
        }

        if ($config === null) {
            $configFile = $this->mainCfg->getConfigFile();
            if ($configFile === null) {
                $msg = $this->gettext('No configuration file to reload');
                $logger->info($msg);
                return;
            }

            /// @TODO: dependency injection
            $config = new \Erebot\Config\Main(
                $configFile,
                \Erebot\Interfaces\Config\Main::LOAD_FROM_FILE
            );
        }

        $connectionCls = get_class($this->connections[0]);
        $this->createConnections($connectionCls, $config);
        $msg = $this->gettext('Successfully reloaded the configuration');
        $logger->info($msg);
    }
public function reload(\Erebot\Interfaces\Config\Main $config = null)
    {
        $logger = \Plop\Plop::getInstance();

        $msg = $this->gettext('Reloading the configuration');
        $logger->info($msg);

        if (!count($this->connections)) {
            $logger->info($this->gettext('No active connections... Aborting.'));
            return;
        }

        if ($config === null) {
            $configFile = $this->mainCfg->getConfigFile();
            if ($configFile === null) {
                $msg = $this->gettext('No configuration file to reload');
                $logger->info($msg);
                return;
            }

            /// @TODO: dependency injection
            $config = new \Erebot\Config\Main(
                $configFile,
                \Erebot\Interfaces\Config\Main::LOAD_FROM_FILE
            );
        }

        $connectionCls = get_class($this->connections[0]);
        $this->createConnections($connectionCls, $config);
        $msg = $this->gettext('Successfully reloaded the configuration');
        $logger->info($msg);
    }
public function reload ( \ Erebot \ Interfaces \ Config \ Main $ config = null ) { $ logger = \ Plop \ Plop :: getInstance ( ) ; $ msg = $ this -> gettext ( 'Reloading the configuration' ) ; $ logger -> info ( $ msg ) ; if ( ! count ( $ this -> connections ) ) { $ logger -> info ( $ this -> gettext ( 'No active connections... Aborting.' ) ) ; return ; } if ( $ config === null ) { $ configFile = $ this -> mainCfg -> getConfigFile ( ) ; if ( $ configFile === null ) { $ msg = $ this -> gettext ( 'No configuration file to reload' ) ; $ logger -> info ( $ msg ) ; return ; } /// @TODO: dependency injection $ config = new \ Erebot \ Config \ Main ( $ configFile , \ Erebot \ Interfaces \ Config \ Main :: LOAD_FROM_FILE ) ; } $ connectionCls = get_class ( $ this -> connections [ 0 ] ) ; $ this -> createConnections ( $ connectionCls , $ config ) ; $ msg = $ this -> gettext ( 'Successfully reloaded the configuration' ) ; $ logger -> info ( $ msg ) ; }
Reload this instance of the bot.

This method makes the bot reload most of the data
it currently relies on, such as configuration files.

\param Erebot::Interfaces::Config::MainInterface $config
(optional) The new configuration to use.
If omitted, the configuration file currently in use
is reloaded.
Reload this instance of the bot .