summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-10-26 18:27:39 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-11-01 15:00:47 +0100
commit56ad1fccc0b63e478e9107b445ab43607f26f775 (patch)
treef9480364509e79b0ebee5dcfe732cf974c96060a
parent938c63e3a21d2d5cdbbd7ce08354407d8cf43902 (diff)
downloadnextcloud-server-56ad1fccc0b63e478e9107b445ab43607f26f775.tar.gz
nextcloud-server-56ad1fccc0b63e478e9107b445ab43607f26f775.zip
Repair registration and autoload bump
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
-rw-r--r--lib/composer/composer/autoload_classmap.php2
-rw-r--r--lib/composer/composer/autoload_static.php2
-rw-r--r--lib/private/Repair.php2
-rw-r--r--lib/private/Repair/NC15/SetVcardDatabaseUID.php40
4 files changed, 28 insertions, 18 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 8c6dc502487..dc20789576b 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -670,6 +670,7 @@ return array(
'OC\\Core\\Migrations\\Version14000Date20180710092004' => $baseDir . '/core/Migrations/Version14000Date20180710092004.php',
'OC\\Core\\Migrations\\Version14000Date20180712153140' => $baseDir . '/core/Migrations/Version14000Date20180712153140.php',
'OC\\Core\\Migrations\\Version15000Date20180926101451' => $baseDir . '/core/Migrations/Version15000Date20180926101451.php',
+ 'OC\\Core\\Migrations\\Version15000Date20180927120000' => $baseDir . '/core/Migrations/Version15000Date20180927120000.php',
'OC\\Core\\Migrations\\Version15000Date20181015062942' => $baseDir . '/core/Migrations/Version15000Date20181015062942.php',
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',
'OC\\DB\\AdapterMySQL' => $baseDir . '/lib/private/DB/AdapterMySQL.php',
@@ -964,6 +965,7 @@ return array(
'OC\\Repair\\NC13\\RepairInvalidPaths' => $baseDir . '/lib/private/Repair/NC13/RepairInvalidPaths.php',
'OC\\Repair\\NC14\\AddPreviewBackgroundCleanupJob' => $baseDir . '/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php',
'OC\\Repair\\NC14\\RepairPendingCronJobs' => $baseDir . '/lib/private/Repair/NC14/RepairPendingCronJobs.php',
+ 'OC\\Repair\\NC15\\SetVcardDatabaseUID' => $baseDir . '/lib/private/Repair/NC15/SetVcardDatabaseUID.php',
'OC\\Repair\\OldGroupMembershipShares' => $baseDir . '/lib/private/Repair/OldGroupMembershipShares.php',
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => $baseDir . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
'OC\\Repair\\Owncloud\\SaveAccountsTableData' => $baseDir . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 2a46e99e020..fe2ff5d760e 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -700,6 +700,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Core\\Migrations\\Version14000Date20180710092004' => __DIR__ . '/../../..' . '/core/Migrations/Version14000Date20180710092004.php',
'OC\\Core\\Migrations\\Version14000Date20180712153140' => __DIR__ . '/../../..' . '/core/Migrations/Version14000Date20180712153140.php',
'OC\\Core\\Migrations\\Version15000Date20180926101451' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20180926101451.php',
+ 'OC\\Core\\Migrations\\Version15000Date20180927120000' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20180927120000.php',
'OC\\Core\\Migrations\\Version15000Date20181015062942' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20181015062942.php',
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',
'OC\\DB\\AdapterMySQL' => __DIR__ . '/../../..' . '/lib/private/DB/AdapterMySQL.php',
@@ -994,6 +995,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Repair\\NC13\\RepairInvalidPaths' => __DIR__ . '/../../..' . '/lib/private/Repair/NC13/RepairInvalidPaths.php',
'OC\\Repair\\NC14\\AddPreviewBackgroundCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php',
'OC\\Repair\\NC14\\RepairPendingCronJobs' => __DIR__ . '/../../..' . '/lib/private/Repair/NC14/RepairPendingCronJobs.php',
+ 'OC\\Repair\\NC15\\SetVcardDatabaseUID' => __DIR__ . '/../../..' . '/lib/private/Repair/NC15/SetVcardDatabaseUID.php',
'OC\\Repair\\OldGroupMembershipShares' => __DIR__ . '/../../..' . '/lib/private/Repair/OldGroupMembershipShares.php',
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
'OC\\Repair\\Owncloud\\SaveAccountsTableData' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php',
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index ad9662ca1d7..01724fd6a38 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -39,6 +39,7 @@ use OC\Repair\NC11\FixMountStorages;
use OC\Repair\NC13\AddLogRotateJob;
use OC\Repair\NC14\AddPreviewBackgroundCleanupJob;
use OC\Repair\NC14\RepairPendingCronJobs;
+use OC\Repair\NC15\SetVcardDatabaseUID;
use OC\Repair\OldGroupMembershipShares;
use OC\Repair\Owncloud\DropAccountTermsTable;
use OC\Repair\Owncloud\SaveAccountsTableData;
@@ -139,6 +140,7 @@ class Repair implements IOutput{
new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
+ new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
];
}
diff --git a/lib/private/Repair/NC15/SetVcardDatabaseUID.php b/lib/private/Repair/NC15/SetVcardDatabaseUID.php
index 2fe50c79471..e82a0aad18a 100644
--- a/lib/private/Repair/NC15/SetVcardDatabaseUID.php
+++ b/lib/private/Repair/NC15/SetVcardDatabaseUID.php
@@ -21,10 +21,8 @@
*
*/
-namespace OC\Repair\NC13;
+namespace OC\Repair\NC15;
-
-use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
@@ -35,13 +33,17 @@ class SetVcardDatabaseUID implements IRepairStep {
/** @var IDBConnection */
private $connection;
+
+ /** @var IConfig */
+ private $config;
+
private $updateQuery;
- public function __construct(IDBConnection $connection) {
+ public function __construct(IDBConnection $connection, IConfig $config) {
$this->connection = $connection;
+ $this->config = $config;
}
-
public function getName() {
return 'Extract the vcard uid and store it in the db';
}
@@ -54,13 +56,13 @@ class SetVcardDatabaseUID implements IRepairStep {
$builder = $this->connection->getQueryBuilder();
$builder->select('id', 'carddata')
- ->from('cards')
- ->where($builder->expr()->isNull('uid'))
- ->setMaxResults(self::MAX_ROWS);
+ ->from('cards')
+ ->where($builder->expr()->isNull('uid'))
+ ->setMaxResults(self::MAX_ROWS);
do {
$result = $builder->execute();
- $rows = $result->fetchAll();
+ $rows = $result->fetchAll();
foreach ($rows as $row) {
yield $row;
}
@@ -70,9 +72,10 @@ class SetVcardDatabaseUID implements IRepairStep {
private function getUid($carddata) {
preg_match('/^UID:(.*)$/m', $carddata, $matches);
- if (count($matches > 1)) {
- return $matches[1][0];
+ if (count($matches) > 1) {
+ return $matches[1];
}
+
return false;
}
@@ -85,8 +88,8 @@ class SetVcardDatabaseUID implements IRepairStep {
$builder = $this->connection->getQueryBuilder();
$this->updateQuery = $builder->update('cards')
- ->set('uid', $builder->createParameter('uid'))
- ->where($builder->expr()->eq('id', $builder->createParameter('id')));
+ ->set('uid', $builder->createParameter('uid'))
+ ->where($builder->expr()->eq('id', $builder->createParameter('id')));
}
$this->updateQuery->setParameter('id', $id);
@@ -98,23 +101,24 @@ class SetVcardDatabaseUID implements IRepairStep {
private function repair() {
$this->connection->beginTransaction();
$entries = $this->getInvalidEntries();
- $count = 0;
+ $count = 0;
foreach ($entries as $entry) {
$count++;
- $uid = $this->getUid($entry['id']);
+ $uid = $this->getUid($entry['carddata']);
if ($uid !== false) {
$this->update($entry['id'], $uid);
}
}
$this->connection->commit();
+
return $count;
}
private function shouldRun() {
- $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
+ $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0.0');
- // was added to 15.0.0.0
- return version_compare($versionFromBeforeUpdate, '15.0.0.0', '<=');
+ // was added to 15.0.0.2
+ return version_compare($versionFromBeforeUpdate, '15.0.0.2', '<=');
}
public function run(IOutput $output) {