-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5358900
commit c4fafa3
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace craft\migrations; | ||
|
||
use Craft; | ||
use craft\db\Migration; | ||
|
||
/** | ||
* m190112_124737_fix_user_settings migration. | ||
*/ | ||
class m190112_124737_fix_user_settings extends Migration | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeUp() | ||
{ | ||
// Don't make the same config changes twice | ||
$projectConfig = Craft::$app->getProjectConfig(); | ||
$schemaVersion = $projectConfig->get('system.schemaVersion', true); | ||
if (version_compare($schemaVersion, '3.1.15', '>=')) { | ||
return; | ||
} | ||
|
||
$wrong = $projectConfig->get('user') ?? []; | ||
$right = $projectConfig->get('users') ?? []; | ||
$projectConfig->set('users', array_merge($wrong, $right)); | ||
$projectConfig->remove('user'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeDown() | ||
{ | ||
echo "m190112_124737_fix_user_settings cannot be reverted.\n"; | ||
return false; | ||
} | ||
} |