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
1 file
+ 10
10
Compare changes
  • Side-by-side
  • Inline
+ 10
10
@@ -70,12 +70,12 @@ class Converter {
"core_version_requirement: ^9.3" => "package: Core\nversion: VERSION\nlifecycle: experimental",
];
foreach ($replacements as $search => $replace) {
static::renameFiles($search, $replace);
static::replaceContents($search, $replace);
static::renameFiles($core_module_path, $search, $replace);
static::replaceContents($core_module_path, $search, $replace);
}
self::info('Replacements done.');
static::removeLines();
static::removeLines($core_dir);
self::info('Remove unneeded lines');
$fs->rename("$core_module_path/package_manager", $core_dir . "/core/modules/package_manager");
self::info('Move package manager');
@@ -114,8 +114,8 @@ class Converter {
* @param string $search
* @param string $replace
*/
private static function replaceContents(string $search, string $replace) {
$files = static::getDirContents(static::getCoreModulePath(), TRUE);
private static function replaceContents(string $core_module_path, string $search, string $replace) {
$files = static::getDirContents($core_module_path, TRUE);
foreach ($files as $file) {
$filePath = $file->getRealPath();
file_put_contents($filePath,str_replace($search,$replace,file_get_contents($filePath)));
@@ -129,9 +129,9 @@ class Converter {
* @param string $old_pattern
* @param string $new_pattern
*/
private static function renameFiles(string $old_pattern, string $new_pattern) {
private static function renameFiles(string $core_module_path, string $old_pattern, string $new_pattern) {
$files = static::getDirContents(static::getCoreModulePath());
$files = static::getDirContents($core_module_path);
// Keep a record of the files and directories to change.
// We will change all the files first so we don't change the location of any
@@ -231,7 +231,7 @@ class Converter {
* The core merge request branch.
*/
private static function switchToBranches(string $core_dir, string $core_branch) {
static::switchToBranch('8.x-2.x');
//static::switchToBranch('8.x-2.x');
chdir($core_dir);
static::switchToBranch($core_branch);
}
@@ -295,8 +295,8 @@ class Converter {
*
* @throws \Exception
*/
private static function removeLines() {
$files = static::getDirContents(static::getCoreModulePath(), TRUE);
private static function removeLines(string $core_dir) {
$files = static::getDirContents(static::getCoreModulePath($core_dir), TRUE);
foreach ($files as $file) {
$filePath = $file->getRealPath();
$contents = file_get_contents($filePath);
Loading