Updates page fixes..

This commit is contained in:
Cüneyt Şentürk
2019-11-20 13:35:43 +03:00
parent d0dadd3160
commit bba0e50588
8 changed files with 229 additions and 119 deletions

View File

@@ -104,43 +104,46 @@ class Updates extends Controller
*/
public function steps(Request $request)
{
$json = [];
$json['step'] = [];
$steps = [];
$name = $request['name'];
$version = $request['version'];
// Download
$json['step'][] = [
$steps[] = [
'text' => trans('modules.installation.download', ['module' => $name]),
'url' => url('install/updates/download')
];
// Unzip
$json['step'][] = [
$steps[] = [
'text' => trans('modules.installation.unzip', ['module' => $name]),
'url' => url('install/updates/unzip')
];
// File Copy
$json['step'][] = [
$steps[] = [
'text' => trans('modules.installation.file_copy', ['module' => $name]),
'url' => url('install/updates/file-copy')
];
// Finish installation
$json['step'][] = [
$steps[] = [
'text' => trans('modules.installation.finish', ['module' => $name]),
'url' => url('install/updates/finish')
];
// Redirect
$json['step'][] = [
$steps[] = [
'text' => trans('modules.installation.redirect', ['module' => $name]),
'url' => url('install/updates/redirect')
];
return response()->json($json);
return response()->json([
'success' => true,
'error' => false,
'data' => $steps,
'message' => null
]);
}
/**

View File

@@ -43,7 +43,8 @@ class Updater
if ($response instanceof RequestException) {
return [
'success' => false,
'errors' => trans('modules.errors.download', ['module' => $name]),
'error' => true,
'message' => trans('modules.errors.download', ['module' => $alias]),
'data' => [
'path' => $path
]
@@ -69,7 +70,8 @@ class Updater
if (!$uploaded) {
return [
'success' => false,
'errors' => trans('modules.errors.zip', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.zip', ['module' => $alias]),
'data' => [
'path' => $path
]
@@ -81,7 +83,8 @@ class Updater
return [
'success' => true,
'errors' => false,
'error' => false,
'message' => null,
'data' => [
'path' => $path
]
@@ -89,7 +92,8 @@ class Updater
} catch (\Exception $e) {
return [
'success' => false,
'errors' => trans('modules.errors.download', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.download', ['module' => $alias]),
'data' => []
];
}
@@ -97,7 +101,8 @@ class Updater
return [
'success' => false,
'errors' => trans('modules.errors.download', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.download', ['module' => $alias]),
'data' => [
'path' => $path
]
@@ -116,7 +121,8 @@ class Updater
if (($zip->open($file) !== true) || !$zip->extractTo($temp_path)) {
return [
'success' => false,
'errors' => trans('modules.errors.unzip', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.unzip', ['module' => $alias]),
'data' => [
'path' => $path
]
@@ -133,7 +139,8 @@ class Updater
return [
'success' => true,
'errors' => false,
'error' => false,
'message' => null,
'data' => [
'path' => $path
]
@@ -141,7 +148,8 @@ class Updater
} catch (\Exception $e) {
return [
'success' => false,
'errors' => trans('modules.errors.unzip', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.unzip', ['module' => $alias]),
'data' => []
];
}
@@ -156,7 +164,8 @@ class Updater
if (!File::copyDirectory($temp_path, base_path())) {
return [
'success' => false,
'errors' => trans('modules.errors.file_copy', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.file_copy', ['module' => $alias]),
'data' => [
'path' => $path
]
@@ -177,7 +186,8 @@ class Updater
if (!File::copyDirectory($temp_path, $module_path)) {
return [
'success' => false,
'errors' => trans('modules.errors.file_copy', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.file_copy', ['module' => $alias]),
'data' => [
'path' => $path
]
@@ -208,7 +218,8 @@ class Updater
return [
'success' => true,
'errors' => false,
'error' => false,
'message' => null,
'data' => [
'path' => $path
]
@@ -216,7 +227,8 @@ class Updater
} catch (\Exception $e) {
return [
'success' => false,
'errors' => trans('modules.errors.file_copy', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.file_copy', ['module' => $alias]),
'data' => []
];
}
@@ -228,7 +240,8 @@ class Updater
if (($alias == 'core') && (version('short') != $version)) {
return [
'success' => false,
'errors' => trans('modules.errors.file_copy', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.file_copy', ['module' => $alias]),
'data' => []
];
}
@@ -241,13 +254,15 @@ class Updater
return [
'success' => true,
'errors' => false,
'error' => false,
'message' => null,
'data' => []
];
} catch (\Exception $e) {
return [
'success' => false,
'errors' => trans('modules.errors.finish', ['module' => $alias]),
'error' => true,
'message' => trans('modules.errors.finish', ['module' => $alias]),
'data' => []
];
}

View File

@@ -43,7 +43,7 @@ class Versions
continue;
}
$output .= '<h2><span class="label label-success">'.$release->tag_name.'</span></h2>';
$output .= '<h2><span class="badge badge-pill badge-success">' . $release->tag_name . '</span></h2>';
$output .= $parsedown->text($release->body);