PluginProbe
Patchstack – WordPress & Plugins Security / trunk
Patchstack – WordPress & Plugins Security vtrunk
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / migrations / v303.php

v303.php in Patchstack – WordPress & Plugins Security trunk, at includes/migrations/v303.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Try to create the mu-plugins folder/file.
4 // No need to do this if it already exists.
5 if ( file_exists( WPMU_PLUGIN_DIR . '/patchstack.php' ) || file_exists( WPMU_PLUGIN_DIR . '/_patchstack.php' )) {
6 update_option('patchstack_db_version', '3.0.3');
7 return;
8 }
9
10 // The mu-plugin does not exist, try to create it.
11 @include_once ABSPATH . 'wp-admin/includes/file.php';
12 $wpfs = WP_Filesystem();
13
14 // Failed to initialize WP_Filesystem.
15 if ( ! $wpfs ) {
16 update_option('patchstack_db_version', '3.0.3');
17 return;
18 }
19
20 // Try to create the mu-plugins folder.
21 if ( ! is_dir( WPMU_PLUGIN_DIR ) ) {
22 wp_mkdir_p( WPMU_PLUGIN_DIR );
23 }
24
25 // Failed to create the mu-plugin folder.
26 if ( ! is_dir( WPMU_PLUGIN_DIR ) || ( defined( 'PS_DISABLE_MU' ) && PS_DISABLE_MU ) ) {
27 update_option('patchstack_db_version', '3.0.3');
28 return;
29 }
30
31 // Create the mu-plugin file in the folder.
32 if ( is_writable( WPMU_PLUGIN_DIR ) ) {
33 $php = file_get_contents( trailingslashit( plugin_dir_path( __FILE__ ) ) . '../mu-plugin.php' );
34 file_put_contents( trailingslashit( WPMU_PLUGIN_DIR ) . '_patchstack.php', $php );
35 }
36
37 update_option('patchstack_db_version', '3.0.3');