diff --git a/src/Config/ConfigBit.php b/src/Config/ConfigBit.php index 60d29e14cdd1e78f6018e14649dea112acfb1913..c70fad41298c9303aabb248aff99d3a890d5f424 100644 --- a/src/Config/ConfigBit.php +++ b/src/Config/ConfigBit.php @@ -3,7 +3,6 @@ namespace Drupal\varbase\config; use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Filesystem\Filesystem; /** * Defines config bit to help in managing custom config which used in install. @@ -64,8 +63,7 @@ class ConfigBit { public static function doWeHaveThisConfigBit($config_bit_file_name, $type = 'profile', $project = 'varbase') { // Generate full path to config file $full_config_bit_file_name = drupal_get_path($type, $project) . '/' . $config_bit_file_name; - $fs = new Filesystem(); - return $fs->exists($full_config_bit_file_name); + return file_exists($full_config_bit_file_name); } /** diff --git a/src/Form/AssemblerForm.php b/src/Form/AssemblerForm.php index fc3b2fc5c33749f362d6c81c83d77bbe9e714395..590466de69a82e8b06a5f671a1bff97896443b30 100644 --- a/src/Form/AssemblerForm.php +++ b/src/Form/AssemblerForm.php @@ -8,8 +8,6 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\varbase\Config\ConfigBit; -use Symfony\Component\Filesystem\Filesystem; -use Drupal\Component\Utility\Bytes; /** * Defines form for selecting extra components for the assembler to install. @@ -141,8 +139,7 @@ class AssemblerForm extends FormBase { if (isset($extra_feature_info['formbit'])) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $extra_feature_info['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { include_once $formbit_file_name; // Add configuration form element in the formbit position. @@ -205,8 +202,7 @@ class AssemblerForm extends FormBase { if (isset($demo_content_info['formbit'])) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $demo_content_info['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { include_once $formbit_file_name; // Add configuration form element in the formbit position. @@ -253,7 +249,7 @@ class AssemblerForm extends FormBase { $extra_feature_info['config_form'] == TRUE) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $extra_feature_info['formbit']; $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { include_once $formbit_file_name; $extra_features_editable_configs = call_user_func_array($extra_feature_key . "_get_editable_config_names", array()); @@ -292,8 +288,7 @@ class AssemblerForm extends FormBase { if (isset($demo_content_info['config_form']) && $demo_content_info['config_form'] == TRUE) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $demo_content_info['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { include_once $formbit_file_name; $demo_content_editable_configs = call_user_func_array($demo_content_key . "_get_editable_config_names", array()); diff --git a/src/Form/DevelopmentToolsAssemblerForm.php b/src/Form/DevelopmentToolsAssemblerForm.php index c7c6cacf224c29dfbce059d74fcc1862828922e5..941fd56077b954e1732bc5d46d621cdf7748f5f4 100644 --- a/src/Form/DevelopmentToolsAssemblerForm.php +++ b/src/Form/DevelopmentToolsAssemblerForm.php @@ -8,8 +8,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\varbase\Config\ConfigBit; -use Symfony\Component\Filesystem\Filesystem; -use Drupal\Component\Utility\Bytes; +use Symfony\Component\Filesystem; /** * Defines form for selecting extra compoennts for the assembler to install. @@ -143,7 +142,7 @@ class DevelopmentToolsAssemblerForm extends FormBase { if (isset($development_tool_info['formbit'])){ $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $development_tool_info['formbit']; $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { include_once $formbit_file_name; // Add configuration form element in the formbit position. @@ -187,8 +186,7 @@ class DevelopmentToolsAssemblerForm extends FormBase { if (isset($development_tool_info['config_form']) && $development_tool_info['config_form'] == TRUE) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $development_tool_info['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { include_once $formbit_file_name; $development_tools_editable_configs = call_user_func_array($development_tool_key . "_get_editable_config_names", array()); diff --git a/src/composer/ScriptHandler.php b/src/composer/ScriptHandler.php index 5de802ed4c8fcf23cc86a1fe0c097567aee1cf9a..43b52036d0cc276c8432a23e778985c230642391 100644 --- a/src/composer/ScriptHandler.php +++ b/src/composer/ScriptHandler.php @@ -107,7 +107,7 @@ class ScriptHandler { */ public static function removeGitDirectories() { $drupal_root = static::getDrupalRoot(getcwd()); - exec('find ' . $drupal_root . ' -name \'.git\' | xargs rm -rf'); + exec("find " . $drupal_root . " -name '.git' | xargs rm -rf"); } /** diff --git a/varbase.profile b/varbase.profile index 56ddcb5063b52540869981609bf113aaec9fe7b4..c63097889cd5e2466bcc875c48a5af8f912695e1 100644 --- a/varbase.profile +++ b/varbase.profile @@ -6,9 +6,7 @@ */ use Drupal\Core\Form\FormStateInterface; -use Symfony\Component\Filesystem\Filesystem; use Drupal\language\Entity\ConfigurableLanguage; -use Drupal\Component\Utility\Bytes; use Drupal\varbase\Config\ConfigBit; use Drupal\varbase\Form\ConfigureMultilingualForm; use Drupal\varbase\Form\AssemblerForm; @@ -133,9 +131,8 @@ function varbase_assemble_extra_components(array &$install_state) { isset($extraFeatures[$extra_feature_key]['formbit'])) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $extraFeatures[$extra_feature_key]['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { // Added the selected extra feature configs to the batch process // with the same function name in the formbit. @@ -185,8 +182,7 @@ function varbase_assemble_extra_components(array &$install_state) { isset($demoContent[$demo_content_key]['formbit'])) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $demoContent[$demo_content_key]['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { // Added the selected development configs to the batch process // with the same function name in the formbit. @@ -253,8 +249,7 @@ function varbase_assemble_development_tools(array &$install_state) { isset($developmentTools[$development_tool_key]['formbit'])) { $formbit_file_name = drupal_get_path('profile', 'varbase') . '/' . $developmentTools[$development_tool_key]['formbit']; - $formbit_file = new Filesystem(); - if ($formbit_file->exists($formbit_file_name)) { + if (file_exists($formbit_file_name)) { // Added the selected development configs to the batch process // with the same function name in the formbit.