1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4041 from turbo124/v2

Improve update process
This commit is contained in:
David Bomba 2020-09-07 20:05:39 +10:00 committed by GitHub
commit ca34e77530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 78 deletions

View File

@ -30,7 +30,7 @@ jobs:
MULTI_DB_ENABLED: false
NINJA_LICENSE: 123456
TRAVIS: true
MAIL_DRIVER: log
MAIL_MAILER: log
services:
mariadb:

View File

@ -51,49 +51,62 @@ class PostUpdate extends Command
\Log::error("I wasn't able to optimize.");
}
$composer_data = [
'url' => 'https://getcomposer.org/composer.phar',
'dir' => __DIR__.'/.code',
'bin' => __DIR__.'/.code/composer.phar',
'json' => __DIR__.'/.code/composer.json',
'conf' => [
'autoload' => [
'psr-4' => [
'' => 'local/',
],
],
],
];
// Composer\Factory::getHomeDir() method
// needs COMPOSER_HOME environment variable set
putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
if (! is_dir($composer_data['dir'])) {
mkdir($composer_data['dir'], 0777, true);
}
// call `composer install` command programmatically
$input = new ArrayInput(array('command' => 'install'));
$application = new Application();
$application->setAutoExit(false);
$out = $application->run($input);
if (! is_dir("{$composer_data['dir']}/local")) {
mkdir("{$composer_data['dir']}/local", 0777, true);
}
print_r($out);
echo "Done.";
copy($composer_data['url'], $composer_data['bin']);
require_once "phar://{$composer_data['bin']}/src/bootstrap.php";
// $composer_data = [
// 'url' => 'https://getcomposer.org/composer.phar',
// 'dir' => __DIR__.'/.code',
// 'bin' => __DIR__.'/.code/composer.phar',
// 'json' => __DIR__.'/.code/composer.json',
// 'conf' => [
// 'autoload' => [
// 'psr-4' => [
// '' => 'local/',
// ],
// ],
// ],
// ];
$conf_json = json_encode($composer_data['conf'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
file_put_contents($composer_data['json'], $conf_json);
chdir($composer_data['dir']);
putenv("COMPOSER_HOME={$composer_data['dir']}");
putenv('OSTYPE=OS400');
$app = new \Composer\Console\Application();
// if (! is_dir($composer_data['dir'])) {
// mkdir($composer_data['dir'], 0777, true);
// }
$factory = new \Composer\Factory();
$output = $factory->createOutput();
// if (! is_dir("{$composer_data['dir']}/local")) {
// mkdir("{$composer_data['dir']}/local", 0777, true);
// }
$input = new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'install',
]);
$input->setInteractive(false);
echo '<pre>';
$cmdret = $app->doRun($input, $output);
echo 'end!';
// copy($composer_data['url'], $composer_data['bin']);
// require_once "phar://{$composer_data['bin']}/src/bootstrap.php";
\Log::error(print_r($cmdret, 1));
// $conf_json = json_encode($composer_data['conf'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// file_put_contents($composer_data['json'], $conf_json);
// chdir($composer_data['dir']);
// putenv("COMPOSER_HOME={$composer_data['dir']}");
// putenv('OSTYPE=OS400');
// $app = new \Composer\Console\Application();
// $factory = new \Composer\Factory();
// $output = $factory->createOutput();
// $input = new \Symfony\Component\Console\Input\ArrayInput([
// 'command' => 'install',
// ]);
// $input->setInteractive(false);
// echo '<pre>';
// $cmdret = $app->doRun($input, $output);
// echo 'end!';
// \Log::error(print_r($cmdret, 1));
}
}

View File

@ -33,17 +33,18 @@ class EntityViewController extends Controller
$key = $entity_type.'_id';
$invitation = $invitation_entity::whereRaw('BINARY `key`= ?', [$invitation_key])->firstOrFail();
$invitation = $invitation_entity::whereRaw('BINARY `key`= ?', [$invitation_key])
->with('contact.client')
->firstOrFail();
$contact = $invitation->contact;
$client = $contact->client;
$entity = $invitation->{$entity_type};
if (is_null($contact->password) || empty($contact->password)) {
return redirect("/client/password/reset?email={$contact->email}");
}
$entity_class = sprintf('App\\Models\\%s', ucfirst($entity_type));
$entity = $entity_class::findOrFail($invitation->{$key});
if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
session()->flash("{$entity_type}_VIEW_{$entity->hashed_id}", true);
}

View File

