| 
<?php/*
 * ***************************************************************************************************
 *
 * File name: dbConnSettings.php
 *
 * Copyright © 2017 Alessandro Quintiliani
 *
 * This file is part of MultiDump package.
 *
 * MultiDump is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MultiDump is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MultiDump package. If not, see <http://www.gnu.org/licenses/>.
 *
 * ***************************************************************************************************
 
 USAGE:
 *
 * suppose you have several mysql databases to dump, such as:
 *
 * dbone, dbtwo, dbthree, dbfour
 *
 * and all of these databases are installed on the same server (or also different servers), having the same credentials:
 * hostname: my.hostdb.com   (or, as the same, its IP address, i.e. 10.20.30.40)
 * port: 3307 (not the mysql default port)
 * login: mylogin2db
 * password: mypasswd2db
 *
 *
 *
 *
 * 1) set in the file dbConnSettings.php the connection parameters to each database to dump.
 *    The order you set the parameters is not relevant, except for the call to setTypeDbToDump,
 *    which must always be the first call on a set database connection parameters
 *    IMPORTANT NOTICE: the object reference variable name $odmp must be the same as the instance name of MultiDump()
 *                      in index.php (see $odmp = new MultiDump(); defined in index.php); so if you would like to use another object reference variable name
 *                       such as $myDmpObjRef, you must replace in index.php the variable $odmp with $myDmpObjRef
 *
 * # set connection parameters to dbone mysql database
 * $odmp->setTypeDbToDump('dbone','mysql');            ### THE TYPE OF DATABASE MUST ALWAYS BE THE FIRST PARAMETER TO SET
 * $odmp->setHostDbToDump('dbone','my.hostdb.com');  ( or, similarly, $odmp ->setHostDbToDump('dbone','10.20.30.40'); )
 * $odmp->setPortDbToDump('dbone', 3307);            ( this method call is not necessary if the db connection refers to the default port )
 * $odmp->setLoginDbToDump('dbone', 'mylogin2db');
 * $odmp->setPasswordDbToDump('dbone', 'mypasswd2db');
 *
 * # set connection parameters to dbtwo mysql database
 * $odmp->setTypeDbToDump('dbtwo','mysql');            ### THE TYPE OF DATABASE MUST ALWAYS BE THE FIRST PARAMETER TO SET
 * $odmp->setHostDbToDump('dbtwo','my.hostdb.com');  ( or, similarly, $odmp->setHostDbToDump('dbtwo','10.20.30.40'); )
 * $odmp->setPortDbToDump('dbtwo', 3307);            ( this method call is not necessary if the db connection refers to the default port )
 * $odmp->setLoginDbToDump('dbtwo', 'mylogin2db');
 * $odmp->setPasswordDbToDump('dbtwo', 'mypasswd2db');
 *
 * # set connection parameters to dbthree mysql database
 * $odmp->setTypeDbToDump('dbthree','mysql');          ### THE TYPE OF DATABASE MUST ALWAYS BE THE FIRST PARAMETER TO SET
 * $odmp->setHostDbToDump('dbthree','my.hostdb.com');  ( or, similarly, $odmp->setHostDbToDump('dbthree','10.20.30.40'); )
 * $odmp->setPortDbToDump('dbthree', 3307);              ( the call on this method is not necessary if the db connection refers to the default port )
 * $odmp->setLoginDbToDump('dbthree', 'mylogin2db');
 * $odmp->setPasswordDbToDump('dbthree', 'mypasswd2db');
 *
 * # set connection parameters to dbfour mysql database
 * $odmp->setTypeDbToDump('dbfour','mysql');             ### THE TYPE OF DATABASE MUST ALWAYS BE THE FIRST PARAMETER TO SET
 * $odmp->setHostDbToDump('dbfour','my.hostdb.com');  ( or, similarly, $odmp->setHostDbToDump('dbfour','10.20.30.40'); )
 * $odmp->setPortDbToDump('dbfour', 3307);             ( the call on this method is not necessary if the db connection refers to the default port )
 * $odmp->setLoginDbToDump('dbfour', 'mylogin2db');
 * $odmp->setPasswordDbToDump('dbfour', 'mypasswd2db');
 *
 *
 * 2) (optional) if you want to exclude some tables from dump, i.e.:
 *    - alpha, beta from dbtwo database
 *    - gamma, delta, epsilon from dbfour database
 *
 *    you must call the method
 *
 *        setListExcludedTables(<dbname>, <array tables to exclude from dump>)
 *
 *    where:
 *    - <dbname> is a string with the database name whose tables you want to exclude from dump are referring to
 *    - <array tables to exclude from dump> is an array containing the table names you want to exclude from dump
 *      (the order you list the tables in the array is not relevant)
 *
 *    thus:
 *
 *    $odmp->setListExcludedTables('dbtwo', array('alpha','beta'));
 *    $odmp->setListExcludedTables('dbfour', array('gamma','delta','epsilon'));
 *
 *    (you can change the order of the calls to setListExcludedTables for each database)
 *
 *
 * 3) (optional) if you want to dump some tables, i.e.:
 *    - zeta, eta, theta from dbone database
 *    - iota, kappa from dbfour database
 *
 *    at each run and not only when their content/structure have changed, you must call the method
 *
 *        setListForcedDumpTables(<dbname>, <array forced dump tables>|-1)
 *
 *    where:
 *    - <dbname> is a string with the database name referring to the tables you want to dump at each run
 *    - <array forced dump tables>) is an array containing the tablenames you want to dump at each run
 *      (the order you list the tables in the array is not relevant)
 *    - value -1 forces the dump to all the tables of a database
 *
 *    $odmp->setListForcedDumpTables('dbone', array('zeta','eta','theta'));
 *    $odmp->setListForcedDumpTables('dbfour', array('iota','kappa'));
 *
 *    (you can change the order of the calls to setListForcedDumpTables for each database)
 *
 *    if you want to dump at each run all the tables from a database, the second argument must be -1.
 *    So if you want to dump all the tables from i.e. dbthree database, you must call
 *
 *    $odmp->setListForcedDumpTables('dbthree', -1);
 *
 *
 *    IMPORTANT NOTICE ON CALLS 2) AND 3):
 *
 *      the excluded tables always have priority on the forced dump tables, independently whether you first call
 *      setListExcludedTables() or setListForcedDumpTables().
 *      So, if you want to force the dump of a table (i.e. my_important_table) at each run from mydb database, you call
 *
 *      $odmp->setListForcedDumpTables('mydb', array('my_important_table'));
 *
 *      but if you accidentally place my_important_table also in the array of the excluded tables, that is
 *
 *      $odmp->setListExcludedTables('mydb', array('no_important_table','my_important_table'));
 *
 *      my_important_table will be excluded from dumping instead of being dumped from mydb database
 *      at each run of the script
 *
 *
 *  4) launch index.php
 */
 
 
 
 |