Skip to content

Commit 4b85e9d

Browse files
authored
Merge pull request #261 from PowerSync/develop
Develop
2 parents fbd0897 + fbfe379 commit 4b85e9d

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed
Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,54 @@
11
<?php
22
namespace TNW\Salesforce\Controller\Adminhtml\System\Log;
33

4+
use Exception;
5+
use InvalidArgumentException;
6+
use Magento\Backend\App\Action;
7+
use Magento\Backend\App\Action\Context;
48
use Magento\Framework\App\Filesystem\DirectoryList;
9+
use Magento\Framework\App\Response\Http\FileFactory;
10+
use Magento\Framework\App\ResponseInterface;
11+
use Magento\Framework\Controller\ResultInterface;
12+
use Magento\Framework\Exception\NotFoundException;
13+
use TNW\Salesforce\Model\Config;
514

6-
class Download extends \Magento\Backend\App\Action
15+
class Download extends Action
716
{
817
/**
9-
* @var \Magento\Framework\App\Response\Http\FileFactory
18+
* @var FileFactory
1019
*/
1120
protected $fileFactory;
1221

22+
/** @var Config */
23+
protected $salesforceConfig;
24+
1325
public function __construct(
14-
\Magento\Backend\App\Action\Context $context,
15-
\Magento\Framework\App\Response\Http\FileFactory $fileFactory
26+
Context $context,
27+
FileFactory $fileFactory,
28+
Config $salesforceConfig
1629
) {
1730
$this->fileFactory = $fileFactory;
31+
$this->salesforceConfig = $salesforceConfig;
1832
parent::__construct($context);
1933
}
2034

2135
/**
2236
* Dispatch request
2337
*
24-
* @return \Magento\Framework\Controller\ResultInterface|\Magento\Framework\App\ResponseInterface
25-
* @throws \Magento\Framework\Exception\NotFoundException
26-
* @throws \InvalidArgumentException
27-
* @throws \Exception
38+
* @return ResultInterface|ResponseInterface
39+
* @throws NotFoundException
40+
* @throws InvalidArgumentException
41+
* @throws Exception
2842
*/
2943
public function execute()
3044
{
45+
$baseDay = $this->salesforceConfig->logBaseDay();
46+
47+
$filenamePath = sprintf('log/sforce/%d_%d_%d.log', date('Y'), $baseDay, floor((date('z') + 1) / $baseDay));
48+
3149
return $this->fileFactory->create('sforce.log', [
3250
'type' => 'filename',
33-
'value' => 'log/sforce.log'
51+
'value' => $filenamePath
3452
], DirectoryList::VAR_DIR);
3553
}
36-
}
54+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"gpl-3.0"
1111
],
1212
"type": "magento2-module",
13-
"version": "2.6.38",
13+
"version": "2.6.39",
1414
"autoload": {
1515
"files": [
1616
"registration.php"

0 commit comments

Comments
 (0)