Browse Source

Repair registration and autoload bump

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tags/v15.0.0beta1
John Molakvoæ (skjnldsv) 5 years ago
parent
commit
9fbe6774f7
No account linked to committer's email address

+ 2
- 0
lib/composer/composer/autoload_classmap.php View File

'OC\\Core\\Migrations\\Version14000Date20180710092004' => $baseDir . '/core/Migrations/Version14000Date20180710092004.php', 'OC\\Core\\Migrations\\Version14000Date20180710092004' => $baseDir . '/core/Migrations/Version14000Date20180710092004.php',
'OC\\Core\\Migrations\\Version14000Date20180712153140' => $baseDir . '/core/Migrations/Version14000Date20180712153140.php', 'OC\\Core\\Migrations\\Version14000Date20180712153140' => $baseDir . '/core/Migrations/Version14000Date20180712153140.php',
'OC\\Core\\Migrations\\Version15000Date20180926101451' => $baseDir . '/core/Migrations/Version15000Date20180926101451.php', 'OC\\Core\\Migrations\\Version15000Date20180926101451' => $baseDir . '/core/Migrations/Version15000Date20180926101451.php',
'OC\\Core\\Migrations\\Version15000Date20180927120000' => $baseDir . '/core/Migrations/Version15000Date20180927120000.php',
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php', 'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',
'OC\\DB\\AdapterMySQL' => $baseDir . '/lib/private/DB/AdapterMySQL.php', 'OC\\DB\\AdapterMySQL' => $baseDir . '/lib/private/DB/AdapterMySQL.php',
'OC\\DB\\AdapterOCI8' => $baseDir . '/lib/private/DB/AdapterOCI8.php', 'OC\\DB\\AdapterOCI8' => $baseDir . '/lib/private/DB/AdapterOCI8.php',
'OC\\Repair\\NC13\\RepairInvalidPaths' => $baseDir . '/lib/private/Repair/NC13/RepairInvalidPaths.php', '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\\AddPreviewBackgroundCleanupJob' => $baseDir . '/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php',
'OC\\Repair\\NC14\\RepairPendingCronJobs' => $baseDir . '/lib/private/Repair/NC14/RepairPendingCronJobs.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\\OldGroupMembershipShares' => $baseDir . '/lib/private/Repair/OldGroupMembershipShares.php',
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => $baseDir . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php', 'OC\\Repair\\Owncloud\\DropAccountTermsTable' => $baseDir . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
'OC\\Repair\\Owncloud\\SaveAccountsTableData' => $baseDir . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php', 'OC\\Repair\\Owncloud\\SaveAccountsTableData' => $baseDir . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php',

+ 2
- 0
lib/composer/composer/autoload_static.php View File

'OC\\Core\\Migrations\\Version14000Date20180710092004' => __DIR__ . '/../../..' . '/core/Migrations/Version14000Date20180710092004.php', 'OC\\Core\\Migrations\\Version14000Date20180710092004' => __DIR__ . '/../../..' . '/core/Migrations/Version14000Date20180710092004.php',
'OC\\Core\\Migrations\\Version14000Date20180712153140' => __DIR__ . '/../../..' . '/core/Migrations/Version14000Date20180712153140.php', 'OC\\Core\\Migrations\\Version14000Date20180712153140' => __DIR__ . '/../../..' . '/core/Migrations/Version14000Date20180712153140.php',
'OC\\Core\\Migrations\\Version15000Date20180926101451' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20180926101451.php', 'OC\\Core\\Migrations\\Version15000Date20180926101451' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20180926101451.php',
'OC\\Core\\Migrations\\Version15000Date20180927120000' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20180927120000.php',
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php', 'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',
'OC\\DB\\AdapterMySQL' => __DIR__ . '/../../..' . '/lib/private/DB/AdapterMySQL.php', 'OC\\DB\\AdapterMySQL' => __DIR__ . '/../../..' . '/lib/private/DB/AdapterMySQL.php',
'OC\\DB\\AdapterOCI8' => __DIR__ . '/../../..' . '/lib/private/DB/AdapterOCI8.php', 'OC\\DB\\AdapterOCI8' => __DIR__ . '/../../..' . '/lib/private/DB/AdapterOCI8.php',
'OC\\Repair\\NC13\\RepairInvalidPaths' => __DIR__ . '/../../..' . '/lib/private/Repair/NC13/RepairInvalidPaths.php', '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\\AddPreviewBackgroundCleanupJob' => __DIR__ . '/../../..' . '/lib/private/Repair/NC14/AddPreviewBackgroundCleanupJob.php',
'OC\\Repair\\NC14\\RepairPendingCronJobs' => __DIR__ . '/../../..' . '/lib/private/Repair/NC14/RepairPendingCronJobs.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\\OldGroupMembershipShares' => __DIR__ . '/../../..' . '/lib/private/Repair/OldGroupMembershipShares.php',
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php', 'OC\\Repair\\Owncloud\\DropAccountTermsTable' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
'OC\\Repair\\Owncloud\\SaveAccountsTableData' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php', 'OC\\Repair\\Owncloud\\SaveAccountsTableData' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php',

