Skip to content
Snippets Groups Projects
Select Git revision
  • 4eb287822511b6957bcea144e4ed39bfc8d467b2
  • master default protected
2 results

README.md

Blame
  • db-config.php 847 B
    <?php
    
    // Common settings
    $wpdb->persistent = true;
    $wpdb->max_connections = 30;
    
    define("NOBLOGS_BACKEND_CONFIG", "/etc/noblogs/backends");
    define("NOBLOGS_MASTER_CONFIG", "/etc/noblogs/master");
    
    include_once('r2db/db-hash.php');
    include_once('r2db/db-backends.php');
    
    // Add the global database (configured in wp-config.php), stores the global
    // blogs and users tables.
    
    // This is the read-only slave.
    $wpdb->add_database(array(
        "host" => DB_HOST,
        "user" => DB_USER,
        "password" => DB_PASSWORD,
        "name" => DB_NAME,
        "dataset" => "global",
        "write" => 0, "read" => 1, "timeout" => 2
        ));
    
    // This is the write-only master.
    $wpdb->add_database(noblogs_load_master(NOBLOGS_MASTER_CONFIG));
    
    // Add all the sharded blog databases.
    $wpdb_reverse_backend_map = noblogs_load_backends(NOBLOGS_BACKEND_CONFIG, $wpdb->hash_map);