Exemple #1
0
define('MAX_QUERY_ROWS', 100);
define('MAX_DELETE_RECORDS', 1000);
define('DEPLOY_LOG_FILE', 'oem-import.log');
$currentDir = dirname(__FILE__);
$rootDir = dirname(dirname($currentDir)) . '/';
require $rootDir . 'Vic.php';
$debugSQLDump = isset($_GET['debug_sqldump']) && $_GET['debug_sqldump'];
$debugImitateQuery = isset($_GET['debug_imitateQuery']) && $_GET['debug_imitateQuery'];
$debugDumpSrcData = isset($_GET['debug_dumpSrcData']) && $_GET['debug_dumpSrcData'];
$debugDumpColAssignment = isset($_GET['debug_cols']) && $_GET['debug_cols'];
require_once $currentDir . '/functions.php';
require_once $currentDir . '/Deployer.php';
$deployer = new Deployer();
$deployer->initLog($rootDir . 'var/log/' . DEPLOY_LOG_FILE);
require_once $currentDir . '/creds.php';
if ($deployer->initDb($dbhost, $dbUser, $dbPass, $dbName)) {
    $deployer->logMessage("DB init successful\n");
} else {
    die('DB init not successful');
}
$params = $_GET;
$fileName = $rootDir . ltrim($params['file'], ' /');
$rowsInsertedTotal = 0;
$rowsTotal = 0;
$rowsProcessed = 0;
$rowsProcessedTotal = 0;
$dataString = '';
$deployer->logMessage("Processing {$fileName}");
$handle = fopen($fileName, "rb");
if (false === $handle) {
    $deployer->logMessage("Could not open {$fileName} for reading");