11<?php
22
3- /**
4- * @file
5- * Contains \DrupalProject\composer\ScriptHandler.
6- */
7-
83namespace DrupalProject \composer ;
94
105use Composer \Script \Event ;
149use DrupalFinder \DrupalFinderComposerRuntime ;
1510use Symfony \Component \Filesystem \Filesystem ;
1611
12+ /**
13+ *
14+ */
1715class ScriptHandler {
1816
17+ /**
18+ * @param \Composer\Script\Event $event
19+ *
20+ * @return void
21+ */
1922 public static function createRequiredFiles (Event $ event ) {
2023 $ fs = new Filesystem ();
2124 $ drupalFinder = new DrupalFinderComposerRuntime ();
@@ -32,15 +35,15 @@ public static function createRequiredFiles(Event $event) {
3235 'themes ' ,
3336 ];
3437
35- // Required for unit testing
38+ // Required for unit testing.
3639 foreach ($ dirs as $ dir ) {
37- if (!$ fs ->exists ($ drupalRoot . '/ ' . $ dir )) {
38- $ fs ->mkdir ($ drupalRoot . '/ ' . $ dir );
39- $ fs ->touch ($ drupalRoot . '/ ' . $ dir . '/.gitkeep ' );
40+ if (!$ fs ->exists ($ drupalRoot . '/ ' . $ dir )) {
41+ $ fs ->mkdir ($ drupalRoot . '/ ' . $ dir );
42+ $ fs ->touch ($ drupalRoot . '/ ' . $ dir . '/.gitkeep ' );
4043 }
4144 }
4245
43- // Prepare the settings file for installation
46+ // Prepare the settings file for installation.
4447 if (!$ fs ->exists ($ drupalRoot . '/sites/default/settings.php ' ) && $ fs ->exists ($ drupalRoot . '/sites/default/default.settings.php ' )) {
4548 $ fs ->copy ($ drupalRoot . '/sites/default/default.settings.php ' , $ drupalRoot . '/sites/default/settings.php ' );
4649 require_once $ drupalRoot . '/core/includes/bootstrap.inc ' ;
@@ -55,7 +58,7 @@ public static function createRequiredFiles(Event $event) {
5558 $ event ->getIO ()->write ("Created a sites/default/settings.php file with chmod 0666 " );
5659 }
5760
58- // Create the files directory with chmod 0777
61+ // Create the files directory with chmod 0777.
5962 if (!$ fs ->exists ($ drupalRoot . '/sites/default/files ' ) && !is_link ($ drupalRoot . '/sites/default/files ' )) {
6063 $ oldmask = umask (0 );
6164 $ fs ->mkdir ($ drupalRoot . '/sites/default/files ' , 0777 );
0 commit comments