Пример #1
0
 /**
  * Runs activation function and sets up default WP options for new blog,
  * a.k.a. when a registered user creates a new blog
  *
  * @param int $blog_id
  * @param int $user_id
  *
  * @see add_action( 'wpmu_new_blog', ... )
  */
 function wpmuNewBlog($blog_id, $user_id)
 {
     $this->blog_id = (int) $blog_id;
     $this->user_id = (int) $user_id;
     switch_to_blog($this->blog_id);
     if (!$this->isBookSetup()) {
         $this->wpmuActivate();
         array_walk($this->opts, function ($v, $k) {
             if (empty($v)) {
                 delete_option($k);
             } else {
                 update_option($k, $v);
             }
         });
         wp_cache_flush();
     }
     // Set current metadata version to skip redundant upgrade routines
     update_option('pressbooks_metadata_version', \Pressbooks\Metadata::$currentVersion);
     flush_rewrite_rules(false);
     do_action('pressbooks_new_blog');
     restore_current_blog();
     if (is_user_logged_in()) {
         (new \Pressbooks\Catalog())->deleteCache();
         \Pressbooks\Redirect\location(get_admin_url($this->blog_id));
     }
 }
 /**
  * {@inheritdoc}
  * @param array $args
  * * zip - file path
  * * dir - where the zip file will be extract
  */
 public function execute(array $args, array $state = array())
 {
     if (!isset($args['zip'])) {
         return new WP_Error('no_zip', __('Zip file not specified', 'fw'));
     } else {
         $args['zip'] = fw_fix_path($args['zip']);
     }
     if (!isset($args['dir'])) {
         return new WP_Error('no_dir', __('Destination dir not specified', 'fw'));
     } else {
         $args['dir'] = fw_fix_path($args['dir']);
     }
     if (empty($state)) {
         if (!fw_ext_backups_is_dir_empty($args['dir'])) {
             return new WP_Error('destination_not_empty', __('Destination dir is not empty', 'fw'));
         }
         $state = array('entry' => '', 'extracted_files' => 0);
     }
     wp_cache_flush();
     FW_Cache::clear();
     if (is_wp_error($extract_result = fw_ext_backups_unzip_partial($args['zip'], $args['dir'], $state['entry']))) {
         return $extract_result;
     } else {
         if ($extract_result['finished']) {
             return true;
         } else {
             $state['entry'] = $extract_result['last_entry'];
             $state['extracted_files'] += $extract_result['extracted_files'];
             return $state;
         }
     }
 }
/**
 * Clear all transients cache for product data.
 *
 * @param int $post_id (default: 0)
 */
function wc_delete_product_transients($post_id = 0)
{
    global $wpdb;
    if (wp_using_ext_object_cache()) {
        wp_cache_flush();
        // There isn't a reliable method of looking up the names, so flush the cache.
        return;
    }
    $post_id = absint($post_id);
    // Clear core transients
    $transients_to_clear = array('wc_products_onsale', 'wc_hidden_product_ids', 'wc_hidden_product_ids_search', 'wc_attribute_taxonomies', 'wc_term_counts', 'wc_featured_products');
    // Clear transients for which we don't have the name
    $wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE ('_transient_wc_uf_pid_%') OR `option_name` LIKE ('_transient_timeout_wc_uf_pid_%')");
    $wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE ('_transient_wc_ln_count_%') OR `option_name` LIKE ('_transient_timeout_wc_ln_count_%')");
    $wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE ('_transient_wc_ship_%') OR `option_name` LIKE ('_transient_timeout_wc_ship_%')");
    $wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE ('_transient_wc_products_will_display_%') OR `option_name` LIKE ('_transient_timeout_wc_products_will_display_%')");
    // Clear product specific transients
    $post_transient_names = array('wc_product_children_ids_', 'wc_product_total_stock_', 'wc_average_rating_', 'wc_rating_count_');
    if ($post_id > 0) {
        foreach ($post_transient_names as $transient) {
            $transients_to_clear[] = $transient . $post_id;
        }
    } else {
        foreach ($post_transient_names as $transient) {
            $wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE %s OR `option_name` LIKE %s", '_transient_' . $transient . '%', '_transient_timeout_' . $transient . '%'));
        }
    }
    // Delete transients
    foreach ($transients_to_clear as $transient) {
        delete_transient($transient);
    }
    do_action('woocommerce_delete_product_transients', $post_id);
}
Пример #4
0
 public function isTriggered()
 {
     $flusher =& $_REQUEST['bf-flusher'];
     $nonce =& $_REQUEST['_wpnonce'];
     // Don't do anything if we don't see a flush request or the user is not an administrator
     if (!isset($flusher) || !current_user_can('administrator')) {
         return;
     }
     // Verify the nonce security token. If not valid die with permission denied
     if (!isset($nonce) || !wp_verify_nonce($nonce, 'flush_' . $flusher)) {
         wp_die(esc_html__('Permission Denied', 'bfflusher'));
     }
     // Which flush action are we to perform?
     switch ($flusher) {
         case 'permalinks':
             flush_rewrite_rules();
             break;
         case 'object-cache':
             function_exists('wp_cache_flush_site') ? wp_cache_flush_site() : wp_cache_flush();
             break;
     }
     // Safe redirect to the page that the user originally came from.
     wp_safe_redirect($_SERVER['HTTP_REFERER']);
     die;
 }
