We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53276
    • 9 Posts
    Доброго дня, коллеги.
    Возникла проблема FileDownLoadR. Вызываю с параметром &plugins. В нем указываю имя сниппета и событие.
    [[!FileDownload? 
    	&getFile=`assets/downloads/file.zip` 
    	&plugins=`
    		{
            "name":"redirect"
            ,"event":"BeforeFileDownload"
    		}
        `
    	]]
    

    Код сниппета redirect
    <?php
    $url = $modx->makeUrl(3);
    $modx->sendRedirect($url);
    


    В логах Modx обнаружил ошибки.
    [] (ERROR @ /path../core/components/filedownloadr/model/filedownloadr/filedownloadplugin.class.php : 53) PHP warning: include(plugins/filedownloadplugin.events.php): failed to open stream: No such file or directory
    [] (ERROR @ /path../core/components/filedownloadr/model/filedownloadr/filedownloadplugin.class.php : 53) PHP warning: include(): Failed opening 'plugins/filedownloadplugin.events.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php')


    Стал копать дальше и вот что понял. В файле filedownloadr/model/filedownloadplugin.class.php есть такой код
    public function preparePlugins() {
            $this->_allEvents = include $this->configs['basePath'] . 'plugins/filedownloadplugin.events.php';
            $jPlugins = json_decode($this->configs['plugins'], 1);
            if (empty($jPlugins))
                return;
    
            foreach ($jPlugins as $v) {
                $this->_appliedEvents[$v['event']][] = $v;
            }
            foreach ($this->_allEvents as $i => $event) {
                if (isset($this->_appliedEvents[$i]))
                    $this->_allEvents[$i] = $this->_appliedEvents[$i];
            }
        }
    

    Так вот, в переменных $this->configs['basePath'] и $this->configs['plugins'] пусто. Видимо поэтому и не работает параметр. Помогите разобраться что не так и куда копать дальше.