From fb92682eed4533f79a1d59d7a3c8b29db612eaf0 Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Tue, 13 Aug 2024 02:26:19 -0400 Subject: [PATCH] install improvements --- install.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/install.php b/install.php index 3b854ee..2929ae6 100644 --- a/install.php +++ b/install.php @@ -99,18 +99,26 @@ class Install extends Controller { Debug::error( 'install hash not found on file.' ); return false; } - if ( ! Session::exists( 'installHash' ) && ! Cookie::exists( 'installHash' ) ) { + $session = Session::get( 'installHash' ); + $cookie = Cookie::get( 'installHash' ); + $file = $this->installer->getNode('installHash'); + + if ( ! $session && ! $cookie ) { Debug::error( 'install hash not found in session or cookie.' ); return false; } - if ( Cookie::exists( 'installHash' ) && !Session::exists( 'installHash' ) ) { - if ( Cookie::get( 'installHash' ) !== $this->installer->getNode('installHash') ) { + if ( $cookie && ! $session ) { + if ( $cookie !== $file ) { + Debug::error( 'install cookie did not match install file.' ); Cookie::delete( 'installHash' ); return false; } - Session::put( 'installHash', Cookie::get( 'installHash' ) ); + Debug::error( 'cookie matches file, using as session' ); + Session::put( 'installHash', $cookie ); + return true; } - if ( Session::get( 'installHash' ) !== $this->installer->getNode('installHash') ) { + if ( $session !== $file ) { + Debug::error( 'session did not match file, deleting session' ); Session::delete( 'installHash' ); return false; }