Пример #5
0
 /**
  * Import settings via WP-CFM
  */
 public function import()
 {
     $app = Bootstrap::getApplication();
     $helpers = $app['helpers'];
     $baseUrl = get_option('siteurl');
     $src = WPBOOT_BASEPATH . '/bootstrap/config/wpbootstrap.json';
     $trg = $app['path'] . '/wp-content/config/wpbootstrap.json';
     if (file_exists($src)) {
         @mkdir(dirname($trg), 0777, true);
         copy($src, $trg);
         // deneutralize
         $settings = json_decode(file_get_contents($trg));
         $helpers->fieldSearchReplace($settings, Bootstrap::NEUTRALURL, $baseUrl);
         file_put_contents($trg, $helpers->prettyPrint(json_encode($settings)));
         if (function_exists('WPCFM')) {
             WPCFM()->readwrite->pull_bundle('wpbootstrap');
         } else {
             $cli = $app['cli'];
             $cli->warning('Plugin WP-CFM does not seem to be installed. No options imported.');
             $cli->warning('Add the WP-CFM plugin directly to this install using:');
             $cli->warning('$ wp plugin install wp-cfm --activate');
             $cli->warning('');
             $cli->warning('...or to your appsettings using:');
             $cli->warning('$ wp bootstrap add plugin wp-cfm');
             $cli->warning('$ wp bootstrap setup');
             return;
         }
         // Flush options to make sure no other code overwrites based
         // on old settings stored in cache
         wp_cache_flush();
     }
 }
Пример #6
0
function wp_dlm_clear_cached_stuff()
{
    delete_transient('dlm_categories');
    delete_transient('dlm_tags');
    delete_transient('dlm_used_tags');
    wp_cache_flush();
}
 public function testItForwardsWPPostFields()
 {
     // Given I have a random post
     $posts = get_posts();
     $this->assertNotNull($posts);
     $this->assertNotEmpty($posts);
     $this->assertNotInstanceOf('\\WP_Error', $posts);
     /** @var \WP_Post $post */
     $post = current($posts);
     $this->assertNotNull($post);
     $this->assertNotEquals(0, $post->ID);
     $this->assertInstanceOf('\\WP_Post', $post);
     // And I turn it into a comfort post
     $comfort_post = new Simple_Post($post->ID);
     // And the meta key has no value
     $meta_key = uniqid('some_meta_');
     $this->assertEmpty($post->{$meta_key});
     $this->assertEmpty($comfort_post->{$meta_key});
     // And I fill the meta entity
     $meta_value = uniqid('some_value_');
     update_post_meta($post->ID, $meta_key, $meta_value);
     // When I fetch the meta value via WP_Post
     wp_cache_flush();
     $this->assertEquals($meta_value, $post->{$meta_key});
     // Then It should equal the comfort post meta value
     wp_cache_flush();
     $this->assertEquals($meta_value, $comfort_post->{$meta_key});
 }
