[#944582] Also check for files directory executable permission
6 unresolved threads
Closes #944582
Merge request reports
Activity
737 /** 738 * Determines if a directory is writable by the web server. 739 * 740 * PHP's is_writable() does not fully support stream wrappers, so this 741 * function fills that gap. 742 * In order to be able to write files within the directory, the directory 743 * itself must be writable, and it must also have the executable bit set. This 744 * helper function checks both at the same time. 745 * 746 * @param string $uri 747 * A URI or pathname pointing to the directory that will be checked. 748 * 749 * @return bool 750 * TRUE if the directory is writable and executable; FALSE otherwise. 751 */ 752 public function isWritable($uri) { 339 339 // Make the parent dir writable if need be and create the dir. 340 340 if (!is_dir($directory)) { 341 341 $parent_dir = dirname($directory); 342 if (!is_writable($parent_dir)) { 342 if (!\Drupal::service('file_system')->isWritable($parent_dir)) { 77 77 */ 78 78 public function buildForm(array $form, FormStateInterface $form_state) { 79 79 $directory = $this->settings->get('config_sync_directory'); 80 $directory_is_writable = is_writable($directory); 80 $directory_is_writable = \Drupal::service('file_system')->isWritable($directory); 23 23 if ($phase == 'install') { 24 24 $destination = 'public://media-icons/generic'; 25 25 \Drupal::service('file_system')->prepareDirectory($destination, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); 26 $is_writable = is_writable($destination); 26 $is_writable = \Drupal::service('file_system')->isWritable($destination); 859 859 if ($phase == 'install') { 860 860 \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); 861 861 } 862 $is_writable = is_writable($directory); 862 $is_writable = \Drupal::service('file_system')->isWritable($directory);
Please register or sign in to reply