Commit 2436298a authored by xjm's avatar xjm

Issue #2055851 by andypost, jungle, dawehner, Mac_Weber, sja112, borisson_,...

Issue #2055851 by andypost, jungle, dawehner, Mac_Weber, sja112, borisson_, fietserwin, init90, Gábor Hojtsy, xjm, effulgentsia, tim.plunkett: Remove translation of exception messages
parent e0c17813
...@@ -1240,7 +1240,7 @@ function install_select_profile(&$install_state) { ...@@ -1240,7 +1240,7 @@ function install_select_profile(&$install_state) {
else { else {
// The non-interactive installer requires a profile parameter. // The non-interactive installer requires a profile parameter.
if (!$install_state['interactive']) { if (!$install_state['interactive']) {
throw new InstallerException(t('Missing profile parameter.')); throw new InstallerException('Missing profile parameter.');
} }
// Otherwise, display a form to select a profile. // Otherwise, display a form to select a profile.
return install_get_form('Drupal\Core\Installer\Form\SelectProfileForm', $install_state); return install_get_form('Drupal\Core\Installer\Form\SelectProfileForm', $install_state);
...@@ -1385,7 +1385,7 @@ function install_select_language(&$install_state) { ...@@ -1385,7 +1385,7 @@ function install_select_language(&$install_state) {
return; return;
} }
else { else {
throw new InstallerException(t('You must select a language to continue the installation.')); throw new InstallerException('You must select a language to continue the installation.');
} }
} }
} }
......
...@@ -375,7 +375,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { ...@@ -375,7 +375,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) {
// Write the new settings file. // Write the new settings file.
if (file_put_contents($settings_file, $buffer) === FALSE) { if (file_put_contents($settings_file, $buffer) === FALSE) {
throw new Exception(t('Failed to modify %settings. Verify the file permissions.', ['%settings' => $settings_file])); throw new Exception("Failed to modify '$settings_file'. Verify the file permissions.");
} }
else { else {
// In case any $settings variables were written, import them into the // In case any $settings variables were written, import them into the
...@@ -392,7 +392,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) { ...@@ -392,7 +392,7 @@ function drupal_rewrite_settings($settings = [], $settings_file = NULL) {
} }
} }
else { else {
throw new Exception(t('Failed to open %settings. Verify the file permissions.', ['%settings' => $settings_file])); throw new Exception("Failed to open '$settings_file'. Verify the file permissions.");
} }
} }
......
...@@ -174,7 +174,7 @@ function update_set_schema($module, $schema_version) { ...@@ -174,7 +174,7 @@ function update_set_schema($module, $schema_version) {
* example: * example:
* @code * @code
* use Drupal\Core\Utility\UpdateException; * use Drupal\Core\Utility\UpdateException;
* throw new UpdateException(t('Description of what went wrong')); * throw new UpdateException('Description of what went wrong');
* @endcode * @endcode
* *
* If an exception is thrown, the current update and all updates that depend on * If an exception is thrown, the current update and all updates that depend on
......
...@@ -29,7 +29,7 @@ class Zip implements ArchiverInterface { ...@@ -29,7 +29,7 @@ class Zip implements ArchiverInterface {
public function __construct($file_path) { public function __construct($file_path) {
$this->zip = new \ZipArchive(); $this->zip = new \ZipArchive();
if ($this->zip->open($file_path) !== TRUE) { if ($this->zip->open($file_path) !== TRUE) {
throw new ArchiverException(t('Cannot open %file_path', ['%file_path' => $file_path])); throw new ArchiverException("Cannot open '$file_path'");
} }
} }
......
...@@ -377,10 +377,10 @@ protected function createKeySql($fields) { ...@@ -377,10 +377,10 @@ protected function createKeySql($fields) {
*/ */
public function renameTable($table, $new_name) { public function renameTable($table, $new_name) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot rename @table to @table_new: table @table doesn't exist.", ['@table' => $table, '@table_new' => $new_name])); throw new SchemaObjectDoesNotExistException("Cannot rename '$table' to '$new_name': table '$table' doesn't exist.");
} }
if ($this->tableExists($new_name)) { if ($this->tableExists($new_name)) {
throw new SchemaObjectExistsException(t("Cannot rename @table to @table_new: table @table_new already exists.", ['@table' => $table, '@table_new' => $new_name])); throw new SchemaObjectExistsException("Cannot rename '$table' to '$new_name': table '$new_name' already exists.");
} }
$info = $this->getPrefixInfo($new_name); $info = $this->getPrefixInfo($new_name);
...@@ -404,10 +404,10 @@ public function dropTable($table) { ...@@ -404,10 +404,10 @@ public function dropTable($table) {
*/ */
public function addField($table, $field, $spec, $keys_new = []) { public function addField($table, $field, $spec, $keys_new = []) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add field @table.@field: table doesn't exist.", ['@field' => $field, '@table' => $table])); throw new SchemaObjectDoesNotExistException("Cannot add field '$table.$field': table doesn't exist.");
} }
if ($this->fieldExists($table, $field)) { if ($this->fieldExists($table, $field)) {
throw new SchemaObjectExistsException(t("Cannot add field @table.@field: field already exists.", ['@field' => $field, '@table' => $table])); throw new SchemaObjectExistsException("Cannot add field '$table.$field': field already exists.");
} }
// Fields that are part of a PRIMARY KEY must be added as NOT NULL. // Fields that are part of a PRIMARY KEY must be added as NOT NULL.
...@@ -497,10 +497,10 @@ public function indexExists($table, $name) { ...@@ -497,10 +497,10 @@ public function indexExists($table, $name) {
*/ */
public function addPrimaryKey($table, $fields) { public function addPrimaryKey($table, $fields) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add primary key to table @table: table doesn't exist.", ['@table' => $table])); throw new SchemaObjectDoesNotExistException("Cannot add primary key to table '$table': table doesn't exist.");
} }
if ($this->indexExists($table, 'PRIMARY')) { if ($this->indexExists($table, 'PRIMARY')) {
throw new SchemaObjectExistsException(t("Cannot add primary key to table @table: primary key already exists.", ['@table' => $table])); throw new SchemaObjectExistsException("Cannot add primary key to table '$table': primary key already exists.");
} }
$this->connection->query('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . $this->createKeySql($fields) . ')'); $this->connection->query('ALTER TABLE {' . $table . '} ADD PRIMARY KEY (' . $this->createKeySql($fields) . ')');
...@@ -534,10 +534,10 @@ protected function findPrimaryKeyColumns($table) { ...@@ -534,10 +534,10 @@ protected function findPrimaryKeyColumns($table) {
*/ */
public function addUniqueKey($table, $name, $fields) { public function addUniqueKey($table, $name, $fields) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add unique key @name to table @table: table doesn't exist.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectDoesNotExistException("Cannot add unique key '$name' to table '$table': table doesn't exist.");
} }
if ($this->indexExists($table, $name)) { if ($this->indexExists($table, $name)) {
throw new SchemaObjectExistsException(t("Cannot add unique key @name to table @table: unique key already exists.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectExistsException("Cannot add unique key '$name' to table '$table': unique key already exists.");
} }
$this->connection->query('ALTER TABLE {' . $table . '} ADD UNIQUE KEY `' . $name . '` (' . $this->createKeySql($fields) . ')'); $this->connection->query('ALTER TABLE {' . $table . '} ADD UNIQUE KEY `' . $name . '` (' . $this->createKeySql($fields) . ')');
...@@ -560,10 +560,10 @@ public function dropUniqueKey($table, $name) { ...@@ -560,10 +560,10 @@ public function dropUniqueKey($table, $name) {
*/ */
public function addIndex($table, $name, $fields, array $spec) { public function addIndex($table, $name, $fields, array $spec) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add index @name to table @table: table doesn't exist.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectDoesNotExistException("Cannot add index '$name' to table '$table': table doesn't exist.");
} }
if ($this->indexExists($table, $name)) { if ($this->indexExists($table, $name)) {
throw new SchemaObjectExistsException(t("Cannot add index @name to table @table: index already exists.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectExistsException("Cannot add index '$name' to table '$table': index already exists.");
} }
$spec['indexes'][$name] = $fields; $spec['indexes'][$name] = $fields;
...@@ -619,10 +619,10 @@ protected function introspectIndexSchema($table) { ...@@ -619,10 +619,10 @@ protected function introspectIndexSchema($table) {
*/ */
public function changeField($table, $field, $field_new, $spec, $keys_new = []) { public function changeField($table, $field, $field_new, $spec, $keys_new = []) {
if (!$this->fieldExists($table, $field)) { if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot change the definition of field @table.@name: field doesn't exist.", ['@table' => $table, '@name' => $field])); throw new SchemaObjectDoesNotExistException("Cannot change the definition of field '$table.$field': field doesn't exist.");
} }
if (($field != $field_new) && $this->fieldExists($table, $field_new)) { if (($field != $field_new) && $this->fieldExists($table, $field_new)) {
throw new SchemaObjectExistsException(t("Cannot rename field @table.@name to @name_new: target field already exists.", ['@table' => $table, '@name' => $field, '@name_new' => $field_new])); throw new SchemaObjectExistsException("Cannot rename field '$table.$field' to '$field_new': target field already exists.");
} }
if (isset($keys_new['primary key']) && in_array($field_new, $keys_new['primary key'], TRUE)) { if (isset($keys_new['primary key']) && in_array($field_new, $keys_new['primary key'], TRUE)) {
$this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field_new => $spec]); $this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field_new => $spec]);
......
...@@ -543,10 +543,10 @@ public function findTables($table_expression) { ...@@ -543,10 +543,10 @@ public function findTables($table_expression) {
*/ */
public function renameTable($table, $new_name) { public function renameTable($table, $new_name) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot rename @table to @table_new: table @table doesn't exist.", ['@table' => $table, '@table_new' => $new_name])); throw new SchemaObjectDoesNotExistException("Cannot rename '$table' to '$new_name': table '$table' doesn't exist.");
} }
if ($this->tableExists($new_name)) { if ($this->tableExists($new_name)) {
throw new SchemaObjectExistsException(t("Cannot rename @table to @table_new: table @table_new already exists.", ['@table' => $table, '@table_new' => $new_name])); throw new SchemaObjectExistsException("Cannot rename '$table' to '$new_name': table '$new_name' already exists.");
} }
// Get the schema and tablename for the old table. // Get the schema and tablename for the old table.
...@@ -623,10 +623,10 @@ public function dropTable($table) { ...@@ -623,10 +623,10 @@ public function dropTable($table) {
*/ */
public function addField($table, $field, $spec, $new_keys = []) { public function addField($table, $field, $spec, $new_keys = []) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add field @table.@field: table doesn't exist.", ['@field' => $field, '@table' => $table])); throw new SchemaObjectDoesNotExistException("Cannot add field '$table.$field': table doesn't exist.");
} }
if ($this->fieldExists($table, $field)) { if ($this->fieldExists($table, $field)) {
throw new SchemaObjectExistsException(t("Cannot add field @table.@field: field already exists.", ['@field' => $field, '@table' => $table])); throw new SchemaObjectExistsException("Cannot add field '$table.$field': field already exists.");
} }
// Fields that are part of a PRIMARY KEY must be added as NOT NULL. // Fields that are part of a PRIMARY KEY must be added as NOT NULL.
...@@ -750,10 +750,10 @@ public function constraintExists($table, $name) { ...@@ -750,10 +750,10 @@ public function constraintExists($table, $name) {
*/ */
public function addPrimaryKey($table, $fields) { public function addPrimaryKey($table, $fields) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add primary key to table @table: table doesn't exist.", ['@table' => $table])); throw new SchemaObjectDoesNotExistException("Cannot add primary key to table '$table': table doesn't exist.");
} }
if ($this->constraintExists($table, 'pkey')) { if ($this->constraintExists($table, 'pkey')) {
throw new SchemaObjectExistsException(t("Cannot add primary key to table @table: primary key already exists.", ['@table' => $table])); throw new SchemaObjectExistsException("Cannot add primary key to table '$table': primary key already exists.");
} }
$this->connection->query('ALTER TABLE {' . $table . '} ADD CONSTRAINT ' . $this->ensureIdentifiersLength($table, '', 'pkey') . ' PRIMARY KEY (' . $this->createPrimaryKeySql($fields) . ')'); $this->connection->query('ALTER TABLE {' . $table . '} ADD CONSTRAINT ' . $this->ensureIdentifiersLength($table, '', 'pkey') . ' PRIMARY KEY (' . $this->createPrimaryKeySql($fields) . ')');
...@@ -788,10 +788,10 @@ protected function findPrimaryKeyColumns($table) { ...@@ -788,10 +788,10 @@ protected function findPrimaryKeyColumns($table) {
*/ */
public function addUniqueKey($table, $name, $fields) { public function addUniqueKey($table, $name, $fields) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add unique key @name to table @table: table doesn't exist.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectDoesNotExistException("Cannot add unique key '$name' to table '$table': table doesn't exist.");
} }
if ($this->constraintExists($table, $name . '__key')) { if ($this->constraintExists($table, $name . '__key')) {
throw new SchemaObjectExistsException(t("Cannot add unique key @name to table @table: unique key already exists.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectExistsException("Cannot add unique key '$name' to table '$table': unique key already exists.");
} }
$this->connection->query('ALTER TABLE {' . $table . '} ADD CONSTRAINT ' . $this->ensureIdentifiersLength($table, $name, 'key') . ' UNIQUE (' . implode(',', $fields) . ')'); $this->connection->query('ALTER TABLE {' . $table . '} ADD CONSTRAINT ' . $this->ensureIdentifiersLength($table, $name, 'key') . ' UNIQUE (' . implode(',', $fields) . ')');
...@@ -816,10 +816,10 @@ public function dropUniqueKey($table, $name) { ...@@ -816,10 +816,10 @@ public function dropUniqueKey($table, $name) {
*/ */
public function addIndex($table, $name, $fields, array $spec) { public function addIndex($table, $name, $fields, array $spec) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add index @name to table @table: table doesn't exist.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectDoesNotExistException("Cannot add index '$name' to table '$table': table doesn't exist.");
} }
if ($this->indexExists($table, $name)) { if ($this->indexExists($table, $name)) {
throw new SchemaObjectExistsException(t("Cannot add index @name to table @table: index already exists.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectExistsException("Cannot add index '$name' to table '$table': index already exists.");
} }
$this->connection->query($this->_createIndexSql($table, $name, $fields)); $this->connection->query($this->_createIndexSql($table, $name, $fields));
...@@ -878,10 +878,10 @@ protected function introspectIndexSchema($table) { ...@@ -878,10 +878,10 @@ protected function introspectIndexSchema($table) {
*/ */
public function changeField($table, $field, $field_new, $spec, $new_keys = []) { public function changeField($table, $field, $field_new, $spec, $new_keys = []) {
if (!$this->fieldExists($table, $field)) { if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot change the definition of field @table.@name: field doesn't exist.", ['@table' => $table, '@name' => $field])); throw new SchemaObjectDoesNotExistException("Cannot change the definition of field '$table.$field': field doesn't exist.");
} }
if (($field != $field_new) && $this->fieldExists($table, $field_new)) { if (($field != $field_new) && $this->fieldExists($table, $field_new)) {
throw new SchemaObjectExistsException(t("Cannot rename field @table.@name to @name_new: target field already exists.", ['@table' => $table, '@name' => $field, '@name_new' => $field_new])); throw new SchemaObjectExistsException("Cannot rename field '$table.$field' to '$field_new': target field already exists.");
} }
if (isset($new_keys['primary key']) && in_array($field_new, $new_keys['primary key'], TRUE)) { if (isset($new_keys['primary key']) && in_array($field_new, $new_keys['primary key'], TRUE)) {
$this->ensureNotNullPrimaryKey($new_keys['primary key'], [$field_new => $spec]); $this->ensureNotNullPrimaryKey($new_keys['primary key'], [$field_new => $spec]);
......
...@@ -263,10 +263,10 @@ public function getFieldTypeMap() { ...@@ -263,10 +263,10 @@ public function getFieldTypeMap() {
*/ */
public function renameTable($table, $new_name) { public function renameTable($table, $new_name) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot rename @table to @table_new: table @table doesn't exist.", ['@table' => $table, '@table_new' => $new_name])); throw new SchemaObjectDoesNotExistException("Cannot rename '$table' to '$new_name': table '$table' doesn't exist.");
} }
if ($this->tableExists($new_name)) { if ($this->tableExists($new_name)) {
throw new SchemaObjectExistsException(t("Cannot rename @table to @table_new: table @table_new already exists.", ['@table' => $table, '@table_new' => $new_name])); throw new SchemaObjectExistsException("Cannot rename '$table' to '$new_name': table '$new_name' already exists.");
} }
$schema = $this->introspectSchema($table); $schema = $this->introspectSchema($table);
...@@ -315,10 +315,10 @@ public function dropTable($table) { ...@@ -315,10 +315,10 @@ public function dropTable($table) {
*/ */
public function addField($table, $field, $specification, $keys_new = []) { public function addField($table, $field, $specification, $keys_new = []) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add field @table.@field: table doesn't exist.", ['@field' => $field, '@table' => $table])); throw new SchemaObjectDoesNotExistException("Cannot add field '$table.$field': table doesn't exist.");
} }
if ($this->fieldExists($table, $field)) { if ($this->fieldExists($table, $field)) {
throw new SchemaObjectExistsException(t("Cannot add field @table.@field: field already exists.", ['@field' => $field, '@table' => $table])); throw new SchemaObjectExistsException("Cannot add field '$table.$field': field already exists.");
} }
if (isset($keys_new['primary key']) && in_array($field, $keys_new['primary key'], TRUE)) { if (isset($keys_new['primary key']) && in_array($field, $keys_new['primary key'], TRUE)) {
$this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field => $specification]); $this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field => $specification]);
...@@ -587,10 +587,10 @@ public function dropField($table, $field) { ...@@ -587,10 +587,10 @@ public function dropField($table, $field) {
*/ */
public function changeField($table, $field, $field_new, $spec, $keys_new = []) { public function changeField($table, $field, $field_new, $spec, $keys_new = []) {
if (!$this->fieldExists($table, $field)) { if (!$this->fieldExists($table, $field)) {
throw new SchemaObjectDoesNotExistException(t("Cannot change the definition of field @table.@name: field doesn't exist.", ['@table' => $table, '@name' => $field])); throw new SchemaObjectDoesNotExistException("Cannot change the definition of field '$table.$field': field doesn't exist.");
} }
if (($field != $field_new) && $this->fieldExists($table, $field_new)) { if (($field != $field_new) && $this->fieldExists($table, $field_new)) {
throw new SchemaObjectExistsException(t("Cannot rename field @table.@name to @name_new: target field already exists.", ['@table' => $table, '@name' => $field, '@name_new' => $field_new])); throw new SchemaObjectExistsException("Cannot rename field '$table.$field' to '$field_new': target field already exists.");
} }
if (isset($keys_new['primary key']) && in_array($field_new, $keys_new['primary key'], TRUE)) { if (isset($keys_new['primary key']) && in_array($field_new, $keys_new['primary key'], TRUE)) {
$this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field_new => $spec]); $this->ensureNotNullPrimaryKey($keys_new['primary key'], [$field_new => $spec]);
...@@ -660,10 +660,10 @@ protected function mapKeyDefinition(array $key_definition, array $mapping) { ...@@ -660,10 +660,10 @@ protected function mapKeyDefinition(array $key_definition, array $mapping) {
*/ */
public function addIndex($table, $name, $fields, array $spec) { public function addIndex($table, $name, $fields, array $spec) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add index @name to table @table: table doesn't exist.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectDoesNotExistException("Cannot add index '$name' to table '$table': table doesn't exist.");
} }
if ($this->indexExists($table, $name)) { if ($this->indexExists($table, $name)) {
throw new SchemaObjectExistsException(t("Cannot add index @name to table @table: index already exists.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectExistsException("Cannot add index '$name' to table '$table': index already exists.");
} }
$schema['indexes'][$name] = $fields; $schema['indexes'][$name] = $fields;
...@@ -701,10 +701,10 @@ public function dropIndex($table, $name) { ...@@ -701,10 +701,10 @@ public function dropIndex($table, $name) {
*/ */
public function addUniqueKey($table, $name, $fields) { public function addUniqueKey($table, $name, $fields) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add unique key @name to table @table: table doesn't exist.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectDoesNotExistException("Cannot add unique key '$name' to table '$table': table doesn't exist.");
} }
if ($this->indexExists($table, $name)) { if ($this->indexExists($table, $name)) {
throw new SchemaObjectExistsException(t("Cannot add unique key @name to table @table: unique key already exists.", ['@table' => $table, '@name' => $name])); throw new SchemaObjectExistsException("Cannot add unique key '$name' to table '$table': unique key already exists.");
} }
$schema['unique keys'][$name] = $fields; $schema['unique keys'][$name] = $fields;
...@@ -733,14 +733,14 @@ public function dropUniqueKey($table, $name) { ...@@ -733,14 +733,14 @@ public function dropUniqueKey($table, $name) {
*/ */
public function addPrimaryKey($table, $fields) { public function addPrimaryKey($table, $fields) {
if (!$this->tableExists($table)) { if (!$this->tableExists($table)) {
throw new SchemaObjectDoesNotExistException(t("Cannot add primary key to table @table: table doesn't exist.", ['@table' => $table])); throw new SchemaObjectDoesNotExistException("Cannot add primary key to table '$table': table doesn't exist.");
} }
$old_schema = $this->introspectSchema($table); $old_schema = $this->introspectSchema($table);
$new_schema = $old_schema; $new_schema = $old_schema;
if (!empty($new_schema['primary key'])) { if (!empty($new_schema['primary key'])) {
throw new SchemaObjectExistsException(t("Cannot add primary key to table @table: primary key already exists.", ['@table' => $table])); throw new SchemaObjectExistsException("Cannot add primary key to table '$table': primary key already exists.");
} }
$new_schema['primary key'] = $fields; $new_schema['primary key'] = $fields;
......
...@@ -359,7 +359,7 @@ public function execute() { ...@@ -359,7 +359,7 @@ public function execute() {
try { try {
if (!count($this->condition)) { if (!count($this->condition)) {
throw new InvalidMergeQueryException(t('Invalid merge query: no conditions')); throw new InvalidMergeQueryException('Invalid merge query: no conditions');
} }
$select = $this->connection->select($this->conditionTable) $select = $this->connection->select($this->conditionTable)
->condition($this->condition); ->condition($this->condition);
......
...@@ -611,7 +611,7 @@ protected function introspectIndexSchema($table) { ...@@ -611,7 +611,7 @@ protected function introspectIndexSchema($table) {
*/ */
public function createTable($name, $table) { public function createTable($name, $table) {
if ($this->tableExists($name)) { if ($this->tableExists($name)) {
throw new SchemaObjectExistsException(t('Table @name already exists.', ['@name' => $name])); throw new SchemaObjectExistsException("Table '$name' already exists.");
} }
$statements = $this->createTableSql($name, $table); $statements = $this->createTableSql($name, $table);
foreach ($statements as $statement) { foreach ($statements as $statement) {
......
...@@ -168,7 +168,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { ...@@ -168,7 +168,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
$filetransfer = $this->getFiletransfer($backend, $form_connection_settings[$backend]); $filetransfer = $this->getFiletransfer($backend, $form_connection_settings[$backend]);
try { try {
if (!$filetransfer) { if (!$filetransfer) {
throw new \Exception($this->t('The connection protocol %backend does not exist.', ['%backend' => $backend])); throw new \Exception("The connection protocol '$backend' does not exist.");
} }
$filetransfer->connect(); $filetransfer->connect();
} }
......
...@@ -64,7 +64,7 @@ public static function factory($source, $root) { ...@@ -64,7 +64,7 @@ public static function factory($source, $root) {
$updater = self::getUpdaterFromDirectory($source); $updater = self::getUpdaterFromDirectory($source);
} }
else { else {
throw new UpdaterException(t('Unable to determine the type of the source directory.')); throw new UpdaterException('Unable to determine the type of the source directory.');
} }
return new $updater($source, $root); return new $updater($source, $root);
} }
...@@ -89,7 +89,7 @@ public static function getUpdaterFromDirectory($directory) { ...@@ -89,7 +89,7 @@ public static function getUpdaterFromDirectory($directory) {
return $class; return $class;
} }
} }
throw new UpdaterException(t('Cannot determine the type of project.')); throw new UpdaterException('Cannot determine the type of project.');
} }
/** /**
...@@ -142,7 +142,7 @@ protected static function getExtensionInfo($directory) { ...@@ -142,7 +142,7 @@ protected static function getExtensionInfo($directory) {
$info_file = static::findInfoFile($directory); $info_file = static::findInfoFile($directory);
$info = \Drupal::service('info_parser')->parse($info_file); $info = \Drupal::service('info_parser')->parse($info_file);
if (empty($info)) { if (empty($info)) {
throw new UpdaterException(t('Unable to parse info file: %info_file.', ['%info_file' => $info_file])); throw new UpdaterException("Unable to parse info file: '$info_file'.");
} }
return $info; return $info;
...@@ -178,7 +178,7 @@ public static function getProjectTitle($directory) { ...@@ -178,7 +178,7 @@ public static function getProjectTitle($directory) {
$info_file = self::findInfoFile($directory); $info_file = self::findInfoFile($directory);
$info = \Drupal::service('info_parser')->parse($info_file); $info = \Drupal::service('info_parser')->parse($info_file);
if (empty($info)) { if (empty($info)) {
throw new UpdaterException(t('Unable to parse info file: %info_file.', ['%info_file' => $info_file])); throw new UpdaterException("Unable to parse info file: '$info_file'.");
} }
return $info['name']; return $info['name'];
} }
...@@ -228,7 +228,7 @@ public function update(&$filetransfer, $overrides = []) { ...@@ -228,7 +228,7 @@ public function update(&$filetransfer, $overrides = []) {
if (!$this->name) { if (!$this->name) {
// This is bad, don't want to delete the install directory. // This is bad, don't want to delete the install directory.
throw new UpdaterException(t('Fatal error in update, cowardly refusing to wipe out the install directory.')); throw new UpdaterException('Fatal error in update, cowardly refusing to wipe out the install directory.');
} }
// Make sure the installation parent directory exists and is writable. // Make sure the installation parent directory exists and is writable.
...@@ -253,7 +253,7 @@ public function update(&$filetransfer, $overrides = []) { ...@@ -253,7 +253,7 @@ public function update(&$filetransfer, $overrides = []) {
return $this->postUpdateTasks(); return $this->postUpdateTasks();
} }
catch (FileTransferException $e) { catch (FileTransferException $e) {
throw new UpdaterFileTransferException(t('File Transfer failed, reason: @reason', ['@reason' => strtr($e->getMessage(), $e->arguments)])); throw new UpdaterFileTransferException("File Transfer failed, reason: '" . strtr($e->getMessage(), $e->arguments) . "'");
} }
} }
...@@ -291,7 +291,7 @@ public function install(&$filetransfer, $overrides = []) { ...@@ -291,7 +291,7 @@ public function install(&$filetransfer, $overrides = []) {
return $this->postInstallTasks(); return $this->postInstallTasks();
} }
catch (FileTransferException $e) { catch (FileTransferException $e) {
throw new UpdaterFileTransferException(t('File Transfer failed, reason: @reason', ['@reason' => strtr($e->getMessage(), $e->arguments)])); throw new UpdaterFileTransferException("File Transfer failed, reason: '" . strtr($e->getMessage(), $e->arguments)) . "'";
} }
} }
......
...@@ -62,12 +62,12 @@ public static function create(ContainerInterface $container) { ...@@ -62,12 +62,12 @@ public static function create(ContainerInterface $container) {