Elgg
Version master
engine
schema
migrations
20170728060000_remove_legacy_password_hashes.php
Go to the documentation of this file.
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class
RemoveLegacyPasswordHashes
extends
AbstractMigration
6
{
10
public
function
up
() {
11
12
if
(!$this->hasTable(
'users_entity'
)) {
13
return
;
14
}
15
16
// remove legacy 2.x password and salt columns
17
$table
= $this->table(
'users_entity'
);
18
19
if
(
$table
->hasIndexByName(
'password'
)) {
20
$table
->removeIndexByName(
'password'
)->save();
21
}
22
23
if
(
$table
->hasColumn(
'password'
)) {
24
$table
->removeColumn(
'password'
);
25
}
26
27
if
(
$table
->hasColumn(
'salt'
)) {
28
$table
->removeColumn(
'salt'
);
29
}
30
31
$table
->save();
32
33
}
34
35
public
function
down
() {
36
37
if
(!$this->hasTable(
'users_entity'
)) {
38
return
;
39
}
40
41
$table
= $this->table(
'users_entity'
);
42
43
if
(!
$table
->hasColumn(
'password'
)) {
44
$table
->addColumn(
'password'
,
'text'
, [
45
'null'
=>
false
,
46
'default'
=>
''
,
47
'limit'
=> 32,
48
]);
49
}
50
51
if
(!
$table
->hasColumn(
'salt'
)) {
52
$table
->addColumn(
'salt'
,
'text'
, [
53
'null'
=>
false
,
54
'default'
=>
''
,
55
'limit'
=> 8,
56
]);
57
}
58
59
if
(!
$table
->hasIndexByName(
'password'
)) {
60
$table
->addIndex([
'password'
], [
61
'name'
=>
'password'
,
62
'unique'
=>
false
,
63
]);
64
}
65
66
$table
->save();
67
68
}
69
}
$table
$table
Definition:
user.php:37
RemoveLegacyPasswordHashes
Definition:
20170728060000_remove_legacy_password_hashes.php:6
RemoveLegacyPasswordHashes\up
up()
Remove legacy password hashes.
Definition:
20170728060000_remove_legacy_password_hashes.php:10
RemoveLegacyPasswordHashes\down
down()
Definition:
20170728060000_remove_legacy_password_hashes.php:35
Generated on Fri Aug 29 2025 00:01:58 for Elgg by
1.9.1