From 1d3304001c00b17deb8a6e6505870efccf3f1287 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Mon, 8 Mar 2021 13:21:18 +0200 Subject: [PATCH] Fix edge case: FS_CHMOD_DIR is undefined --- wptt-webfont-loader.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wptt-webfont-loader.php b/wptt-webfont-loader.php index b96a660..f475d72 100644 --- a/wptt-webfont-loader.php +++ b/wptt-webfont-loader.php @@ -283,6 +283,10 @@ public function get_local_files_from_css() { $font_files = $this->get_remote_files_from_css(); $stored = get_site_option( 'downloaded_font_files', array() ); $change = false; // If in the end this is true, we need to update the cache option. + + if ( ! defined( 'FS_CHMOD_DIR' ) ) { + define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); + } // If the fonts folder don't exist, create it. if ( ! file_exists( $this->get_fonts_folder() ) ) { @@ -434,6 +438,10 @@ public function get_remote_files_from_css() { protected function write_stylesheet() { $file_path = $this->get_local_stylesheet_path(); $filesystem = $this->get_filesystem(); + + if ( ! defined( 'FS_CHMOD_DIR' ) ) { + define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); + } // If the folder doesn't exist, create it. if ( ! file_exists( $this->get_fonts_folder() ) ) {