function wpurp_shortcode_generator_user_menu_authors()
{
    $menu_authors = array();
    $menu_author_ids = array();
    // Get all menus one by one
    $limit = 100;
    $offset = 0;
    while (true) {
        $args = array('post_type' => 'menu', 'post_status' => array('publish', 'private'), 'posts_per_page' => $limit, 'offset' => $offset);
        $query = new WP_Query($args);
        if (!$query->have_posts()) {
            break;
        }
        $posts = $query->posts;
        foreach ($posts as $post) {
            $id = $post->ID;
            $author = $post->post_author;
            if (!in_array($author, $menu_author_ids)) {
                $menu_author_ids[] = $author;
                $user = get_userdata($author);
                $name = $user ? $user->display_name : __('n/a', 'wp-ultimate-recipe');
                $menu_authors[] = array('value' => $author, 'label' => $name);
            }
            wp_cache_delete($id, 'posts');
            wp_cache_delete($id, 'post_meta');
        }
        $offset += $limit;
        wp_cache_flush();
    }
    return $menu_authors;
}
Пример #9
0
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    global $wpdb;
    $base = '/';
    $domain = JQUERY_STAGING_PREFIX . 'jquery.com';
    wp_check_mysql_version();
    wp_cache_flush();
    make_db_current_silent();
    populate_options();
    populate_roles();
    $user_id = wp_create_user($user_name, trim($user_password), $user_email);
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    $guess_url = wp_guess_url();
    foreach ($wpdb->tables('ms_global') as $table => $prefixed_table) {
        $wpdb->{$table} = $prefixed_table;
    }
    install_network();
    populate_network(1, $domain, $user_email, 'jQuery Network', $base, false);
    update_site_option('site_admins', array($user->user_login));
    update_site_option('allowedthemes', array());
    $wpdb->insert($wpdb->blogs, array('site_id' => 1, 'domain' => $domain, 'path' => $base, 'registered' => current_time('mysql')));
    $blog_id = $wpdb->insert_id;
    update_user_meta($user_id, 'source_domain', $domain);
    update_user_meta($user_id, 'primary_blog', $blog_id);
    if (!($upload_path = get_option('upload_path'))) {
        $upload_path = substr(WP_CONTENT_DIR, strlen(ABSPATH)) . '/uploads';
        update_option('upload_path', $upload_path);
    }
    update_option('fileupload_url', get_option('siteurl') . '/' . $upload_path);
    jquery_install_remaining_sites($user);
    wp_new_blog_notification($blog_title, $guess_url, $user_id, $message = __('The password you chose during the install.'));
    wp_cache_flush();
    return array('url' => $guess_url, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}
 /**
  * {@inheritdoc}
  */
 public function writeItem(array $item)
 {
     // Try to locate an existing post
     $post = $this->findExisting($item);
     if ($post && !$this->replace) {
         // If it exists and the overwrite flag is off, skip processing
         return $this;
     } elseif (!$post && $this->addNew) {
         // Otherwise, if the add-new flag is set, initialize a new post object
         $post = new \WP_Post((object) ['post_title' => '(Untitled)', 'post_type' => $this->getPostType(), 'post_status' => 'publish']);
     }
     if (!$post instanceof \WP_Post) {
         // If we don't have a post object by now, skip the row
         return $this;
     }
     // Clear meta field and term queues
     $this->metaFields = [];
     $this->terms = [];
     // Build the post and queue meta fields and terms
     $this->buildPost($post, $item)->buildMetaFields($post, $item)->buildTerms($post, $item);
     // Save the post
     $ID = $this->savePost($post);
     $post = get_post($ID);
     if (!$post) {
         $this->throwException('Post could not be saved.');
     }
     // Save meta fields and terms
     $this->saveMetaFields($post)->saveTerms($post);
     // Flush the cache
     wp_cache_flush();
     return $this;
 }
