Rename mail_collected_addresses to mail_coll_addresses
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Родитель
7e2619479c
Коммит
c2d02590f1
|
@ -89,7 +89,7 @@ script:
|
|||
|
||||
# Run server's app code checker
|
||||
# TODO: enable once table renames are possible
|
||||
# - php ../../occ app:check-code mail
|
||||
- php ../../occ app:check-code mail
|
||||
|
||||
# Run JS tests
|
||||
- sh -c "if [ '$TEST_JS' = 'TRUE' ]; then grunt; fi"
|
||||
|
|
|
@ -1,241 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<database>
|
||||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*mail_accounts</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<autoincrement>1</autoincrement>
|
||||
<default>0</default>
|
||||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>name</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>email</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>inbound_host</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>inbound_port</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>6</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>inbound_ssl_mode</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>10</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>inbound_user</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>inbound_password</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>2048</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>outbound_host</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>outbound_port</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>6</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>outbound_ssl_mode</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>10</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>outbound_user</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>outbound_password</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>2048</length>
|
||||
</field>
|
||||
|
||||
<index>
|
||||
<name>mail_userid_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<sorting>ascending</sorting>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*mail_collected_addresses</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<autoincrement>1</autoincrement>
|
||||
<default>0</default>
|
||||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>email</name>
|
||||
<type>text</type>
|
||||
<notnull>true</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>display_name</name>
|
||||
<type>text</type>
|
||||
<notnull>false</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
<index>
|
||||
<name>mail_collected_addr_userid_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<sorting>ascending</sorting>
|
||||
</field>
|
||||
</index>
|
||||
<index>
|
||||
<name>mail_collected_addr_email_index</name>
|
||||
<field>
|
||||
<name>email</name>
|
||||
<sorting>ascending</sorting>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
<table>
|
||||
<name>*dbprefix*mail_aliases</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<autoincrement>1</autoincrement>
|
||||
<default>0</default>
|
||||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>account_id</name>
|
||||
<type>integer</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>name</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>alias</name>
|
||||
<type>text</type>
|
||||
<notnull>true</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
</declaration>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<name>*dbprefix*mail_attachments</name>
|
||||
<declaration>
|
||||
<field>
|
||||
<name>id</name>
|
||||
<type>integer</type>
|
||||
<autoincrement>1</autoincrement>
|
||||
<default>0</default>
|
||||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>64</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>file_name</name>
|
||||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>255</length>
|
||||
</field>
|
||||
<field>
|
||||
<name>created_at</name>
|
||||
<type>integer</type>
|
||||
<default>0</default>
|
||||
<notnull>true</notnull>
|
||||
<length>4</length>
|
||||
</field>
|
||||
<index>
|
||||
<name>mail_attachments_userid_index</name>
|
||||
<field>
|
||||
<name>user_id</name>
|
||||
<sorting>ascending</sorting>
|
||||
</field>
|
||||
</index>
|
||||
</declaration>
|
||||
</table>
|
||||
|
||||
</database>
|
|
@ -5,7 +5,7 @@
|
|||
<name>Mail</name>
|
||||
<summary>IMAP web client</summary>
|
||||
<description>Easy to use email client which connects to your mail server via IMAP and SMTP.</description>
|
||||
<version>0.10.0</version>
|
||||
<version>0.11.0</version>
|
||||
<licence>agpl</licence>
|
||||
<author>Christoph Wurst</author>
|
||||
<author>Jan-Christoph Borchardt</author>
|
||||
|
|
|
@ -14,8 +14,9 @@ The nightly builds are provided by [Portknox.net](https://portknox.net)
|
|||
Connect to your database and run the following commands (`oc_` is the default table prefix):
|
||||
```sql
|
||||
DELETE FROM oc_appconfig WHERE appid = 'mail';
|
||||
DELETE FROM oc_migrations WHERE app = 'mail';
|
||||
DROP TABLE oc_mail_accounts;
|
||||
DROP TABLE oc_mail_aliases;
|
||||
DROP TABLE oc_mail_collected_addresses;
|
||||
DROP TABLE oc_mail_coll_addresses;
|
||||
DROP TABLE oc_mail_attachments;
|
||||
```
|
|
@ -32,7 +32,7 @@ class CollectedAddressMapper extends QBMapper {
|
|||
* @param IDBConnection $db
|
||||
*/
|
||||
public function __construct(IDBConnection $db) {
|
||||
parent::__construct($db, 'mail_collected_addresses');
|
||||
parent::__construct($db, 'mail_coll_addresses');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +90,7 @@ class CollectedAddressMapper extends QBMapper {
|
|||
->from($this->getTableName())
|
||||
->orderBy('id')
|
||||
->setMaxResults(100);
|
||||
if (!is_null($minId)) {
|
||||
if ($minId !== null) {
|
||||
$query = $query->where($qb->expr()->gte('id',
|
||||
$qb->createNamedParameter($minId)));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Daniel Kesselberg <mail@danielkesselberg.de>
|
||||
*
|
||||
* Mail
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Migration;
|
||||
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
*/
|
||||
class Version0100Date20180825194217 extends SimpleMigrationStep {
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
/*
|
||||
* Schema generated from database.xml but required changes for
|
||||
* https://github.com/nextcloud/mail/issues/784 already applied.
|
||||
*/
|
||||
|
||||
if (!$schema->hasTable('mail_accounts')) {
|
||||
$table = $schema->createTable('mail_accounts');
|
||||
$table->addColumn('id', 'integer', [
|
||||
'autoincrement' => true,
|
||||
'notnull' => true,
|
||||
'length' => 4,
|
||||
]);
|
||||
$table->addColumn('user_id', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 64,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('name', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 64,
|
||||
]);
|
||||
$table->addColumn('email', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 255,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('inbound_host', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 64,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('inbound_port', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 6,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('inbound_ssl_mode', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 10,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('inbound_user', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 64,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('inbound_password', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 2048,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('outbound_host', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 64,
|
||||
]);
|
||||
$table->addColumn('outbound_port', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 6,
|
||||
]);
|
||||
$table->addColumn('outbound_ssl_mode', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 10,
|
||||
]);
|
||||
$table->addColumn('outbound_user', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 64,
|
||||
]);
|
||||
$table->addColumn('outbound_password', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 2048,
|
||||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
$table->addIndex(['user_id'], 'mail_userid_index');
|
||||
}
|
||||
|
||||
if (!$schema->hasTable('mail_coll_addresses')) {
|
||||
$table = $schema->createTable('mail_coll_addresses');
|
||||
$table->addColumn('id', 'integer', [
|
||||
'autoincrement' => true,
|
||||
'notnull' => true,
|
||||
'length' => 4,
|
||||
]);
|
||||
$table->addColumn('user_id', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 64,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('email', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 255,
|
||||
]);
|
||||
$table->addColumn('display_name', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 255,
|
||||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
$table->addIndex(['user_id'], 'mail_coll_addr_userid_index');
|
||||
$table->addIndex(['email'], 'mail_coll_addr_email_index');
|
||||
}
|
||||
|
||||
if (!$schema->hasTable('mail_aliases')) {
|
||||
$table = $schema->createTable('mail_aliases');
|
||||
$table->addColumn('id', 'integer', [
|
||||
'autoincrement' => true,
|
||||
'notnull' => true,
|
||||
'length' => 4,
|
||||
]);
|
||||
$table->addColumn('account_id', 'integer', [
|
||||
'notnull' => true,
|
||||
'length' => 4,
|
||||
'default' => 0,
|
||||
]);
|
||||
$table->addColumn('name', 'string', [
|
||||
'notnull' => false,
|
||||
'length' => 64,
|
||||
]);
|
||||
$table->addColumn('alias', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 255,
|
||||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
}
|
||||
|
||||
if (!$schema->hasTable('mail_attachments')) {
|
||||
$table = $schema->createTable('mail_attachments');
|
||||
$table->addColumn('id', 'integer', [
|
||||
'autoincrement' => true,
|
||||
'notnull' => true,
|
||||
'length' => 4,
|
||||
]);
|
||||
$table->addColumn('user_id', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 64,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('file_name', 'string', [
|
||||
'notnull' => true,
|
||||
'length' => 255,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addColumn('created_at', 'integer', [
|
||||
'notnull' => true,
|
||||
'length' => 4,
|
||||
'default' => 0,
|
||||
]);
|
||||
$table->setPrimaryKey(['id']);
|
||||
$table->addIndex(['user_id'], 'mail_attach_userid_index');
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Daniel Kesselberg <mail@danielkesselberg.de>
|
||||
*
|
||||
* Mail
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Migration;
|
||||
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
*/
|
||||
class Version0110Date20180825195812 extends SimpleMigrationStep {
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable('mail_attachments');
|
||||
|
||||
if ($table->hasIndex('mail_attachments_userid_index')) {
|
||||
$table->dropIndex('mail_attachments_userid_index');
|
||||
}
|
||||
|
||||
if (!$table->hasIndex('mail_attach_userid_index')) {
|
||||
$table->addIndex(['user_id'], 'mail_attach_userid_index');
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Daniel Kesselberg <mail@danielkesselberg.de>
|
||||
*
|
||||
* Mail
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Mail\Migration;
|
||||
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
*/
|
||||
class Version0110Date20180825201241 extends SimpleMigrationStep {
|
||||
|
||||
/** @var IDBConnection */
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* @param IDBConnection $connection
|
||||
*/
|
||||
public function __construct(IDBConnection $connection) {
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if ($schema->hasTable('mail_collected_addresses')) {
|
||||
$this->copyCollectedAddresses();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if ($schema->hasTable('mail_collected_addresses')) {
|
||||
$schema->dropTable('mail_collected_addresses');
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*/
|
||||
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy collected addresses to new table
|
||||
*/
|
||||
private function copyCollectedAddresses(): void {
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->select('*')
|
||||
->from('mail_collected_addresses');
|
||||
|
||||
$insert = $this->connection->getQueryBuilder();
|
||||
$insert->insert('mail_coll_addresses')
|
||||
->values(['id' => '?', 'user_id' => '?', 'email' => '?', 'display_name' => '?']);
|
||||
|
||||
$result = $query->execute();
|
||||
|
||||
while ($row = $result->fetch()) {
|
||||
$insert->setParameters([
|
||||
$row['id'],
|
||||
$row['user_id'],
|
||||
$row['email'],
|
||||
$row['display_name']
|
||||
])->execute();
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
}
|
||||
}
|
|
@ -79,8 +79,7 @@ class CollectedAddressMapperTest extends TestCase {
|
|||
$this->address3->setDisplayName('User 3');
|
||||
$this->address3->setUserId($this->userId);
|
||||
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$sql = 'INSERT INTO *PREFIX*mail_collected_addresses (`email`, `display_name`, `user_id`) VALUES (?, ?, ?)';
|
||||
$sql = 'INSERT INTO *PREFIX*mail_coll_addresses (`email`, `display_name`, `user_id`) VALUES (?, ?, ?)';
|
||||
$stmt = $this->db->prepare($sql);
|
||||
|
||||
// Empty DB
|
||||
|
@ -93,19 +92,19 @@ class CollectedAddressMapperTest extends TestCase {
|
|||
$this->address1->getDisplayName(),
|
||||
$this->address1->getUserId(),
|
||||
]);
|
||||
$this->address1->setId($this->db->lastInsertId('PREFIX*mail_collected_addresses'));
|
||||
$this->address1->setId($this->db->lastInsertId('PREFIX*mail_coll_addresses'));
|
||||
$stmt->execute([
|
||||
$this->address2->getEmail(),
|
||||
$this->address2->getDisplayName(),
|
||||
$this->address2->getUserId(),
|
||||
]);
|
||||
$this->address2->setId($this->db->lastInsertId('PREFIX*mail_collected_addresses'));
|
||||
$this->address2->setId($this->db->lastInsertId('PREFIX*mail_coll_addresses'));
|
||||
$stmt->execute([
|
||||
$this->address3->getEmail(),
|
||||
$this->address3->getDisplayName(),
|
||||
$this->address3->getUserId(),
|
||||
]);
|
||||
$this->address3->setId($this->db->lastInsertId('PREFIX*mail_collected_addresses'));
|
||||
$this->address3->setId($this->db->lastInsertId('PREFIX*mail_coll_addresses'));
|
||||
}
|
||||
|
||||
public function matchingData() {
|
||||
|
@ -121,11 +120,11 @@ class CollectedAddressMapperTest extends TestCase {
|
|||
public function testFindMatching($query, $result) {
|
||||
$matches = $this->mapper->findMatching($this->userId, $query);
|
||||
|
||||
$this->assertCount(count($result), $matches);
|
||||
$this->assertCount(\count($result), $matches);
|
||||
$i = 0;
|
||||
foreach ($matches as $match) {
|
||||
$this->assertInstanceOf('\OCA\Mail\Db\CollectedAddress', $match);
|
||||
$this->assertTrue(in_array($match->getEmail(), $result));
|
||||
$this->assertContains($match->getEmail(), $result);
|
||||
$this->assertEquals($this->userId, $match->getUserId());
|
||||
$i++;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче