- Created Articles.php for rendering article views including full articles, miniature lists, and news sections. - Added Banners.php for handling banner displays. - Introduced Languages.php for rendering language options. - Implemented Menu.php for dynamic menu rendering. - Developed Newsletter.php for newsletter view rendering. - Created Scontainers.php for rendering specific containers. - Added ShopCategory.php for category descriptions and product listings. - Introduced ShopClient.php for managing client-related views such as address editing and order history. - Implemented ShopPaymentMethod.php for displaying payment methods in the basket. - Created ShopProduct.php for generating product URLs. - Added ShopSearch.php for rendering a simple search form. - Added .htaccess file 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;
|
|
}
|
|
}
|