mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 16:44:55 +00:00
Upgraded to PHP-CS-Fixer v3
This commit is contained in:
@@ -7,18 +7,18 @@ $db = $this->getDatabaseService()->GetDbConnection();
|
||||
if (defined('GROCY_HTTP_USER'))
|
||||
{
|
||||
// Migrate old user defined in config file to database
|
||||
$newUserRow = $db->users()->createRow(array(
|
||||
$newUserRow = $db->users()->createRow([
|
||||
'username' => GROCY_HTTP_USER,
|
||||
'password' => password_hash(GROCY_HTTP_PASSWORD, PASSWORD_DEFAULT)
|
||||
));
|
||||
]);
|
||||
$newUserRow->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create default user "admin" with password "admin"
|
||||
$newUserRow = $db->users()->createRow(array(
|
||||
$newUserRow = $db->users()->createRow([
|
||||
'username' => 'admin',
|
||||
'password' => password_hash('admin', PASSWORD_DEFAULT)
|
||||
));
|
||||
]);
|
||||
$newUserRow->save();
|
||||
}
|
||||
|
@@ -2,7 +2,8 @@
|
||||
|
||||
// This is executed inside DatabaseMigrationService class/context
|
||||
|
||||
use \Grocy\Services\LocalizationService;
|
||||
use Grocy\Services\LocalizationService;
|
||||
|
||||
$localizationService = $this->getLocalizationService();
|
||||
|
||||
$db = $this->getDatabaseService()->GetDbConnection();
|
||||
@@ -10,23 +11,23 @@ $db = $this->getDatabaseService()->GetDbConnection();
|
||||
if ($db->quantity_units()->count() === 0)
|
||||
{
|
||||
// Create 2 default quantity units
|
||||
$newRow = $db->quantity_units()->createRow(array(
|
||||
$newRow = $db->quantity_units()->createRow([
|
||||
'name' => $localizationService->__n(1, 'Piece', 'Pieces'),
|
||||
'name_plural' => $localizationService->__n(2, 'Piece', 'Pieces')
|
||||
));
|
||||
]);
|
||||
$newRow->save();
|
||||
$newRow = $db->quantity_units()->createRow(array(
|
||||
$newRow = $db->quantity_units()->createRow([
|
||||
'name' => $localizationService->__n(1, 'Pack', 'Packs'),
|
||||
'name_plural' => $localizationService->__n(2, 'Pack', 'Packs')
|
||||
));
|
||||
]);
|
||||
$newRow->save();
|
||||
}
|
||||
|
||||
if ($db->locations()->count() === 0)
|
||||
{
|
||||
// Create a default location
|
||||
$newRow = $db->locations()->createRow(array(
|
||||
$newRow = $db->locations()->createRow([
|
||||
'name' => $localizationService->__t('Fridge')
|
||||
));
|
||||
]);
|
||||
$newRow->save();
|
||||
}
|
||||
|
@@ -2,12 +2,13 @@
|
||||
|
||||
// This is executed inside DatabaseMigrationService class/context
|
||||
|
||||
use \Grocy\Services\LocalizationService;
|
||||
use Grocy\Services\LocalizationService;
|
||||
|
||||
$localizationService = $this->getLocalizationService();
|
||||
|
||||
$db = $this->getDatabaseService()->GetDbConnection();
|
||||
|
||||
$defaultShoppingList = $db->shopping_lists()->where('id = 1')->fetch();
|
||||
$defaultShoppingList->update(array(
|
||||
$defaultShoppingList->update([
|
||||
'name' => $localizationService->__t('Shopping list')
|
||||
));
|
||||
]);
|
||||
|
Reference in New Issue
Block a user