Skip to content

Commit

Permalink
Fix edge case: FS_CHMOD_DIR is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath authored Mar 8, 2021
1 parent b9bce92 commit 1d33040
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wptt-webfont-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) ) {
Expand Down Expand Up @@ -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() ) ) {
Expand Down

0 comments on commit 1d33040

Please sign in to comment.