SproutCMS

This is the code documentation for the SproutCMS project

class Replication

Functions for database replication.
I guess it could be used for cluster situations too.

This default class has replication disabled.
To enable, replace this class with your own.

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-05
**/
class NewClassName extends Replication {
    
    /**
    * Return the IP address or hostname of the write server to use
    **/
    public function getWriteHost () {
        // Method code goes here
    }
    
    /**
    * Return the IP address or hostname of the read server to use
    **/
    public function getReadHost () {
        // Method code goes here
    }
    
    /**
    * Handle replication of a file to other servers.
    * This is always called, even if replication is not enabled above.
    **/
    public function postFileUpdate (string $filename) {
        // Method code goes here
    }
    
    /**
    * Checks we are using the correct server for admin.
    * 
    * Return false if the server is correct
    * Return the URL to redirect to if the server is incorrect.
    **/
    public function adminUrl () {
        // Method code goes here
    }
    
    public function enabled () {
        // Method code goes here
    }
    
}
?>