LLMS_Install::create_files()

Create files needed by LifterLMS


Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.install.php

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
public static function create_files() {
    $upload_dir = wp_upload_dir();
    $files      = array(
        array(
            'base'    => LLMS_LOG_DIR,
            'file'    => '.htaccess',
            'content' => 'deny from all',
        ),
        array(
            'base'    => LLMS_LOG_DIR,
            'file'    => 'index.html',
            'content' => '',
        ),
        array(
            'base'    => LLMS_TMP_DIR,
            'file'    => '.htaccess',
            'content' => 'deny from all',
        ),
        array(
            'base'    => LLMS_TMP_DIR,
            'file'    => 'index.html',
            'content' => '',
        ),
    );
 
    foreach ( $files as $file ) {
        if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) {
            $file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
            if ( $file_handle ) {
                fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
                fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
            }
        }
    }
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.15.0 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.