Skip to content

Commit 26e4391

Browse files
committed
Error from chmod defaults not set in certain cases.
Signed-off-by: Kev Provance <[email protected]>
1 parent f4b0894 commit 26e4391

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

redux-core/inc/classes/class-redux-filesystem.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ public function __construct( bool $force_no_fs = false ) {
111111
require_once ABSPATH . '/wp-admin/includes/file.php';
112112
}
113113

114+
// Set default permissions.
115+
if ( defined( 'FS_CHMOD_DIR' ) ) {
116+
$this->chmod_dir = FS_CHMOD_DIR;
117+
} else {
118+
$this->chmod_dir = ( fileperms( ABSPATH ) & 0777 | 0755 );
119+
}
120+
121+
if ( defined( 'FS_CHMOD_FILE' ) ) {
122+
$this->chmod_file = FS_CHMOD_FILE;
123+
} else {
124+
$this->chmod_file = ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
125+
}
126+
114127
if ( ! $force_no_fs && function_exists( 'request_filesystem_credentials' ) ) {
115128
if ( ( defined( 'WPMDB_WP_FILESYSTEM' ) && WPMDB_WP_FILESYSTEM ) || ! defined( 'WPMDB_WP_FILESYSTEM' ) ) {
116129
$this->maybe_init_wp_filesystem();
@@ -296,20 +309,6 @@ public function execute( string $action, string $file = '', array $params = arra
296309
* @return void
297310
*/
298311
private function generate_default_files() {
299-
300-
// Set default permissions.
301-
if ( defined( 'FS_CHMOD_DIR' ) ) {
302-
$this->chmod_dir = FS_CHMOD_DIR;
303-
} else {
304-
$this->chmod_dir = ( fileperms( ABSPATH ) & 0777 | 0755 );
305-
}
306-
307-
if ( defined( 'FS_CHMOD_FILE' ) ) {
308-
$this->chmod_file = FS_CHMOD_FILE;
309-
} else {
310-
$this->chmod_file = ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 );
311-
}
312-
313312
if ( ! $this->is_dir( Redux_Core::$upload_dir ) ) {
314313
$this->mkdir( Redux_Core::$upload_dir );
315314
}

0 commit comments

Comments
 (0)