Ejemplo n.º 1
0
if (isset($_POST['id'])) {
    $id = $_POST['id'];
}
G::LoadClass('languages');
G::LoadSystem('database_mysql');
$aUpgradeData = unserialize(file_get_contents(PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin"));
$aWorkspaces = $aUpgradeData['workspaces'];
if (is_array($aWorkspaces) && count($aWorkspaces) > 0) {
    $workspace = array_shift($aUpgradeData['workspaces']);
    eval(getDatabaseCredentials(PATH_DB . $workspace . PATH_SEP . 'db.php'));
    $oDataBase = new database($DB_ADAPTER, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
    $oDataBase->iFetchType = MYSQL_NUM;
    //processing .po file
    if ($aUpgradeData['sPoFile'] != '') {
        $oLanguages = new languages();
        $oLanguages->importLanguage($aUpgradeData['sPoFile'], $aUpgradeData['bForceXmlPoFile']);
        $aUpgradeData['bForceXmlPoFile'] = false;
    }
    if ($aUpgradeData['sSchemaFile'] != '') {
        processMasterSchemaFile($aUpgradeData['sSchemaFile']);
    }
    //draw a gauge control indicating the progress in workspaces
    $gauge = intval(($aUpgradeData['wsQuantity'] - count($aWorkspaces) + 1) / $aUpgradeData['wsQuantity'] * 301);
    print "<table cellpadding=0><tr><td><img src='/images/ajax-loader.gif' border=0/></td><td>";
    print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";
    print "<div style='color:#FFF; height:16px; text-align:center; padding-top:3px; background-image: url(/skins/green/images/bm.jpg); background-repeat: repeat-x; width: {$gauge}px' ></div> </div>";
    print "</td><td width='40%'><font color=black> Upgrading the workspace </font><b><font color=green>{$workspace}</font></b></td><td width=250 align=right>| {$id} Remaining</td></tr></table>";
    file_put_contents(PATH_DATA . 'log' . PATH_SEP . "upgrade.data.bin", serialize($aUpgradeData));
} else {
    print "<table cellpadding=0><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>";
    print "<div style='border-style:solid;border-width:1px; border-color: #A1C868; width:300px; height:19px;' >";