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);
nlog('running post update');
info('running post update');
try {
Artisan::call('migrate', ['--force' => true]);
} catch (\Exception $e) {
nlog("I wasn't able to migrate the data.");
info("I wasn't able to migrate the data.");
}
nlog("finished migrating");
@ -57,34 +57,27 @@ class PostUpdate extends Command
exec('vendor/bin/composer install --no-dev -o', $output);
info(print_r($output,1));
nlog($output);
nlog("finished running composer install ");
info("finished running composer install ");
try {
Artisan::call('optimize');
} catch (\Exception $e) {
nlog("I wasn't able to optimize.");
info("I wasn't able to optimize.");
}
nlog("optimized");
info("optimized");
try {
Artisan::call('view:clear');
} catch (\Exception $e) {
nlog("I wasn't able to clear the views.");
info("I wasn't able to clear the views.");
}
nlog("view cleared");
/* For the following to work, the web user (www-data) must own all the directories */
info("view cleared");
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)
{
CompanyToken::with('company')
$ct = CompanyToken::with('company.tokens')
->whereRaw('BINARY `token`= ?', [$request->header('X-API-TOKEN')])
->company
->first();
$ct->company
->tokens()
->where('is_system', true)
->forceDelete();

View File

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

View File

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

View File

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

View File

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