2022-05-24 15:30:22 +02:00
@ extends ( 'layouts.updater' )
@ Push ( 'updater-body' )
2022-05-26 11:10:05 +02:00
< div class = " container " >
2022-05-25 16:19:20 +02:00
< ? php // Requests newest version from server and sets it as variable
2023-04-27 19:45:12 +02:00
$Vgit = external_file_get_contents ( " https://version.linkstack.org/ " );
2022-05-25 16:19:20 +02:00
// Requests current version from the local version file and sets it as variable
2022-06-01 21:06:47 +02:00
$Vlocal = file_get_contents ( base_path ( " version.json " ));
2022-05-25 16:19:20 +02:00
?>
2022-05-28 14:03:49 +02:00
@ if ( auth () -> user () -> role == 'admin' and $Vgit > $Vlocal or env ( 'JOIN_BETA' ) === true )
2022-05-25 16:19:20 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === '' )
< ? php //landing page ?>
2022-05-26 11:10:05 +02:00
2022-05-24 15:30:22 +02:00
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo.svg') }} " alt = " Logo " >
2022-05-24 15:30:22 +02:00
</ div >
2023-06-19 13:20:00 +02:00
< h1 > {{ __ ( 'messages.Updater' )}} </ h1 >
2022-05-26 11:16:46 +02:00
@ if ( strtoupper ( substr ( PHP_OS , 0 , 3 )) === 'WIN' )
2022-07-12 15:16:37 +02:00
@ if ( env ( 'JOIN_BETA' ) === true )
2023-06-19 13:18:19 +02:00
< p >< ? php echo __ ( 'messages.Latest beta version' ) . " = " . external_file_get_contents ( " https://beta.linkstack.org/vbeta.json " ); ?> </p>
2023-06-15 19:44:43 +02:00
< p >< ? php if ( file_exists ( base_path ( " vbeta.json " ))) { echo __ ( 'messages.Installed beta version' ) . " = " . file_get_contents ( base_path ( " vbeta.json " ));} else { echo __ ( 'messages.Installed beta version' ) . " = " . __ ( 'messages.none' );} ?> </p>
< p >< ? php if ( $Vgit > $Vlocal ) { echo __ ( 'messages.You need to update to the latest mainline release' );} else { echo __ ( " messages.You’ re running the latest mainline release " );} ?> </p>
2022-07-12 15:16:37 +02:00
@ else
2023-06-15 19:44:43 +02:00
< h4 > {{ __ ( 'messages.update.manually' )}} </ h4 >
< h5 > {{ __ ( 'messages.update.windows' )}} </ h5 >
2022-07-12 15:16:37 +02:00
@ endif
< br >< div class = " row " >
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url()->current()}}/?updating-windows " >< button >< i class = " fa-solid fa-user-gear btn " ></ i > {{ __ ( 'messages.Update automatically' )}} </ button ></ a >& ensp ;
& ensp ; < a class = " btn " href = " https://linkstack.org/update " target = " _blank " >< button >< i class = " fa-solid fa-download btn " ></ i > {{ __ ( 'messages.Update manually' )}} </ button ></ a >& ensp ;
2022-07-12 15:16:37 +02:00
</ div >
2022-05-26 11:16:46 +02:00
@ else
2022-05-28 14:03:49 +02:00
@ if ( env ( 'JOIN_BETA' ) === true )
2023-06-19 13:18:19 +02:00
< p >< ? php echo __ ( 'messages.Latest beta version' ) . " = " . external_file_get_contents ( " https://beta.linkstack.org/vbeta.json " ); ?> </p>
2023-06-15 20:20:31 +02:00
< p >< ? php if ( file_exists ( base_path ( " vbeta.json " ))) { echo __ ( 'messages.Installed beta version' ) . " = " . file_get_contents ( base_path ( " vbeta.json " ));} else { echo __ ( 'messages.Installed beta version' ) . " = " . __ ( 'messages.none' );} ?> </p>
< p >< ? php if ( $Vgit > $Vlocal ) { echo __ ( 'messages.You need to update to the latest mainline release' );} else { echo __ ( " messages.You’ re running the latest mainline release " );} ?> </p>
2022-05-28 14:03:49 +02:00
@ else
2023-04-27 17:06:40 +02:00
< a target = " _blank " href = " https://github.com/linkstackorg/linkstack/releases " >< code style = " color:#222;transform:scale(.9); " > {{ $Vlocal }} -> {{ $Vgit }} </ code ></ a >
2023-06-15 19:44:43 +02:00
< h4 > {{ __ ( 'messages.update.manually' )}} </ h4 >
2022-05-28 14:03:49 +02:00
@ endif
2022-05-25 16:19:20 +02:00
< br >< div class = " row " >
2022-05-30 11:39:39 +02:00
@ if ( env ( 'SKIP_UPDATE_BACKUP' ) == true )
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url()->current()}}/?preparing " >< button >< i class = " fa-solid fa-user-gear btn " ></ i > {{ __ ( 'messages.Update automatically' )}} </ button ></ a >& ensp ;
2022-05-30 11:39:39 +02:00
@ else
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url()->current()}}/?backup " >< button >< i class = " fa-solid fa-user-gear btn " ></ i > {{ __ ( 'messages.Update automatically' )}} </ button ></ a >& ensp ;
2022-05-30 11:39:39 +02:00
@ endif
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " https://linkstack.org/update " target = " _blank " >< button >< i class = " fa-solid fa-download btn " ></ i > {{ __ ( 'messages.Update manually' )}} </ button ></ a >& ensp ;
2022-05-25 16:19:20 +02:00
</ div >
2022-05-26 11:16:46 +02:00
@ endif
2022-05-26 11:10:05 +02:00
2022-05-24 15:30:22 +02:00
@ endif
2022-07-12 15:16:37 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'updating-windows' and strtoupper ( substr ( PHP_OS , 0 , 3 )) === 'WIN' )
< ? php //updating on Windows ?>
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo-loading.svg') }} " alt = " Logo " >
2022-07-12 15:16:37 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 class = " loadingtxt " > {{ __ ( 'messages.Updating' )}} </ h1 >
2022-07-12 15:16:37 +02:00
@ Push ( 'updater-head' )
2022-11-09 17:02:04 +01:00
< meta http - equiv = " refresh " content = " 2; URL= { { url()->current()}}/?preparing " />
2022-07-12 15:16:37 +02:00
@ endpush
@ endif
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'updating-windows-bat' and strtoupper ( substr ( PHP_OS , 0 , 3 )) === 'WIN' )
< ? php //updating on Windows ?>
< ? php
// Download the zip file
2023-04-27 19:45:12 +02:00
$latestversion = trim ( external_file_get_contents ( " https://version.linkstack.org/ " ));
2022-07-12 15:16:37 +02:00
if ( env ( 'JOIN_BETA' ) === true ){
2023-11-16 14:51:48 +01:00
$fileUrl = 'https://beta.linkstack.org/' . $latestversion . '.zip' ;
2022-07-12 15:16:37 +02:00
} else {
2023-04-27 19:45:12 +02:00
$fileUrl = 'https://update.linkstack.org/' . $latestversion . '.zip' ;
2022-07-12 15:16:37 +02:00
}
$curl = curl_init ();
curl_setopt ( $curl , CURLOPT_URL , $fileUrl );
curl_setopt ( $curl , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt ( $curl , CURLOPT_SSL_VERIFYPEER , false );
$result = curl_exec ( $curl );
curl_close ( $curl );
file_put_contents ( base_path ( 'storage/update.zip' ), $result );
$zip = new ZipArchive ;
$zip -> open ( base_path () . '/storage/update.zip' );
$zip -> extractTo ( base_path ());
$zip -> close ();
unlink ( base_path () . '/storage/update.zip' );
echo " <meta http-equiv= \" refresh \" content= \" 0; " . url () -> current () . " /?finishing \" /> " ;
?>
@ endif
2022-05-24 15:30:22 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'backup' )
< ? php //creating backup... ?>
@ Push ( 'updater-head' )
< meta http - equiv = " refresh " content = " 2; URL= { { url()->current()}}/?backups " />
@ endpush
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo-loading.svg') }} " alt = " Logo " >
2022-05-24 15:30:22 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 class = " loadingtxt " > {{ __ ( 'messages.Creating backup' )}} </ h1 >
2022-05-24 15:30:22 +02:00
@ endif
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'backups' )
2023-03-09 22:24:11 +01:00
< ? php
try { Artisan :: call ( 'backup:clean' );}
catch ( exception $e ) {}
2022-05-25 17:00:21 +02:00
Artisan :: call ( 'backup:run' , [ '--only-files' => true ]);
2022-05-24 17:26:12 +02:00
$tst = base_path ( 'backups/' );
file_put_contents ( $tst . 'CANUPDATE' , '' );
2022-05-24 16:13:00 +02:00
$URL = Route :: current () -> getName ();
2022-11-09 17:02:04 +01:00
header ( " Location: " . $URL . " ?preparing " );
2022-05-24 15:30:22 +02:00
exit (); ?>
@ endif
2022-11-09 17:02:04 +01:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'preparing' )
< ? php //preparing update ?>
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo-loading.svg') }} " alt = " Logo " >
2022-11-09 17:02:04 +01:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 class = " loadingtxt " > {{ __ ( 'messages.Preparing update' )}} </ h1 >
2022-11-09 17:02:04 +01:00
< ? php // Get update preperation script from GitHub
try {
2023-04-27 19:45:12 +02:00
$file = external_file_get_contents ( 'https://pre-update.linkstack.org' );
2022-11-09 17:02:04 +01:00
$newfile = base_path ( 'resources/views/components/pre-update.blade.php' );
file_put_contents ( $newfile , $file );
} catch ( exception $e ) {}
?>
@ include ( 'components.pre-update' )
@ if ( strtoupper ( substr ( PHP_OS , 0 , 3 )) === 'WIN' )
< meta http - equiv = " refresh " content = " 2; URL= { { url()->current()}}/?updating-windows-bat " />
@ else
2022-11-20 22:21:57 +01:00
< ? php echo " <meta http-equiv= \" refresh \" content= \" 1; " . url () -> current () . " ?updating \" /> " ?>
2022-11-09 17:02:04 +01:00
@ endif
@ endif
2022-05-30 11:39:39 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'updating' and ( file_exists ( base_path ( " backups/CANUPDATE " )) or env ( 'SKIP_UPDATE_BACKUP' ) == true ))
2022-05-25 16:19:20 +02:00
< ? php //updating... ?>
2022-05-24 15:30:22 +02:00
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo-loading.svg') }} " alt = " Logo " >
2022-05-24 15:30:22 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 class = " loadingtxt " > {{ __ ( 'messages.Updating' )}} </ h1 >
2022-05-25 16:19:20 +02:00
@ Push ( 'updater-head' )
< meta http - equiv = " refresh " content = " 2; URL= { { url()->current()}}/../updating " />
@ endpush
@ endif
2022-05-30 10:42:40 +02:00
@ elseif ( $_SERVER [ 'QUERY_STRING' ] === '' )
2022-05-30 11:48:05 +02:00
< ? php //if no new version available ?>
2022-05-30 10:42:40 +02:00
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo.svg') }} " alt = " Logo " >
2022-05-30 10:42:40 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 > {{ __ ( 'messages.No new version' )}} </ h1 >
< h4 > {{ __ ( 'messages.There is no new version available' )}} </ h4 >
2022-05-30 10:42:40 +02:00
< br >< div class = " row " >
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url('dashboard') }} " >< button >< i class = " fa-solid fa-house-laptop btn " ></ i > {{ __ ( 'messages.Admin Panel' )}} </ button ></ a >& ensp ;
2022-05-30 10:42:40 +02:00
</ div >
2022-05-24 15:30:22 +02:00
@ endif
2022-05-25 20:53:32 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'finishing' )
2022-05-30 11:48:05 +02:00
< ? php //finishing up update ?>
2022-12-05 13:29:40 +01:00
< ? php
$debug = NULL ;
if ( EnvEditor :: getKey ( 'APP_DEBUG' ) == 'false' ){
if ( EnvEditor :: keyExists ( 'APP_DEBUG' )){ EnvEditor :: editKey ( 'APP_DEBUG' , 'true' );}
if ( EnvEditor :: keyExists ( 'APP_ENV' )){ EnvEditor :: editKey ( 'APP_ENV' , 'local' );}
if ( EnvEditor :: keyExists ( 'LOG_LEVEL' )){ EnvEditor :: editKey ( 'LOG_LEVEL' , 'debug' );}
$debug = true ;
}
?>
2022-05-25 20:53:32 +02:00
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo-loading.svg') }} " alt = " Logo " >
2022-05-25 20:53:32 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 class = " loadingtxt " > {{ __ ( 'messages.Finishing up' )}} </ h1 >
2022-05-25 20:53:32 +02:00
2022-06-30 10:39:40 +02:00
@ include ( 'components.finishing' )
2022-08-08 14:09:11 +02:00
2023-05-26 00:58:13 +02:00
< ? php EnvEditor :: editKey ( 'MAINTENANCE_MODE' , false ); ?>
2022-12-05 13:29:40 +01:00
< ? php
if ( $debug === true ){
if ( EnvEditor :: keyExists ( 'APP_DEBUG' )){ EnvEditor :: editKey ( 'APP_DEBUG' , 'false' );}
if ( EnvEditor :: keyExists ( 'APP_ENV' )){ EnvEditor :: editKey ( 'APP_ENV' , 'production' );}
if ( EnvEditor :: keyExists ( 'LOG_LEVEL' )){ EnvEditor :: editKey ( 'LOG_LEVEL' , 'error' );}
}
?>
2023-02-06 21:46:16 +01:00
< ? php echo " <meta http-equiv= \" refresh \" content= \" 0; " . url () -> current () . " ?success \" /> " ; ?>
2022-05-25 20:53:32 +02:00
@ endif
2022-05-25 16:19:20 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'success' )
2022-05-30 11:48:05 +02:00
< ? php //after successfully updating ?>
2022-05-26 11:10:05 +02:00
2022-05-24 15:30:22 +02:00
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo.svg') }} " alt = " Logo " >
2022-05-24 15:30:22 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 > {{ __ ( 'messages.Success!' )}} </ h1 >
2022-05-30 12:07:07 +02:00
@ if ( env ( 'JOIN_BETA' ) === true )
2023-06-19 13:47:04 +02:00
< p >< ? php echo __ ( 'messages.Latest beta version' ) . " = " . external_file_get_contents ( " https://beta.linkstack.org/vbeta.json " ); ?> </p>
2023-06-15 19:44:43 +02:00
< p >< ? php if ( file_exists ( base_path ( " vbeta.json " ))) { echo __ ( 'messages.Installed beta version' ) . " = " . file_get_contents ( base_path ( " vbeta.json " ));} else { echo __ ( 'messages.Installed beta version' ) . " = " . __ ( 'messages.none' );} ?> </p>
< p >< ? php if ( $Vgit > $Vlocal ) { echo __ ( 'messages.You need to update to the latest mainline release' );} else { echo __ ( " messages.You’ re running the latest mainline release " );} ?> </p>
2022-05-30 12:07:07 +02:00
@ else
2023-06-15 19:44:43 +02:00
< h4 > {{ __ ( 'messages.The update was successful' )}} </ h4 >
2022-06-10 12:39:08 +02:00
< style >. noteslink : hover { color : #006fd5;text-shadow:0px 6px 7px rgba(23,10,6,0.66);}</style>
2023-06-15 19:44:43 +02:00
< a class = " noteslink " href = " https://github.com/linkstackorg/linkstack/releases/latest " target = " _blank " >< i class = " fa-solid fa-up-right-from-square " ></ i > {{ __ ( 'messages.View the release notes' )}} </ a >
2022-06-10 12:39:08 +02:00
< br >
2022-05-30 12:07:07 +02:00
@ endif
2022-05-24 15:30:22 +02:00
< br >< div class = " row " >
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url('dashboard') }} " >< button >< i class = " fa-solid fa-house-laptop btn " ></ i > {{ __ ( 'messages.Admin Panel' )}} </ button ></ a >& ensp ;
2022-05-30 12:07:07 +02:00
@ if ( env ( 'JOIN_BETA' ) === true )
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url()->current()}}/ " >< button >< i class = " fa-solid fa-arrow-rotate-right btn " ></ i > {{ __ ( 'messages.Run again' )}} </ button ></ a >& ensp ;
2022-05-30 12:07:07 +02:00
@ endif
2022-05-24 15:30:22 +02:00
</ div >
2022-05-26 11:10:05 +02:00
2022-05-24 15:30:22 +02:00
@ endif
2022-05-26 12:12:29 +02:00
@ if ( $_SERVER [ 'QUERY_STRING' ] === 'error' )
2022-05-30 11:48:05 +02:00
< ? php //on error ?>
2022-05-26 12:12:29 +02:00
2023-05-26 00:58:13 +02:00
< ? php EnvEditor :: editKey ( 'MAINTENANCE_MODE' , false ); ?>
2022-08-08 14:09:11 +02:00
2022-05-26 12:12:29 +02:00
< div class = " logo-container fadein " >
2023-04-26 15:44:39 +02:00
< img class = " logo-img " src = " { { asset('assets/linkstack/images/logo.svg') }} " alt = " Logo " >
2022-05-26 12:12:29 +02:00
</ div >
2023-06-15 19:44:43 +02:00
< h1 > {{ __ ( 'messages.Error' )}} </ h1 >
< h4 > {{ __ ( 'messages.Something went wrong with the update' )}} : ( </ h4 >
2022-05-26 12:12:29 +02:00
< br >< div class = " row " >
2023-06-15 19:44:43 +02:00
& ensp ; < a class = " btn " href = " { { url('dashboard') }} " >< button >< i class = " fa-solid fa-house-laptop btn " ></ i > {{ __ ( 'messages.Admin Panel' )}} </ button ></ a >& ensp ;
2022-05-26 12:12:29 +02:00
</ div >
@ endif
2022-11-09 17:02:04 +01:00
</ div >
2022-05-24 15:30:22 +02:00
@ endpush