Пример #11
0
 public function db($command = '', $args = '')
 {
     if (count($command) == 1 && reset($command) == 'help') {
         return $this->db_help();
     }
     $defaults = array('host' => defined('IMPORT_DB_HOST') ? IMPORT_DB_HOST : DB_HOST, 'user' => defined('IMPORT_DB_USER') ? IMPORT_DB_USER : DB_USER, 'password' => defined('IMPORT_DB_PASSWORD') ? IMPORT_DB_PASSWORD : '', 'name' => defined('IMPORT_DB_NAME') ? IMPORT_DB_NAME : '', 'port' => '3306', 'ssh_host' => defined('IMPORT_DB_SSH_HOST') ? IMPORT_DB_SSH_HOST : '', 'ssh_user' => defined('IMPORT_DB_SSH_USER') ? IMPORT_DB_SSH_USER : '', 'table' => '');
     $args = wp_parse_args($args, $defaults);
     $start_time = time();
     if ($args['ssh_host']) {
         shell_exec(sprintf("ssh -f -L 3308:%s:%s %s@%s sleep 600 >> logfile", $args['host'], $args['port'], $args['ssh_user'], $args['ssh_host']));
         $args['host'] = '127.0.0.1';
         $args['port'] = '3308';
     }
     WP_CLI::line('Importing database from ' . $args['host'] . '...' . ($args['ssh_host'] ? ' via ssh tunnel: ' . $args['ssh_host'] : ''));
     $password = $args['password'] ? '--password='******'password']) : '';
     // TODO pipe through sed or interconnectIT's search replace script
     if (defined('IMPORT_DB_REMOTE_ABSPATH')) {
         $sed = " | sed s," . trailingslashit(IMPORT_DB_REMOTE_ABSPATH) . "," . ABSPATH . ",g";
     } else {
         $sed = '';
     }
     if ($args['site']) {
         $args['table'] = "wp_{$args['site']}_commentmeta wp_{$args['site']}_comments wp_{$args['site']}_links wp_{$args['site']}_options wp_{$args['site']}_postmeta wp_{$args['site']}_posts wp_{$args['site']}_term_relationships wp_{$args['site']}_term_taxonomy wp_{$args['site']}_terms";
     }
     $exec = sprintf('mysqldump --verbose --host=%s --user=%s %s -P %s %s %s %s | mysql --host=%s --user=%s --password=%s %s', $args['host'], $args['user'], $password, $args['port'], $args['name'], $args['table'], $sed, DB_HOST, DB_USER, escapeshellarg(DB_PASSWORD), DB_NAME);
     WP_CLI::line('Running: ' . $exec);
     WP_CLI::launch($exec);
     WP_CLI::success(sprintf('Finished. Took %d seconds', time() - $start_time));
     wp_cache_flush();
 }
Пример #12
0
 function ThemeToolkit($theme, $array, $file)
 {
     global $wp_version;
     // is it WP 2.0+ and do we have plugins like "../themes/foo/functions.php" running ?
     if ($wp_version >= 2 and count(@preg_grep('#^\\.\\./themes/[^/]+/functions.php$#', get_settings('active_plugins'))) > 0) {
         wp_cache_flush();
         $this->upgrade_toolkit();
     }
     $this->infos['path'] = '../themes/' . basename(dirname($file));
     /* Create some vars needed if an admin menu is to be printed */
     if ($array['debug']) {
         if (basename($file) == $_GET['page']) {
             $this->infos['debug'] = 1;
         }
         unset($array['debug']);
     }
     if (basename($file) == $_GET['page']) {
         $this->infos['menu_options'] = $array;
         $this->infos['classname'] = $theme;
     }
     $this->option = array();
     /* Check this file is registered as a plugin, do it if needed */
     $this->pluginification();
     /* Get infos about the theme and particularly its 'shortname'
      * which is used to name the entry in wp_options where data are stored */
     $this->do_init();
     /* Read data from options table */
     $this->read_options();
     /* Are we in the admin area ? Add a menu then ! */
     $this->file = $file;
     add_action('admin_menu', array(&$this, 'add_menu'));
 }
 public function clear_session_transients()
 {
     global $wpdb;
     $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_twccr_" . session_id() . "%'");
     $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_twccr_" . session_id() . "%'");
     wp_cache_flush();
 }
 public function import($fp)
 {
     list($table, $view) = $this->db->query_schema();
     array_map(array($this->db, 'drop_table'), $table);
     array_map(array($this->db, 'drop_view'), $view);
     $this->db->foreach_statement($fp, array($this->db, 'query'));
     wp_cache_flush();
 }
Пример #15
0
 /**
  * Merge all duplicate event-related posts
  *
  * @return void
  */
 public function merge_duplicates()
 {
     $this->merge_identical_organizers();
     $this->merge_identical_venues();
     $events = TribeEvents::instance();
     $events->setOption('organizer_venue_amalgamation', 1);
     wp_cache_flush();
 }
Пример #16
0
 /**
  * Flush the object cache.
  */
 public function flush($args, $assoc_args)
 {
     $value = wp_cache_flush();
     if (false === $value) {
         WP_CLI::error('The object cache could not be flushed.');
     }
     WP_CLI::success('The cache was flushed.');
 }
