Skip to content
Snippets Groups Projects

Issue #3316721: Add script to convert this module into a core merge request

Merged Issue #3316721: Add script to convert this module into a core merge request
2 unresolved threads
2 unresolved threads
2 files
+ 12
15
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 11
15
@@ -92,11 +92,7 @@ class Converter {
$fs->rename("$core_module_path/package_manager", $core_dir . "/core/modules/package_manager");
self::info('Move package manager');
static::addWordsToDictionary($core_dir, [
'syncer',
'syncers',
'unwritable',
]);
static::addWordsToDictionary($core_dir, $core_dir . "/core/modules/auto_updates/dictionary.txt");
self::info("Added to dictionary");
static::runCoreChecks($core_dir);
self::info('Ran core checks');
@@ -304,20 +300,20 @@ class Converter {
*
* @param string $core_dir
* The path to the root of Drupal Core.
* @param array $new_words
* An array of new words.
* @param string $dict_file_to_merge
* The path to the dictionary file with additional words.
*/
private static function addWordsToDictionary(string $core_dir, array $new_words): void {
private static function addWordsToDictionary(string $core_dir, string $dict_file_to_merge): void {
if (!file_exists($dict_file_to_merge)) {
throw new \LogicException(sprintf('%s does not exist', $dict_file_to_merge));
}
$dict_file = $core_dir . '/core/misc/cspell/dictionary.txt';
$contents = file_get_contents($dict_file);
$words = explode("\n", $contents);
$words = array_filter($words);
foreach ($new_words as $new_word) {
if (array_search($new_word, $words)) {
continue;
}
$words[] = $new_word;
}
$new_words = explode("\n", file_get_contents($dict_file_to_merge));
$words = array_merge($words, $new_words);
$words = array_unique($words);
asort($words);
file_put_contents($dict_file, implode("\n", $words));
}
@@ -328,7 +324,7 @@ class Converter {
* @param string $core_dir
* The path to the root of Drupal Core.
*/
private static function runCoreChecks(string $core_dir):void {
private static function runCoreChecks(string $core_dir): void {
chdir($core_dir);
$result = NULL;
system(' sh ./core/scripts/dev/commit-code-check.sh --branch 9.5.x', $result);
Loading