1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* MagePrince |
4
|
|
|
* |
5
|
|
|
* NOTICE OF LICENSE |
6
|
|
|
* |
7
|
|
|
* This source file is subject to the mageprince.com license that is |
8
|
|
|
* available through the world-wide-web at this URL: |
9
|
|
|
* https://mageprince.com/end-user-license-agreement |
10
|
|
|
* |
11
|
|
|
* DISCLAIMER |
12
|
|
|
* |
13
|
|
|
* Do not edit or add to this file if you wish to upgrade this extension to newer |
14
|
|
|
* version in the future. |
15
|
|
|
* |
16
|
|
|
* @category MagePrince |
17
|
|
|
* @package Mageprince_Faq |
18
|
|
|
* @copyright Copyright (c) MagePrince (https://mageprince.com/) |
19
|
|
|
* @license https://mageprince.com/end-user-license-agreement |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Mageprince\Faq\Controller\Adminhtml\FaqGroup; |
23
|
|
|
|
24
|
|
|
use Magento\Backend\App\Action; |
|
|
|
|
25
|
|
|
use Magento\Framework\Controller\ResultFactory; |
|
|
|
|
26
|
|
|
use Magento\Framework\Controller\ResultInterface; |
|
|
|
|
27
|
|
|
use Mageprince\Faq\Model\ImageUploader; |
28
|
|
|
|
29
|
|
|
class Upload extends FaqGroup |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var ImageUploader |
33
|
|
|
*/ |
34
|
|
|
public $imageUploader; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Upload constructor. |
38
|
|
|
* |
39
|
|
|
* @param Action\Context $context |
40
|
|
|
* @param ImageUploader $imageUploader |
41
|
|
|
*/ |
42
|
|
|
public function __construct( |
43
|
|
|
Action\Context $context, |
|
|
|
|
44
|
|
|
ImageUploader $imageUploader |
45
|
|
|
) { |
46
|
|
|
parent::__construct($context); |
47
|
|
|
$this->imageUploader = $imageUploader; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Upload file controller action |
52
|
|
|
* |
53
|
|
|
* @return ResultInterface |
54
|
|
|
*/ |
55
|
|
|
public function execute() |
56
|
|
|
{ |
57
|
|
|
try { |
58
|
|
|
$result = $this->imageUploader->saveFileToTmpDir('icon'); |
59
|
|
|
|
60
|
|
|
$result['cookie'] = [ |
61
|
|
|
'name' => $this->_getSession()->getName(), |
62
|
|
|
'value' => $this->_getSession()->getSessionId(), |
63
|
|
|
'lifetime' => $this->_getSession()->getCookieLifetime(), |
64
|
|
|
'path' => $this->_getSession()->getCookiePath(), |
65
|
|
|
'domain' => $this->_getSession()->getCookieDomain(), |
66
|
|
|
]; |
67
|
|
|
} catch (\Exception $e) { |
68
|
|
|
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()]; |
69
|
|
|
} |
70
|
|
|
return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths