-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0626f6
commit dba9c17
Showing
47 changed files
with
605 additions
and
1,133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,40 @@ | ||
<?php | ||
/* | ||
* Copyright © Ghost Unicorns snc. All rights reserved. | ||
* See LICENSE for license details. | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GhostUnicorns\WebapiLogs\Console\Command; | ||
namespace Opengento\WebapiLogger\Console\Command; | ||
|
||
use GhostUnicorns\WebapiLogs\Model\Clean; | ||
use Magento\Framework\Console\Cli; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Opengento\WebapiLogger\Model\Clean; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class CleanCommand extends Command | ||
{ | ||
/** | ||
* @var Clean | ||
*/ | ||
private $clean; | ||
|
||
/** | ||
* @param Clean $clean | ||
* @param string $name | ||
*/ | ||
public function __construct( | ||
Clean $clean, | ||
string $name = 'webapilogs:clean' | ||
) { | ||
$this->clean = $clean; | ||
parent::__construct($name); | ||
public function __construct(private Clean $clean) | ||
{ | ||
parent::__construct('webapilogs:clean'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function configure() | ||
protected function configure(): void | ||
{ | ||
$this->setDescription('WebapiLogs Cleaner'); | ||
$this->setDescription('WebapiLogger Cleaner'); | ||
parent::configure(); | ||
} | ||
|
||
/** | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* @throws \Exception | ||
* @throws LocalizedException | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$this->clean->execute(); | ||
$this->clean->clean(); | ||
|
||
return Cli::RETURN_SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,39 @@ | ||
<?php | ||
/* | ||
* Copyright © Ghost Unicorns snc. All rights reserved. | ||
* See LICENSE for license details. | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports; | ||
namespace Opengento\WebapiLogger\Controller\Adminhtml\Reports; | ||
|
||
use Exception; | ||
use GhostUnicorns\WebapiLogs\Model\Log\Logger; | ||
use GhostUnicorns\WebapiLogs\Model\Clean; | ||
use Magento\Framework\Controller\Result\Redirect; | ||
use Opengento\WebapiLogger\Model\Clean; | ||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; | ||
use Magento\Framework\View\Result\PageFactory; | ||
use Magento\Framework\App\Action\HttpGetActionInterface; | ||
|
||
class Delete extends Action implements HttpGetActionInterface | ||
{ | ||
/** | ||
* Authorization level of a basic admin session | ||
*/ | ||
const ADMIN_RESOURCE = 'GhostUnicorns_WebapiLogs::reports_webapilogs'; | ||
public const ADMIN_RESOURCE = 'Opengento_WebapiLogger::reports_webapilogs'; | ||
|
||
/** | ||
* @var PageFactory | ||
*/ | ||
protected $resultPageFactory; | ||
|
||
/** | ||
* @var Clean | ||
*/ | ||
private $clean; | ||
|
||
/** | ||
* @var Logger | ||
*/ | ||
private $logger; | ||
|
||
/** | ||
* @param Context $context | ||
* @param PageFactory $resultPageFactory | ||
* @param LogCollectionFactory $logCollectionFactory | ||
* @param Logger $logger | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
PageFactory $resultPageFactory, | ||
Clean $clean, | ||
Logger $logger | ||
private Clean $clean | ||
) { | ||
parent::__construct($context); | ||
$this->resultPageFactory = $resultPageFactory; | ||
$this->clean = $clean; | ||
$this->logger = $logger; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function execute() | ||
public function execute(): Redirect | ||
{ | ||
try { | ||
$this->clean->cleanAll(); | ||
} catch (Exception $exception) { | ||
$this->logger->error(__('Cant delete webapi log because of error: %1', $exception->getMessage())); | ||
} catch (Exception $e) { | ||
$this->messageManager->addExceptionMessage($e); | ||
} | ||
|
||
$resultRedirect = $this->resultRedirectFactory->create(); | ||
return $resultRedirect->setPath('*/*/index', ['_current' => true]); | ||
return $this->resultRedirectFactory->create()->setPath('*/*/index', ['_current' => true]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,36 @@ | ||
<?php | ||
/* | ||
* Copyright © Ghost Unicorns snc. All rights reserved. | ||
* See LICENSE for license details. | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports; | ||
namespace Opengento\WebapiLogger\Controller\Adminhtml\Reports; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use Magento\Framework\App\Action\HttpGetActionInterface; | ||
use Magento\Framework\View\Result\Page; | ||
use Magento\Framework\View\Result\PageFactory; | ||
|
||
class Detail extends Action implements HttpGetActionInterface | ||
{ | ||
/** | ||
* Authorization level of a basic admin session | ||
*/ | ||
const ADMIN_RESOURCE = 'GhostUnicorns_WebapiLogs::reports_webapilogs'; | ||
public const ADMIN_RESOURCE = 'Opengento_WebapiLogger::reports_webapilogs'; | ||
|
||
/** | ||
* @var bool|PageFactory | ||
*/ | ||
protected $resultPageFactory = false; | ||
|
||
/** | ||
* @param Context $context | ||
* @param PageFactory $resultPageFactory | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
PageFactory $resultPageFactory | ||
private PageFactory $resultPageFactory | ||
) { | ||
parent::__construct($context); | ||
$this->resultPageFactory = $resultPageFactory; | ||
} | ||
|
||
/** | ||
* @return Page|ResultInterface | ||
*/ | ||
public function execute() | ||
public function execute(): Page | ||
{ | ||
$resultPage = $this->resultPageFactory->create(); | ||
$resultPage->setActiveMenu('GhostUnicorns_WebapiLogs::reports'); | ||
$resultPage->setActiveMenu('Opengento_WebapiLogger::reports'); | ||
$resultPage->getConfig()->getTitle()->prepend(__('Webapi REST api logs')); | ||
|
||
return $resultPage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,36 @@ | ||
<?php | ||
/* | ||
* Copyright © Ghost Unicorns snc. All rights reserved. | ||
* See LICENSE for license details. | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GhostUnicorns\WebapiLogs\Controller\Adminhtml\Reports; | ||
namespace Opengento\WebapiLogger\Controller\Adminhtml\Reports; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use Magento\Framework\App\Action\HttpGetActionInterface; | ||
use Magento\Framework\View\Result\Page; | ||
use Magento\Framework\View\Result\PageFactory; | ||
|
||
class Index extends Action implements HttpGetActionInterface | ||
{ | ||
/** | ||
* Authorization level of a basic admin session | ||
*/ | ||
const ADMIN_RESOURCE = 'GhostUnicorns_WebapiLogs::reports_webapilogs'; | ||
public const ADMIN_RESOURCE = 'Opengento_WebapiLogger::reports_webapilogs'; | ||
|
||
/** | ||
* @var bool|PageFactory | ||
*/ | ||
protected $resultPageFactory = false; | ||
|
||
/** | ||
* @param Context $context | ||
* @param PageFactory $resultPageFactory | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
PageFactory $resultPageFactory | ||
private PageFactory $resultPageFactory | ||
) { | ||
parent::__construct($context); | ||
$this->resultPageFactory = $resultPageFactory; | ||
} | ||
|
||
/** | ||
* @return Page|ResultInterface | ||
*/ | ||
public function execute() | ||
public function execute(): Page | ||
{ | ||
$resultPage = $this->resultPageFactory->create(); | ||
$resultPage->setActiveMenu('GhostUnicorns_WebapiLogs::reports'); | ||
$resultPage->setActiveMenu('Opengento_WebapiLogger::reports'); | ||
$resultPage->getConfig()->getTitle()->prepend(__('Webapi REST api logs')); | ||
|
||
return $resultPage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,25 @@ | ||
<?php | ||
/* | ||
* Copyright © Ghost Unicorns snc. All rights reserved. | ||
* See LICENSE for license details. | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GhostUnicorns\WebapiLogs\Cron; | ||
namespace Opengento\WebapiLogger\Cron; | ||
|
||
use Exception; | ||
use GhostUnicorns\WebapiLogs\Model\Clean; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Opengento\WebapiLogger\Model\Clean; | ||
|
||
class CleanCron | ||
{ | ||
/** | ||
* @var Clean | ||
*/ | ||
private $clean; | ||
|
||
/** | ||
* @param Clean $clean | ||
*/ | ||
public function __construct( | ||
Clean $clean | ||
) { | ||
$this->clean = $clean; | ||
} | ||
public function __construct(private Clean $clean) {} | ||
|
||
/** | ||
* @throws Exception | ||
* @throws LocalizedException | ||
*/ | ||
public function execute() | ||
public function execute(): void | ||
{ | ||
$this->clean->execute(); | ||
$this->clean->clean(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.