delete( $destination ); } } // Place database drop-in if not present yet, except in case there is // another database drop-in present already. if ( ! defined( 'SQLITE_DB_DROPIN_VERSION' ) && ! file_exists( $destination ) ) { // Init the filesystem to allow copying the file. global $wp_filesystem; require_once ABSPATH . '/wp-admin/includes/file.php'; // Init the filesystem if needed, then copy the file, replacing contents as needed. if ( ( $wp_filesystem || WP_Filesystem() ) && $wp_filesystem->touch( $destination ) ) { // Get the db.copy.php file contents, replace placeholders and write it to the destination. $file_contents = str_replace( array( '{SQLITE_IMPLEMENTATION_FOLDER_PATH}', '{SQLITE_PLUGIN}', ), array( __DIR__, str_replace( WP_PLUGIN_DIR . '/', '', SQLITE_MAIN_FILE ), ), file_get_contents( __DIR__ . '/db.copy' ) ); $wp_filesystem->put_contents( $destination, $file_contents ); } } }