File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1717 */
1818class ScriptHandler {
1919
20+ /**
21+ * Default permission for settings.php.
22+ */
23+ private const SETTINGS_FILE_MODE = 0644 ;
24+
25+ /**
26+ * Default permission for public files directory.
27+ */
28+ private const PUBLIC_FILES_DIRECTORY_MODE = 0775 ;
29+
2030 /**
2131 * Creates required Drupal directories and files to ensure proper installation.
2232 *
@@ -65,16 +75,16 @@ public static function createRequiredFiles(Event $event) {
6575 'required ' => TRUE ,
6676 ];
6777 SettingsEditor::rewrite ($ drupalRoot . '/sites/default/settings.php ' , $ settings );
68- $ fs ->chmod ($ drupalRoot . '/sites/default/settings.php ' , 0666 );
69- $ event ->getIO ()->write (" Created a sites/default/settings.php file with chmod 0666 " );
78+ $ fs ->chmod ($ drupalRoot . '/sites/default/settings.php ' , self :: SETTINGS_FILE_MODE );
79+ $ event ->getIO ()->write (sprintf ( ' Created a sites/default/settings.php file with chmod %04o ' , self :: SETTINGS_FILE_MODE ) );
7080 }
7181
72- // Create the files directory with chmod 0777 .
82+ // Create the files directory with group-writable permissions .
7383 if (!$ fs ->exists ($ drupalRoot . '/sites/default/files ' ) && !is_link ($ drupalRoot . '/sites/default/files ' )) {
7484 $ oldmask = umask (0 );
75- $ fs ->mkdir ($ drupalRoot . '/sites/default/files ' , 0777 );
85+ $ fs ->mkdir ($ drupalRoot . '/sites/default/files ' , self :: PUBLIC_FILES_DIRECTORY_MODE );
7686 umask ($ oldmask );
77- $ event ->getIO ()->write (" Created a sites/default/files directory with chmod 0777 " );
87+ $ event ->getIO ()->write (sprintf ( ' Created a sites/default/files directory with chmod %04o ' , self :: PUBLIC_FILES_DIRECTORY_MODE ) );
7888 }
7989 }
8090
You can’t perform that action at this time.
0 commit comments