<![CDATA[ FileDownload R plugin не работает - My Forums]]> https://forums.modx.com/thread/?thread=101822 <![CDATA[FileDownload R plugin не работает]]> https://forums.modx.com/thread/101822/filedownload-r-plugin#dis-post-549137 Возникла проблема 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'] пусто. Видимо поэтому и не работает параметр. Помогите разобраться что не так и куда копать дальше.]]>
sashape89 Mar 03, 2017, 08:40 AM https://forums.modx.com/thread/101822/filedownload-r-plugin#dis-post-549137