Пример #17
0
    function supernova_page()
    {
        global $supernova_options;
        ?>
        			        
        		<div class="supernova_wrap wrap">
<!--        	<div id="icon-options-general" class="supernova32 icon32"></div>
            	<h2 class="supernova_heading">Supernova <?php 
        _e('Theme Options', 'Supernova');
        ?>
</h2>-->
                    <div id="supernovaoptions">
                        <form action="options.php" method="post" enctype="multipart/form-data" id="supernova_admin_form">
                            <?php 
        settings_fields('supernova_group');
        supernova_writer();
        ?>

                            <?php 
        include SUPERNOVA_ADMIN . 'admin-int.php';
        ?>

                             <div class="submit_sticky">
   		   <p class="supernova-botton-primary">
                       <input type="submit" name="supernova-save" class="button-primary new-button-primary" value="<?php 
        _e('Save Settings', 'Supernova');
        ?>
">
                   </p>
                            </div>
                        </form>
                    </div>
        		</div><!--wrap -->

	<?php 
        if (isset($_POST['truncate'])) {
            global $wpdb;
            delete_option('supernova_settings');
            supernova_writer();
            wp_cache_flush();
            ?>
 
                        <script> //to make sure all fields appear empty to the user on reset </script>
	<?php 
        }
        ?>


    <form action="" method="post">
        <p class="tooltip3 tooltip2">
            <input type="submit" name="truncate" class="button-primary reset_button" value="<?php 
        _e('Reset All', 'Supernova');
        ?>
"  />
       	</p>
    </form>
                        <?php 
    }
function vp_flush_regenerable_options()
{
    wp_cache_flush();
    $taxonomies = get_taxonomies();
    foreach ($taxonomies as $taxonomy) {
        delete_option("{$taxonomy}_children");
        // Regenerate {$taxonomy}_children
        _get_term_hierarchy($taxonomy);
    }
}
 public static function flush() {
   if (self::$filesystem) {
     $files = glob(ABSPATH.'wp-content/cache/fragment-cache/*'); // get all file names
     foreach ($files as $file) { // iterate files
       if (is_file($file)) unlink($file); // delete file
     }      
   } else {
     wp_cache_flush();
   }
 }
Пример #20
0
 function test_update_adds_falsey_value()
 {
     $key = rand_str();
     $value = 0;
     delete_site_option($key);
     $this->assertTrue(update_site_option($key, $value));
     wp_cache_flush();
     // ensure we're getting the value from the DB
     $this->assertEquals($value, get_site_option($key));
 }
 public function clear_session_transients()
 {
     global $wpdb, $woocommerce;
     $session = WC_Catalog_Visibility_Compatibility::WC()->session;
     if (isset($session)) {
         $session_id = WC_Catalog_Visibility_Compatibility::WC()->session->get_customer_id();
         $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_twccr_" . $session_id . "%'");
         $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_twccr_" . $session_id . "%'");
         wp_cache_flush();
     }
 }
Пример #22
0
 function setUp()
 {
     global $gpdb;
     error_reporting(E_ALL);
     $gpdb->query("DROP DATABASE " . GPDB_NAME . ";");
     $gpdb->query("CREATE DATABASE " . GPDB_NAME . ";");
     $gpdb->select(GPDB_NAME, $gpdb->dbh);
     gp_install();
     wp_cache_flush();
     ini_set('display_errors', 1);
 }
Пример #23
0
 /**
  * Performs an upgrade for older versions. Hides the keys so they only show in the plugin's UI
  */
 function maybe_upgrade()
 {
     if (get_option('txfx_plt_schema_version') < 3) {
         global $wpdb;
         $wpdb->query("UPDATE {$wpdb->postmeta} SET meta_key = '_links_to'        WHERE meta_key = 'links_to'        ");
         $wpdb->query("UPDATE {$wpdb->postmeta} SET meta_key = '_links_to_target' WHERE meta_key = 'links_to_target' ");
         $wpdb->query("UPDATE {$wpdb->postmeta} SET meta_key = '_links_to_type'   WHERE meta_key = 'links_to_type'   ");
         wp_cache_flush();
         update_option('txfx_plt_schema_version', 3);
     }
 }