@ -37,29 +37,34 @@ class InvitationController extends Controller
$entity_obj = 'App\Models\\'.ucfirst($entity).'Invitation';
$invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key])->first();
$invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key])
->with('contact.client')
->firstOrFail();
if ($invitation) {
if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
$this->middleware('auth:contact');
} else {
auth()->guard('contact')->login($invitation->contact, true);
}
/* Return early if we have the correct client_hash embedded */
if (! request()->has('silent') && ! $invitation->viewed_date) {
// if (!request()->has('silent')) {
$invitation->markViewed();
event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));
$this->fireEntityViewedEvent($invitation, $entity);
}
return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);
} else {
abort(404);
if(request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
auth()->guard('contact')->login($invitation->contact, true);
}
else if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
$this->middleware('auth:contact');
}
else {
auth()->guard('contact')->login($invitation->contact, true);
}
if (auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
$invitation->markViewed();
event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));
$this->fireEntityViewedEvent($invitation, $entity);
}
return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);
}
private function fireEntityViewedEvent($invitation, $entity_string)

View File

@ -29,8 +29,8 @@ class Kernel extends HttpKernel
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\Cors::class,
//\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\Cors::class,
];

View File

@ -31,10 +31,12 @@ class QueryLogging
*/
public function handle(Request $request, Closure $next)
{
$timeStart = microtime(true);
// Enable query logging for development
if (config('ninja.app_env') != 'production') {
DB::enableQueryLog();
$timeStart = microtime(true);
}
$response = $next($request);

View File

@ -111,7 +111,7 @@ class CreateInvoicePdf implements ShouldQueue
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
Storage::makeDirectory($path, 0775);
info($maker->getCompiledHTML(true));
//info($maker->getCompiledHTML(true));
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));

View File

@ -262,6 +262,13 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
public function createPayment($data, $status = Payment::STATUS_COMPLETED): Payment
{
$payment_meta = new \stdClass;
$payment_meta->exp_month = 'xx';
$payment_meta->exp_year = 'xx';
$payment_meta->brand = 'PayPal';
$payment_meta->last4 = 'xxxx';
$payment_meta->type = GatewayType::PAYPAL;
$payment = parent::createPayment($data, $status);
$client_contact = $this->getContact();
@ -271,6 +278,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
$payment->type_id = PaymentType::PAYPAL;
$payment->transaction_reference = $data['PAYMENTINFO_0_TRANSACTIONID'];
$payment->client_contact_id = $client_contact_id;
$payment->meta = $payment_meta;
$payment->save();
return $payment;

21
composer.lock generated
View File

@ -1541,16 +1541,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.19",
"version": "2.1.20",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "840d5603eb84cc81a6a0382adac3293e57c1c64c"
"reference": "f46887bc48db66c7f38f668eb7d6ae54583617ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/840d5603eb84cc81a6a0382adac3293e57c1c64c",
"reference": "840d5603eb84cc81a6a0382adac3293e57c1c64c",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/f46887bc48db66c7f38f668eb7d6ae54583617ff",
"reference": "f46887bc48db66c7f38f668eb7d6ae54583617ff",
"shasum": ""
},
"require": {
@ -1595,7 +1595,7 @@
"validation",
"validator"
],
"time": "2020-08-08T21:28:19+00:00"
"time": "2020-09-06T13:44:32+00:00"
},
{
"name": "fedeisas/laravel-mail-css-inliner",
@ -4364,16 +4364,16 @@
},
{
"name": "opis/closure",
"version": "3.5.6",
"version": "3.5.7",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "e8d34df855b0a0549a300cb8cb4db472556e8aa9"
"reference": "4531e53afe2fc660403e76fb7644e95998bff7bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/e8d34df855b0a0549a300cb8cb4db472556e8aa9",
"reference": "e8d34df855b0a0549a300cb8cb4db472556e8aa9",
"url": "https://api.github.com/repos/opis/closure/zipball/4531e53afe2fc660403e76fb7644e95998bff7bf",
"reference": "4531e53afe2fc660403e76fb7644e95998bff7bf",
"shasum": ""
},
"require": {
@ -4421,7 +4421,7 @@
"serialization",
"serialize"
],
"time": "2020-08-11T08:46:50+00:00"
"time": "2020-09-06T17:02:15+00:00"
},
{
"name": "paragonie/random_compat",
@ -11053,7 +11053,6 @@
"keywords": [
"tokenizer"
],
"abandoned": true,
"time": "2019-09-17T06:23:10+00:00"
},
{

View File

@ -13,7 +13,7 @@ return [
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
'default' => env('FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------