+ 2
- 0
lib/private/Repair.php View File

use OC\Repair\NC13\AddLogRotateJob; use OC\Repair\NC13\AddLogRotateJob;
use OC\Repair\NC14\AddPreviewBackgroundCleanupJob; use OC\Repair\NC14\AddPreviewBackgroundCleanupJob;
use OC\Repair\NC14\RepairPendingCronJobs; use OC\Repair\NC14\RepairPendingCronJobs;
use OC\Repair\NC15\SetVcardDatabaseUID;
use OC\Repair\OldGroupMembershipShares; use OC\Repair\OldGroupMembershipShares;
use OC\Repair\Owncloud\DropAccountTermsTable; use OC\Repair\Owncloud\DropAccountTermsTable;
use OC\Repair\Owncloud\SaveAccountsTableData; use OC\Repair\Owncloud\SaveAccountsTableData;
new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()), new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()), new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()), new RepairPendingCronJobs(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
]; ];
} }



+ 22
- 18
lib/private/Repair/NC15/SetVcardDatabaseUID.php View File

* *
*/ */


namespace OC\Repair\NC13;
namespace OC\Repair\NC15;



use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig; use OCP\IConfig;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\Migration\IOutput; use OCP\Migration\IOutput;


/** @var IDBConnection */ /** @var IDBConnection */
private $connection; private $connection;

/** @var IConfig */
private $config;

private $updateQuery; private $updateQuery;


public function __construct(IDBConnection $connection) {
public function __construct(IDBConnection $connection, IConfig $config) {
$this->connection = $connection; $this->connection = $connection;
$this->config = $config;
} }



public function getName() { public function getName() {
return 'Extract the vcard uid and store it in the db'; return 'Extract the vcard uid and store it in the db';
} }
$builder = $this->connection->getQueryBuilder(); $builder = $this->connection->getQueryBuilder();


$builder->select('id', 'carddata') $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 { do {
$result = $builder->execute(); $result = $builder->execute();
$rows = $result->fetchAll();
$rows = $result->fetchAll();
foreach ($rows as $row) { foreach ($rows as $row) {
yield $row; yield $row;
} }


private function getUid($carddata) { private function getUid($carddata) {
preg_match('/^UID:(.*)$/m', $carddata, $matches); preg_match('/^UID:(.*)$/m', $carddata, $matches);
if (count($matches > 1)) {
return $matches[1][0];
if (count($matches) > 1) {
return $matches[1];
} }

return false; return false;
} }


$builder = $this->connection->getQueryBuilder(); $builder = $this->connection->getQueryBuilder();


$this->updateQuery = $builder->update('cards') $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); $this->updateQuery->setParameter('id', $id);
private function repair() { private function repair() {
$this->connection->beginTransaction(); $this->connection->beginTransaction();
$entries = $this->getInvalidEntries(); $entries = $this->getInvalidEntries();
$count = 0;
$count = 0;
foreach ($entries as $entry) { foreach ($entries as $entry) {
$count++; $count++;
$uid = $this->getUid($entry['id']);
$uid = $this->getUid($entry['carddata']);
if ($uid !== false) { if ($uid !== false) {
$this->update($entry['id'], $uid); $this->update($entry['id'], $uid);
} }
} }
$this->connection->commit(); $this->connection->commit();

return $count; return $count;
} }


private function shouldRun() { 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) { public function run(IOutput $output) {

+ 1
- 1
version.php View File

// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
// when updating major/minor version number. // when updating major/minor version number.


$OC_Version = array(15, 0, 0, 1);
$OC_Version = array(15, 0, 0, 2);


// The human readable string // The human readable string
$OC_VersionString = '15.0.0 alpha'; $OC_VersionString = '15.0.0 alpha';

Loading…
Cancel
Save