roundcubemail/program/include/rcmail_install.php
public function db_schema_check($db)
    {
        if (!$this->configured) {
            return false;
        }

        // read reference schema from mysql.initial.sql
        $engine    = $db->db_provider;
        $db_schema = $this->db_read_schema(INSTALL_PATH . "SQL/$engine.initial.sql");
        $errors    = array();

        // check list of tables
        $existing_tables = $db->list_tables();

        foreach ($db_schema as $table => $cols) {
            $table = $this->config['db_prefix'] . $table;

            if (!in_array($table, $existing_tables)) {
                $errors[] = "Missing table '".$table."'";
            }
            else {  // compare cols
                $db_cols = $db->list_cols($table);
                $diff    = array_diff(array_keys($cols), $db_cols);

                if (!empty($diff)) {
                    $errors[] = "Missing columns in table '$table': " . join(',', $diff);
                }
            }
        }

        return !empty($errors) ? $errors : false;
    }
public function db_schema_check($db)
    {
        if (!$this->configured) {
            return false;
        }

        // read reference schema from mysql.initial.sql
        $engine    = $db->db_provider;
        $db_schema = $this->db_read_schema(INSTALL_PATH . "SQL/$engine.initial.sql");
        $errors    = array();

        // check list of tables
        $existing_tables = $db->list_tables();

        foreach ($db_schema as $table => $cols) {
            $table = $this->config['db_prefix'] . $table;

            if (!in_array($table, $existing_tables)) {
                $errors[] = "Missing table '".$table."'";
            }
            else {  // compare cols
                $db_cols = $db->list_cols($table);
                $diff    = array_diff(array_keys($cols), $db_cols);

                if (!empty($diff)) {
                    $errors[] = "Missing columns in table '$table': " . join(',', $diff);
                }
            }
        }

        return !empty($errors) ? $errors : false;
    }
public function db_schema_check ( $ db ) { if ( ! $ this -> configured ) { return false ; } // read reference schema from mysql.initial.sql $ engine = $ db -> db_provider ; $ db_schema = $ this -> db_read_schema ( INSTALL_PATH . "SQL/$engine.initial.sql" ) ; $ errors = array ( ) ; // check list of tables $ existing_tables = $ db -> list_tables ( ) ; foreach ( $ db_schema as $ table => $ cols ) { $ table = $ this -> config [ 'db_prefix' ] . $ table ; if ( ! in_array ( $ table , $ existing_tables ) ) { $ errors [ ] = "Missing table '" . $ table . "'" ; } else { // compare cols $ db_cols = $ db -> list_cols ( $ table ) ; $ diff = array_diff ( array_keys ( $ cols ) , $ db_cols ) ; if ( ! empty ( $ diff ) ) { $ errors [ ] = "Missing columns in table '$table': " . join ( ',' , $ diff ) ; } } } return ! empty ( $ errors ) ? $ errors : false ; }
Compare the local database schema with the reference schema
required for this version of Roundcube

@param rcube_db $db Database object

@return boolean True if the schema is up-to-date, false if not or an error occurred
Compare the local database schema with the reference schema required for this version of Roundcube