Merge pull request #5569 from turbo124/v5-develop

Changes to logging after self update
This commit is contained in:
David Bomba 2021-05-01 10:52:52 +10:00 committed by GitHub
commit c3f55533dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 36 deletions

View File

@ -1 +1 @@
5.1.56 5.1.57

View File

@ -42,12 +42,12 @@ class PostUpdate extends Command
{ {
set_time_limit(0); set_time_limit(0);
nlog('running post update'); info('running post update');
try { try {
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
} catch (\Exception $e) { } catch (\Exception $e) {
nlog("I wasn't able to migrate the data."); info("I wasn't able to migrate the data.");
} }
nlog("finished migrating"); nlog("finished migrating");
@ -56,35 +56,28 @@ class PostUpdate extends Command
exec('vendor/bin/composer install --no-dev -o', $output); exec('vendor/bin/composer install --no-dev -o', $output);
info(print_r($output,1)); info(print_r($output,1));
info("finished running composer install ");
nlog($output);
nlog("finished running composer install ");
try { try {
Artisan::call('optimize'); Artisan::call('optimize');
} catch (\Exception $e) { } catch (\Exception $e) {
nlog("I wasn't able to optimize."); info("I wasn't able to optimize.");
} }
nlog("optimized"); info("optimized");
try { try {
Artisan::call('view:clear'); Artisan::call('view:clear');
} catch (\Exception $e) { } catch (\Exception $e) {
nlog("I wasn't able to clear the views."); info("I wasn't able to clear the views.");
} }
nlog("view cleared"); info("view cleared");
/* For the following to work, the web user (www-data) must own all the directories */
VersionCheck::dispatch(); VersionCheck::dispatch();
nlog("sent for version check"); info("Sent for version check");
// echo "Done.";
} }
} }

View File

@ -59,9 +59,11 @@ class LogoutController extends BaseController
*/ */
public function index(Request $request) public function index(Request $request)
{ {
CompanyToken::with('company') $ct = CompanyToken::with('company.tokens')
->whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')]) ->whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')])
->company ->first();
$ct->company
->tokens() ->tokens()
->where('is_system', true) ->where('is_system', true)
->forceDelete(); ->forceDelete();

View File

@ -62,21 +62,16 @@ class SelfUpdateController extends BaseController
return response()->json(['message' => ctrans('texts.self_update_not_available')], 403); return response()->json(['message' => ctrans('texts.self_update_not_available')], 403);
} }
if(!$this->testWritable()) $this->testWritable();
throw new FilePermissionsFailure('Cannot update system because files are not writable!');
// Check if new version is available // Get the new version available
//if($updater->source()->isNewVersionAvailable()) { $versionAvailable = $updater->source()->getVersionAvailable();
// Get the new version available // Create a release
$versionAvailable = $updater->source()->getVersionAvailable(); $release = $updater->source()->fetch($versionAvailable);
// Create a release $updater->source()->update($release);
$release = $updater->source()->fetch($versionAvailable);
$updater->source()->update($release);
//}
$cacheCompiled = base_path('bootstrap/cache/compiled.php'); $cacheCompiled = base_path('bootstrap/cache/compiled.php');
if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); } if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
@ -105,7 +100,9 @@ class SelfUpdateController extends BaseController
// nlog($file->getPathname()); // nlog($file->getPathname());
if ($file->isFile() && ! $file->isWritable()) { if ($file->isFile() && ! $file->isWritable()) {
throw new FilePermissionsFailure($file); // throw new FilePermissionsFailure($file);
nlog("Cannot update system because {$file->getFileName()} is not writable");
throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} is not writable");
return false; return false;
} }
} }

View File

@ -284,18 +284,17 @@ class SetupController extends Controller
if (file_exists($cacheCompiled)) { if (file_exists($cacheCompiled)) {
unlink ($cacheCompiled); unlink ($cacheCompiled);
} }
$cacheServices = base_path('bootstrap/cache/services.php'); $cacheServices = base_path('bootstrap/cache/services.php');
if (file_exists($cacheServices)) { if (file_exists($cacheServices)) {
unlink ($cacheServices); unlink ($cacheServices);
} }
Artisan::call('clear-compiled'); Artisan::call('clear-compiled');
Artisan::call('cache:clear');
Artisan::call('debugbar:clear');
Artisan::call('route:clear'); Artisan::call('route:clear');
Artisan::call('view:clear'); Artisan::call('view:clear');
Artisan::call('config:clear'); Artisan::call('config:clear');
Cache::flush();
Artisan::call('migrate', ['--force' => true]); Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]);

View File

@ -46,6 +46,9 @@ class VersionCheck implements ShouldQueue
{ {
$account = Account::first(); $account = Account::first();
if(!$account)
return;
if($account->plan == 'white_label' && $account->plan_expires->lt(now())){ if($account->plan == 'white_label' && $account->plan_expires->lt(now())){
$account->plan = null; $account->plan = null;
$account->plan_expires = null; $account->plan_expires = null;

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.1.56', 'app_version' => '5.1.57',
'app_tag' => '5.1.56-release', 'app_tag' => '5.1.57-release',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false), 'api_secret' => env('API_SECRET', false),