Issue #1968446 by Gábor Hojtsy: Whitespace fixes in language installer and config install storage.

8.0.x
Alex Pott 2013-04-12 10:31:37 +01:00
parent ca94ae9032
commit 7f6cf775d7
2 changed files with 72 additions and 72 deletions

View File

@ -1483,7 +1483,7 @@ function install_select_language_form($form, &$form_state, $files = array()) {
if (empty($files)) {
$form['help'] = array(
'#markup' => '<p>Translations will be downloaded from the <a href="http://localize.drupal.org">Drupal Translation website</a>. ' .
'If you do not want this, select <em>English</em> and continue the installation. For more information, see the <a href="http://drupal.org/documentation/install">online handbook</a>.</p>',
'If you do not want this, select <em>English</em> and continue the installation. For more information, see the <a href="http://drupal.org/documentation/install">online handbook</a>.</p>',
);
}
$form['actions'] = array('#type' => 'actions');
@ -1992,7 +1992,7 @@ function install_check_translations($install_state) {
// If the translations directory is not readable, throw an error.
if (!$readable) {
$requirements['translations directory readable'] = array(
'title' => st('Translations directory'),
'title' => st('Translations directory'),
'value' => st('The translations directory is not readable.'),
'severity' => REQUIREMENT_ERROR,
'description' => st('The installer requires read permissions to %translations_directory at all times. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
@ -2001,7 +2001,7 @@ function install_check_translations($install_state) {
// If translations directory is not writable, throw an error.
if (!$writable) {
$requirements['translations directory writable'] = array(
'title' => st('Translations directory'),
'title' => st('Translations directory'),
'value' => st('The translations directory is not writable.'),
'severity' => REQUIREMENT_ERROR,
'description' => st('The installer requires write permissions to %translations_directory during the installation process. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
@ -2009,7 +2009,7 @@ function install_check_translations($install_state) {
}
else {
$requirements['translations directory writable'] = array(
'title' => st('Translations directory'),
'title' => st('Translations directory'),
'value' => st('The translations directory is writable.'),
);
}
@ -2033,7 +2033,7 @@ function install_check_translations($install_state) {
// error.
if (!$translation_available) {
$requirements['translation available'] = array(
'title' => st('Translation'),
'title' => st('Translation'),
'value' => st('The %language translation is not available.', array('%language' => $language)),
'severity' => REQUIREMENT_ERROR,
'description' => st('The %language translation file is not available at the translation server. <a href="!url">Choose a different language</a> or select English and translate your website later.', array('%language' => $language, '!url' => check_url($_SERVER['SCRIPT_NAME']))),
@ -2041,7 +2041,7 @@ function install_check_translations($install_state) {
}
else {
$requirements['translation available'] = array(
'title' => st('Translation'),
'title' => st('Translation'),
'value' => st('The %language translation is available.', array('%language' => $language)),
);
}
@ -2052,7 +2052,7 @@ function install_check_translations($install_state) {
if (!$translation_downloaded) {
$requirements['translation downloaded'] = array(
'title' => st('Translation'),
'title' => st('Translation'),
'value' => st('The %language translation could not be downloaded.', array('%language' => $language)),
'severity' => REQUIREMENT_ERROR,
'description' => st('The %language translation file could not be downloaded. <a href="!url">Choose a different language</a> or select English and translate your website later.', array('%language' => $language, '!url' => check_url($_SERVER['SCRIPT_NAME']))),

View File

@ -87,77 +87,77 @@ class InstallStorage extends FileStorage {
* Implements Drupal\Core\Config\StorageInterface::listAll().
*/
public function listAll($prefix = '') {
$names = array_keys($this->getAllFolders());
if (!$prefix) {
return $names;
}
else {
$return = array();
foreach ($names as $index => $name) {
if (strpos($name, $prefix) === 0 ) {
$return[$index] = $names[$index];
}
}
return $return;
}
$names = array_keys($this->getAllFolders());
if (!$prefix) {
return $names;
}
/**
* Returns a map of all config object names and their folders.
*
* @return array
* An array mapping config object names with directories.
*/
protected function getAllFolders() {
if (!isset($this->folders)) {
$this->folders = $this->getComponentNames('profile', array(drupal_get_profile()));
$this->folders += $this->getComponentNames('module', array_keys(drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0)));
$this->folders += $this->getComponentNames('theme', array_keys(drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', 'themes')));
}
return $this->folders;
}
/**
* Get all configuration names and folders for a list of modules or themes.
*
* @param string $type
* Type of components: 'module' | 'theme' | 'profile'
* @param array $list
* Array of theme or module names.
*
* @return array
* Folders indexed by configuration name.
*/
protected function getComponentNames($type, array $list) {
$extension = '.' . $this->getFileExtension();
$folders = array();
foreach ($list as $name) {
$directory = $this->getComponentFolder($type, $name);
if (file_exists($directory)) {
$files = glob($directory . '/*' . $extension);
foreach ($files as $filename) {
$name = basename($filename, $extension);
$folders[$name] = $directory;
}
else {
$return = array();
foreach ($names as $index => $name) {
if (strpos($name, $prefix) === 0 ) {
$return[$index] = $names[$index];
}
}
return $folders;
return $return;
}
}
/**
* Get folder inside each component that contains the files.
*
* @param string $type
* Component type: 'module' | 'theme' | 'profile'
* @param string $name
* Component name.
*
* @return string
* The configuration folder name for this component.
*/
protected function getComponentFolder($type, $name) {
return drupal_get_path($type, $name) . '/config';
/**
* Returns a map of all config object names and their folders.
*
* @return array
* An array mapping config object names with directories.
*/
protected function getAllFolders() {
if (!isset($this->folders)) {
$this->folders = $this->getComponentNames('profile', array(drupal_get_profile()));
$this->folders += $this->getComponentNames('module', array_keys(drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.module$/', 'modules', 'name', 0)));
$this->folders += $this->getComponentNames('theme', array_keys(drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info$/', 'themes')));
}
return $this->folders;
}
/**
* Get all configuration names and folders for a list of modules or themes.
*
* @param string $type
* Type of components: 'module' | 'theme' | 'profile'
* @param array $list
* Array of theme or module names.
*
* @return array
* Folders indexed by configuration name.
*/
public function getComponentNames($type, array $list) {
$extension = '.' . $this->getFileExtension();
$folders = array();
foreach ($list as $name) {
$directory = $this->getComponentFolder($type, $name);
if (file_exists($directory)) {
$files = glob($directory . '/*' . $extension);
foreach ($files as $filename) {
$name = basename($filename, $extension);
$folders[$name] = $directory;
}
}
}
return $folders;
}
/**
* Get folder inside each component that contains the files.
*
* @param string $type
* Component type: 'module' | 'theme' | 'profile'
* @param string $name
* Component name.
*
* @return string
* The configuration folder name for this component.
*/
protected function getComponentFolder($type, $name) {
return drupal_get_path($type, $name) . '/config';
}
/**
* Overrides Drupal\Core\Config\FileStorage::deleteAll().