Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.7] Hotfix Migration #75

Merged
merged 4 commits into from
Jan 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/Mail/Jobs/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@
use Baka\Mail\Message;
use Phalcon\Di;
use Swift_Mailer;
use Swift_Message;
use Swift_SmtpTransport;

class Mail extends Job implements QueueableJobInterface
{
protected object $config;
protected array $options;
protected Message $message;
protected Swift_Message $message;

/**
* Setup the mail job construct.
*
* @param Message $message
* @param Swift_Message $message
* @param array $options
*/
public function __construct(Message $message, array $options = [])
public function __construct(Swift_Message $message, array $options = [])
{
$this->message = $message;
$this->config = $message->getManager()->getConfigure();
$this->options = $options;
$this->config = $options['config'];
$this->options = $options['options'];
}

/**
Expand All @@ -46,12 +47,12 @@ public function handle()
$username = $auth['username'];
$password = $auth['password'];

//ovewrite host
//overwrite host
if (array_key_exists('host', $auth)) {
$host = $auth['host'];
}

//ovewrite port
//overwrite port
if (array_key_exists('port', $auth)) {
$port = $auth['port'];
}
Expand All @@ -65,7 +66,7 @@ public function handle()

$swift = Swift_Mailer::newInstance($transport);
$failures = [];
if ($swift->send($this->message->getMessage(), $failures)) {
if ($swift->send($this->message, $failures)) {
Di::getDefault()->get('log')->info('Email successfully sent to', [$this->message->getTo()]);
} else {
Di::getDefault()->get('log')->error('Email error sending ', [$failures]);
Expand Down
8 changes: 7 additions & 1 deletion src/Mail/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ public function send()
$this->failedRecipients = [];
$options = $this->auth ? ['auth' => $this->smtp] : [];

Mail::dispatch($this, $options);
Mail::dispatch(
$this->getMessage(),
[
'options' => $options,
'config' => $this->getManager()->getConfigure()
]
);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions storage/db/migrations/20190510224738_init_blameable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function change()
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'identity' => 'enable',
'precision' => '20',
])
->addColumn('entity_id', 'string', [
'null' => false,
Expand Down Expand Up @@ -103,12 +104,14 @@ public function change()
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'identity' => 'enable',
'precision' => '20',
])
->addColumn('audits_id', 'biginteger', [
'null' => false,
'limit' => MysqlAdapter::INT_BIG,
'signed' => false,
'after' => 'id',
'precision' => '20',
])
->addColumn('field_name', 'string', [
'null' => false,
Expand Down
50 changes: 26 additions & 24 deletions storage/db/migrations/20200711231533_add_custom_fieldsv2.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class AddCustomFieldsv2 extends Phinx\Migration\AbstractMigration
public function change()
{
$this->table('audits_details', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->changeColumn('old_value', 'text', [
'null' => true,
'limit' => 65535,
Expand Down Expand Up @@ -46,14 +46,14 @@ public function change()
->save();

$this->table('leads', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->changeColumn('email', 'string', [
'null' => true,
'limit' => 255,
Expand All @@ -64,18 +64,19 @@ public function change()
->save();

$this->table('apps_custom_fields', [
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
'id' => false,
'primary_key' => ['id'],
'engine' => 'InnoDB',
'encoding' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'comment' => '',
'row_format' => 'DYNAMIC',
])
->addColumn('id', 'biginteger', [
'null' => false,
'limit' => MysqlAdapter::INT_BIG,
'identity' => 'enable',
'precision' => '20',
])
->addColumn('companies_id', 'integer', [
'null' => false,
Expand All @@ -99,6 +100,7 @@ public function change()
'default' => '0',
'limit' => MysqlAdapter::INT_BIG,
'after' => 'model_name',
'precision' => '20',
])
->addColumn('name', 'string', [
'null' => false,
Expand Down