Commit eba9049b by Sorokin Victor

Update MessageController.php

fix code style
parent 4906cd34
...@@ -134,14 +134,14 @@ class MessageController extends Controller ...@@ -134,14 +134,14 @@ class MessageController extends Controller
throw new Exception('The "db" option must refer to a valid database application component.'); throw new Exception('The "db" option must refer to a valid database application component.');
} }
$sourceMessageTable = isset($config['sourceMessageTable']) ? $config['sourceMessageTable'] : '{{%source_message}}'; $sourceMessageTable = isset($config['sourceMessageTable']) ? $config['sourceMessageTable'] : '{{%source_message}}';
$messageTable = isset($config['messageTable']) ? $config['messageTable'] : '{{%message}}'; $messageTable = isset($config['messageTable']) ? $config['messageTable'] : '{{%message}}';
$this->saveMessagesToDb( $this->saveMessagesToDb(
$messages, $messages,
$db, $db,
$sourceMessageTable, $sourceMessageTable,
$messageTable, $messageTable,
$config['removeUnused'], $config['removeUnused'],
$config['languages'] $config['languages']
); );
} }
} }
...@@ -220,17 +220,17 @@ class MessageController extends Controller ...@@ -220,17 +220,17 @@ class MessageController extends Controller
->delete($sourceMessageTable, ['in', 'id', $obsolete])->execute(); ->delete($sourceMessageTable, ['in', 'id', $obsolete])->execute();
echo "deleted.\n"; echo "deleted.\n";
} else { } else {
$last_id = $db->getLastInsertID(); $last_id = $db->getLastInsertID();
$db->createCommand() $db->createCommand()
->update( ->update(
$sourceMessageTable, $sourceMessageTable,
['message' => new \yii\db\Expression("CONCAT('@@',message,'@@')")], ['message' => new \yii\db\Expression("CONCAT('@@',message,'@@')")],
['in', 'id', $obsolete] ['in', 'id', $obsolete]
)->execute(); )->execute();
foreach ($languages as $language) { foreach ($languages as $language) {
$db->createCommand() $db->createCommand()
->insert($messageTable, ['id' => $last_id, 'language' => $language])->execute(); ->insert($messageTable, ['id' => $last_id, 'language' => $language])->execute();
} }
echo "updated.\n"; echo "updated.\n";
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment