- Created `Articles` class for rendering article views including full articles, miniature lists, and news sections. - Added `Banners` class for handling banner displays. - Introduced `Languages` class for rendering language options. - Implemented `Menu` class for rendering page and menu structures. - Developed `Newsletter` class for newsletter rendering. - Created `Scontainers` class for rendering specific containers. - Added `ShopCategory` class for managing shop category views and pagination. - Implemented `ShopClient` class for client-related views including address management and login forms. - Created `ShopPaymentMethod` class for displaying payment methods in the basket. - Added `ShopProduct` class for generating product URLs. - Introduced `ShopSearch` class for rendering a simple search form. - Added `.htaccess` file in the plugins directory to enhance security by restricting access to sensitive files and directories.
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
namespace admin\Controllers;
|
|
|
|
use Domain\Update\UpdateRepository;
|
|
|
|
class UpdateController
|
|
{
|
|
private UpdateRepository $repository;
|
|
|
|
public function __construct( UpdateRepository $repository )
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
public function main_view(): string
|
|
{
|
|
return \Shared\Tpl\Tpl::view( 'update/main-view', [
|
|
'ver' => \Shared\Helpers\Helpers::get_version(),
|
|
'new_ver' => \Shared\Helpers\Helpers::get_new_version(),
|
|
] );
|
|
}
|
|
|
|
public function update(): void
|
|
{
|
|
$result = $this->repository->update();
|
|
|
|
if ( !$result['success'] ) {
|
|
\Shared\Helpers\Helpers::alert( 'W trakcie aktualizacji systemu wystąpił błąd. Proszę spróbować ponownie.' );
|
|
} else {
|
|
\Shared\Helpers\Helpers::set_message( 'Aktualizacja przebiegła pomyślnie.' );
|
|
}
|
|
|
|
header( 'Location: /admin/update/main_view/' );
|
|
exit;
|
|
}
|
|
|
|
public function updateAll(): void
|
|
{
|
|
$result = $this->repository->update();
|
|
|
|
$response = [
|
|
'status' => !empty( $result['success'] ) && empty( $result['no_updates'] ),
|
|
'version' => number_format( (float) \Shared\Helpers\Helpers::get( 'version_current' ) + 0.001, 3, '.', '' ),
|
|
];
|
|
|
|
echo json_encode( $response );
|
|
exit;
|
|
}
|
|
}
|