-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #237 from TransbankDevelopers/chore/prepare-releas…
…e-1.9.0 chore: prepare release 1.9.0
- Loading branch information
Showing
10 changed files
with
548 additions
and
362 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Transbank\WooCommerce\WebpayRest\Controllers; | ||
|
||
use Transbank\Plugin\Helpers\PluginLogger; | ||
use Transbank\WooCommerce\WebpayRest\Utils\Template; | ||
use Transbank\WooCommerce\WebpayRest\Helpers\TbkFactory; | ||
|
||
class LogController | ||
{ | ||
|
||
private Template $template; | ||
private PluginLogger $log; | ||
|
||
public function __construct() | ||
{ | ||
$this->template = new Template(); | ||
$this->log = TbkFactory::createLogger(); | ||
} | ||
public function show() | ||
{ | ||
$summary = $this->log->getInfo(); | ||
$logFile = basename($summary['last']); | ||
|
||
if (isset($_GET['log_file'])) { | ||
$isLogFileNameValid = $this->validateLogFileName($_GET['log_file'], $summary['logs']); | ||
|
||
if ($isLogFileNameValid) { | ||
$logFile = $_GET['log_file']; | ||
} | ||
} | ||
|
||
$logDetail = $this->log->getLogDetail($logFile); | ||
$folderHasLogs = $summary['length'] > 0; | ||
|
||
$this->template->render('admin/log.php', [ | ||
'resume' => $summary, | ||
'lastLog' => $logDetail, | ||
'folderHasLogs' => $folderHasLogs | ||
]); | ||
} | ||
|
||
private function validateLogFileName(String $logFileName, array $logFiles): bool | ||
{ | ||
foreach ($logFiles as $logData) { | ||
if (in_array($logFileName, $logData)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
Oops, something went wrong.