- Migrate class.S → Shared\Helpers\Helpers (140+ files), remove 12 unused methods - Migrate class.Html → Shared\Html\Html - Migrate class.Email → Shared\Email\Email - Migrate class.Image → Shared\Image\ImageManipulator - Delete class.Log (unused), class.Mobile_Detect (outdated UA detection) - Remove grid library loading from admin (index.php, ajax.php) - Replace gridEdit usage in 10 admin templates with grid-edit-replacement.php - Fix grid-edit-replacement.php AJAX to send values as JSON (grid.js compat) - Remove mobile layout conditionals (m_html/m_css/m_js) from Site + LayoutsRepository - Remove \Log::save_log() calls from OrderAdminService, ShopOrder, Order Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 \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;
|
|
}
|
|
}
|