Пример #24
0
 /**
  * Add a new creative
  *
  * @access  public
  * @since   1.2
  */
 public function add($data = array())
 {
     $defaults = array('status' => 'active', 'date' => current_time('mysql'), 'url' => '', 'image' => '');
     $args = wp_parse_args($data, $defaults);
     $add = $this->insert($args, 'creative');
     if ($add) {
         wp_cache_flush();
         do_action('affwp_insert_creative', $add);
         return $add;
     }
     return false;
 }
 /**
  * Performs post-import cleanup of files and the cache
  */
 function import_end()
 {
     wp_import_cleanup($this->id);
     wp_cache_flush();
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     do_action('import_end');
 }
Пример #26
0
		function remove_block_in_place($block_place, $block_ref)
			{
				$block_contents = $this->get_block_contents($block_place);
				if (!in_array($block_ref, $block_contents))
					return true;
				$key = array_search($block_ref, $block_contents);
				unset($block_contents[$key]);
				$this->raw_blocks[$block_place] = $block_contents;
				update_option('hem_blocks', $this->raw_blocks);
				wp_cache_flush(); // I was having caching issues
				return true;
			}
Пример #27
0
function reset_ocmx_options()
{
    global $wpdb, $changes_done;
    //Clear our preset options, because we're gonna add news ones.
    wp_cache_flush();
    parse_str($_POST["data"], $data);
    $update_options = explode(",", $data["update_ocmx"]);
    foreach ($update_options as $option) {
        ocmx_reset_option($option);
    }
    die("");
}
 public function test_properties_are_meta_keys()
 {
     $simple_meta = $this->create_simple_meta_from_post();
     $meta_key = uniqid('sub');
     $meta_val = uniqid('val');
     $this->assertEmpty($simple_meta->{$meta_key});
     $simple_meta->{$meta_key} = $meta_val;
     $this->assertEquals((array) $meta_val, $simple_meta->{$meta_key});
     wp_cache_flush();
     $this->assertEquals((array) $meta_val, get_post_meta($simple_meta->get_facade()->ID, $simple_meta->get_prefix() . '_' . $meta_key));
     unset($simple_meta->{$meta_key});
 }
Пример #29
0
 function flush_cache()
 {
     global $wp_object_cache;
     $wp_object_cache->group_ops = array();
     $wp_object_cache->stats = array();
     $wp_object_cache->memcache_debug = array();
     $wp_object_cache->cache = array();
     if (method_exists($wp_object_cache, '__remoteset')) {
         $wp_object_cache->__remoteset();
     }
     wp_cache_flush();
 }
Пример #30
0
/**
 * This function overrides wp_install() in wp-admin/includes/upgrade.php
 */
function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.6');
    }
    wp_check_mysql_version();
    wp_cache_flush();
    /* changes */
    require_once PDODIR . 'schema.php';
    make_db_sqlite();
    /* changes */
    populate_options();
    populate_roles();
    update_option('blogname', $blog_title);
    update_option('admin_email', $user_email);
    update_option('blog_public', $public);
    $guessurl = wp_guess_url();
    update_option('siteurl', $guessurl);
    if (!$public) {
        update_option('default_pingback_flag', 0);
    }
    $user_id = username_exists($user_name);
    $user_password = trim($user_password);
    $email_password = false;
    if (!$user_id && empty($user_password)) {
        $user_password = wp_generate_password(12, false);
        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
        $user_id = wp_create_user($user_name, $user_password, $user_email);
        update_user_option($user_id, 'default_password_nag', true, true);
        $email_password = true;
    } else {
        if (!$user_id) {
            $message = '<em>' . __('Your chosen password.') . '</em>';
            $user_id = wp_create_user($user_name, $user_password, $user_email);
        }
    }
    $user = new WP_User($user_id);
    $user->set_role('administrator');
    wp_install_defaults($user_id);
    flush_rewrite_rules();
    wp_new_blog_notification($blog_title, $guessurl, $user_id, $email_password ? $user_password : __('The password you chose during the install.'));
    wp_cache_flush();
    if (isset($_SERVER['SERVER_SOFTWARE']) && stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false || isset($_SERVER['SERVER_SIGNATURE']) && stripos($_SERVER['SERVER_SIGNATURE'], 'apache') !== false) {
        // Your server is Apache. Nothing to do more.
    } else {
        $server_message = sprintf('Your webserver doesn\'t seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory %s in some other way.', FQDBDIR);
        echo '<div style="position: absolute; margin-top: 350px; width: 700px; border: .5px dashed rgb(0, 0, 0);"><p style="margin: 10px;">';
        echo $server_message;
        echo '</p></div>';
    }
    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
}