diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-11-18 10:48:41 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-11-23 09:20:31 +0100 |
commit | a35904749f78b5acf248886d27edc001f1bc5c63 (patch) | |
tree | 69fe4d24d14db6894d48739b91fa39ebfb9e354c /apps/user_ldap/lib | |
parent | 514324916b33bbaa4972e05abf9e87924cd637e1 (diff) | |
download | nextcloud-server-a35904749f78b5acf248886d27edc001f1bc5c63.tar.gz nextcloud-server-a35904749f78b5acf248886d27edc001f1bc5c63.zip |
Use clearer names for variables
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/Migration/Version1120Date20210917155206.php | 34 | ||||
-rw-r--r-- | apps/user_ldap/lib/Migration/Version1130Date20211102154716.php | 34 |
2 files changed, 34 insertions, 34 deletions
diff --git a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php index d46107733dc..3ab069679ef 100644 --- a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php +++ b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php @@ -70,19 +70,19 @@ class Version1120Date20210917155206 extends SimpleMigrationStep { } protected function handleIDs(string $table, bool $emitHooks) { - $q = $this->getSelectQuery($table); - $u = $this->getUpdateQuery($table); + $select = $this->getSelectQuery($table); + $update = $this->getUpdateQuery($table); - $r = $q->executeQuery(); - while ($row = $r->fetch()) { + $result = $select->executeQuery(); + while ($row = $result->fetch()) { $newId = hash('sha256', $row['owncloud_name'], false); if ($emitHooks) { $this->emitUnassign($row['owncloud_name'], true); } - $u->setParameter('uuid', $row['directory_uuid']); - $u->setParameter('newId', $newId); + $update->setParameter('uuid', $row['directory_uuid']); + $update->setParameter('newId', $newId); try { - $u->executeStatement(); + $update->executeStatement(); if ($emitHooks) { $this->emitUnassign($row['owncloud_name'], false); $this->emitAssign($newId); @@ -100,23 +100,23 @@ class Version1120Date20210917155206 extends SimpleMigrationStep { ); } } - $r->closeCursor(); + $result->closeCursor(); } protected function getSelectQuery(string $table): IQueryBuilder { - $q = $this->dbc->getQueryBuilder(); - $q->select('owncloud_name', 'directory_uuid') + $qb = $this->dbc->getQueryBuilder(); + $qb->select('owncloud_name', 'directory_uuid') ->from($table) - ->where($q->expr()->like('owncloud_name', $q->createNamedParameter(str_repeat('_', 65) . '%'), Types::STRING)); - return $q; + ->where($qb->expr()->like('owncloud_name', $qb->createNamedParameter(str_repeat('_', 65) . '%'), Types::STRING)); + return $qb; } protected function getUpdateQuery(string $table): IQueryBuilder { - $q = $this->dbc->getQueryBuilder(); - $q->update($table) - ->set('owncloud_name', $q->createParameter('newId')) - ->where($q->expr()->eq('directory_uuid', $q->createParameter('uuid'))); - return $q; + $qb = $this->dbc->getQueryBuilder(); + $qb->update($table) + ->set('owncloud_name', $qb->createParameter('newId')) + ->where($qb->expr()->eq('directory_uuid', $qb->createParameter('uuid'))); + return $qb; } protected function emitUnassign(string $oldId, bool $pre): void { diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php index 144efad0ead..b79dbabd5a0 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php @@ -103,16 +103,16 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { } protected function handleDNHashes(string $table): void { - $q = $this->getSelectQuery($table); - $u = $this->getUpdateQuery($table); + $select = $this->getSelectQuery($table); + $update = $this->getUpdateQuery($table); - $r = $q->executeQuery(); - while ($row = $r->fetch()) { + $result = $select->executeQuery(); + while ($row = $result->fetch()) { $dnHash = hash('sha256', $row['ldap_dn'], false); - $u->setParameter('name', $row['owncloud_name']); - $u->setParameter('dn_hash', $dnHash); + $update->setParameter('name', $row['owncloud_name']); + $update->setParameter('dn_hash', $dnHash); try { - $u->executeStatement(); + $update->executeStatement(); } catch (Exception $e) { $this->logger->error('Failed to add hash "{dnHash}" ("{name}" of {table})', [ @@ -125,22 +125,22 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { ); } } - $r->closeCursor(); + $result->closeCursor(); } protected function getSelectQuery(string $table): IQueryBuilder { - $q = $this->dbc->getQueryBuilder(); - $q->select('owncloud_name', 'ldap_dn', 'ldap_dn_hash') + $qb = $this->dbc->getQueryBuilder(); + $qb->select('owncloud_name', 'ldap_dn', 'ldap_dn_hash') ->from($table) - ->where($q->expr()->isNull('ldap_dn_hash')); - return $q; + ->where($qb->expr()->isNull('ldap_dn_hash')); + return $qb; } protected function getUpdateQuery(string $table): IQueryBuilder { - $q = $this->dbc->getQueryBuilder(); - $q->update($table) - ->set('ldap_dn_hash', $q->createParameter('dn_hash')) - ->where($q->expr()->eq('owncloud_name', $q->createParameter('name'))); - return $q; + $qb = $this->dbc->getQueryBuilder(); + $qb->update($table) + ->set('ldap_dn_hash', $qb->createParameter('dn_hash')) + ->where($qb->expr()->eq('owncloud_name', $qb->createParameter('name'))); + return $qb; } } |