Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 0c7822a

Browse files
committed
ENH: refs #952. Cluster hashes table on each new write in pgsql
This destroys the correspondence of row order to user table order
1 parent 37ce159 commit 0c7822a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/models/pdo/UserModel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ function storePasswordHash($hash)
186186
if(!$this->hashExists($hash))
187187
{
188188
$this->database->getDB()->insert('password', array('hash' => $hash));
189+
190+
if(Zend_Registry::get('configDatabase')->database->adapter == 'PDO_PGSQL')
191+
{
192+
// Pgsql doesn't store rows sorted by their pkey so we must explicitly cluster them after each new write,
193+
// otherwise the order of hashes would correspond to the order of users
194+
$this->database->getDB()->query('CLUSTER password USING password_hash');
195+
}
189196
}
190197
}
191198

0 commit comments

Comments
 (0)