Ejemplo n.º 1
0
 if (!($aTableInfo['shared'] && count($aTargets) < $nPossibleTargets) && $tAlter > $tAlterMax) {
     lovd_showInfoTable('Please note that the time estimated to remove this column from the ' . $aTableInfo['table_name'] . ' data table is <B>' . round($tAlter) . ' seconds</B>.<BR>During this time, no updates to the data table are possible. If other users are trying to update information in the database during this time, they will have to wait a long time, or get an error.', 'warning');
 }
 require ROOT_PATH . 'class/progress_bar.php';
 // This already puts the progress bar on the screen.
 $_BAR = new ProgressBar('', $sMessage);
 $_T->printFooter(false);
 // The false prevents the footer to actually close the <BODY> and <HTML> tags.
 // Now we're still in the <BODY> so the progress bar can add <SCRIPT> tags as much as it wants.
 flush();
 // Now, end with ALTER TABLE if necessary, since that will take the longest time and ends a transaction anyway.
 if (!$aTableInfo['shared']) {
     // Query text; remove column registration first.
     $sQ = 'DELETE FROM ' . TABLE_ACTIVE_COLS . ' WHERE colid = ?';
     $_DB->query($sQ, array($zData['id']));
     $_BAR->setProgress(20);
     $_BAR->setMessage('Removing column...');
     // The whole transaction stuff is useless here; alter table will commit and there's just one query before that.
     // Alter data table.
     $sQ = 'ALTER TABLE ' . $aTableInfo['table_sql'] . ' DROP COLUMN `' . $zData['id'] . '`';
     $_DB->query($sQ);
     $sMessage = 'Removed column ' . $zData['colid'] . ' (' . $zData['head_column'] . ')';
 } else {
     // Query text; remove column registration first.
     $sObject = $aTableInfo['unit'] . 'id';
     $_DB->beginTransaction();
     $sQ = 'DELETE FROM ' . TABLE_SHARED_COLS . ' WHERE ' . $sObject . ' IN (?' . str_repeat(', ?', count($aTargets) - 1) . ') AND colid = ?';
     $aQ = array_merge($aTargets, array($zData['id']));
     $_DB->query($sQ, $aQ);
     $_DB->commit();
     $_BAR->setProgress(10);
Ejemplo n.º 2
0
                 $sMessage = 'Error during uninstallation while running query.<BR>I ran:<DIV class="err">' . str_replace(array("\r\n", "\r", "\n"), '<BR>', $sSQL) . '</DIV><BR>I got:<DIV class="err">' . str_replace(array("\r\n", "\r", "\n"), '<BR>', $_DB->formatError()) . '</DIV><BR><BR>' . 'A failed uninstallation is most likely caused by a bug in LOVD.<BR>' . 'Please <A href="' . $_SETT['upstream_URL'] . 'bugs/" target="_blank">file a bug</A> and include the above messages to help us solve the problem.';
                 $_BAR->setMessage($sMessage, 'done');
                 $_BAR->setMessageVisibility('done', true);
                 $_DB->query('DROP TABLE IF EXISTS ' . implode(', ', $aTables), array(), false);
                 // Try again to remove everything.
                 print '</BODY>' . "\n" . '</HTML>' . "\n";
                 exit;
             }
             $nSQLDone++;
             $nSQLDonePercentage = round(100 * $nSQLDone / $nTables);
             if ($nSQLDonePercentage == 100 && $nSQLDone != $nTables) {
                 // Don't want to show 100% when an error occurs at 99.5%.
                 $nSQLDonePercentage = 99;
             }
             if ($nSQLDonePercentage != $nSQLDonePercentagePrev) {
                 $_BAR->setProgress($nSQLDonePercentage);
                 $nSQLDonePercentagePrev = $nSQLDonePercentage;
             }
             flush();
             usleep(5000);
         }
         usleep(300000);
         // All done!
         $_BAR->setMessage('LOVD successfully uninstalled!<BR>Thank you for having used LOVD!');
         $_BAR->setMessageVisibility('done', true);
         print '</BODY>' . "\n" . '</HTML>' . "\n";
         exit;
     }
 } else {
     // Show some general statistics and warn about loss of data.
     print '      <PRE>' . "\n";
Ejemplo n.º 3
0
     $_T->printTitle();
     require ROOT_PATH . 'class/progress_bar.php';
     require ROOT_PATH . 'inc-lib-form.php';
     // Generate a unique workID, that is sortable.
     $nTime = gettimeofday();
     $_POST['workID'] = $nTime['sec'] . $nTime['usec'];
     $sFormNextPage = '<FORM action="' . $sPath . '" id="createTranscript" method="post">' . "\n" . '          <INPUT type="hidden" name="workID" value="' . $_POST['workID'] . '">' . "\n" . '          <INPUT type="submit" value="Continue &raquo;">' . "\n" . '        </FORM>';
     $_BAR = new ProgressBar('', 'Collecting transcript information...', $sFormNextPage);
     $_T->printFooter(false);
     // The false prevents the footer to actually close the <BODY> and <HTML> tags.
     // Now we're still in the <BODY> so the progress bar can add <SCRIPT> tags as much as it wants.
     flush();
     require ROOT_PATH . 'class/soap_client.php';
     $_Mutalyzer = new LOVD_SoapClient();
     $_BAR->setMessage('Collecting all available transcripts...');
     $_BAR->setProgress(0);
     $aTranscripts = $_DATA->getTranscriptPositions($zGene['refseq_UD'], $zGene['id'], $zGene['name'], $nProgress);
     $_SESSION['work'][$sPathBase][$_POST['workID']]['values'] = array('gene' => $zGene, 'transcripts' => $aTranscripts['id'], 'transcriptMutalyzer' => $aTranscripts['mutalyzer'], 'transcriptsProtein' => $aTranscripts['protein'], 'transcriptNames' => $aTranscripts['name'], 'transcriptPositions' => $aTranscripts['positions'], 'transcriptsAdded' => $aTranscripts['added']);
     $_BAR->setProgress(100);
     $_BAR->setMessage('Information collected, now building form...');
     $_BAR->setMessageVisibility('done', true);
     print '<SCRIPT type="text/javascript">' . "\n" . '  document.forms[\'createTranscript\'].submit();' . "\n" . '</SCRIPT>' . "\n\n";
     print '</BODY>' . "\n" . '</HTML>' . "\n";
     exit;
 }
 // Now make sure we have a valid workID.
 if (!isset($_POST['workID']) || !array_key_exists($_POST['workID'], $_SESSION['work'][$sPathBase])) {
     exit;
 }
 require ROOT_PATH . 'inc-lib-form.php';
 // FIXME; $aData would have been a better name.
Ejemplo n.º 4
0
 }
 if (!lovd_error()) {
     // Throwing away full submissions in one go is unfortunately not an option due to the many-to-many connection between screening and variant.
     // Deleting an individual does not delete its variants. Therefore, we might as well approach this the LOVD2 way: delete the variants, then delete the empty screenings, then the empty individuals.
     // Of course we MUST make sure those are at least entries related to the removed variants in question, otherwise we'll be deleting too much data (LOVD2 never allowed orphaned data like we do now).
     require ROOT_PATH . 'class/progress_bar.php';
     $_BAR = new ProgressBar('', 'Gathering data...');
     $aDone = array();
     $nDone = 0;
     $_DB->beginTransaction();
     // Determine which transcripts need their data deleted...
     // We must have transcripts and variants, otherwise we cannot get to this point.
     $aTranscripts = $_DB->query('SELECT id FROM ' . TABLE_TRANSCRIPTS . ' WHERE geneid = ?', array($sID))->fetchAllColumn();
     // Then determine which VOGs need to be deleted, because they will point to nothing else...
     $aVOGs = $_DB->query('SELECT DISTINCT vog.id FROM ' . TABLE_VARIANTS . ' AS vog INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot1 ON (vog.id = vot1.id AND vot1.transcriptid IN (?' . str_repeat(', ?', count($aTranscripts) - 1) . ')) LEFT OUTER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot2 ON (vog.id = vot2.id AND vot2.transcriptid NOT IN (?' . str_repeat(', ?', count($aTranscripts) - 1) . ')) WHERE vot2.transcriptid IS NULL', array_merge($aTranscripts, $aTranscripts), true)->fetchAllColumn();
     $_BAR->setProgress(10);
     $_BAR->setMessage('Deleting variants...');
     // Delete the VOTs!
     $q = $_DB->query('DELETE FROM ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' WHERE transcriptid IN (?' . str_repeat(', ?', count($aTranscripts) - 1) . ')', $aTranscripts);
     $aDone['Variants_On_Transcripts'] = $q->rowCount();
     $nDone++;
     unset($aTranscripts);
     // Save some memory.
     $_BAR->setProgress(25);
     // Determine which screenings need to go, based on the VOGs...
     $aScreenings = $_DB->query('SELECT DISTINCT s2v1.screeningid FROM ' . TABLE_SCR2VAR . ' AS s2v1 LEFT OUTER JOIN ' . TABLE_SCR2VAR . ' AS s2v2 ON (s2v1.screeningid = s2v2.screeningid AND s2v2.variantid NOT IN (?' . str_repeat(', ?', count($aVOGs) - 1) . ')) WHERE s2v1.variantid IN (?' . str_repeat(', ?', count($aVOGs) - 1) . ') AND s2v2.variantid IS NULL', array_merge($aVOGs, $aVOGs), true)->fetchAllColumn();
     // Delete the VOGs!
     $q = $_DB->query('DELETE FROM ' . TABLE_VARIANTS . ' WHERE id IN (?' . str_repeat(', ?', count($aVOGs) - 1) . ')', $aVOGs);
     $aDone['Variants_On_Genome'] = $q->rowCount();
     $nDone++;
     unset($aVOGs);
Ejemplo n.º 5
0
if (!$nToFetch) {
    print 'All done.';
    $_T->printFooter();
    exit;
}
require ROOT_PATH . 'class/progress_bar.php';
$oPB = new ProgressBar('', 'Fetching frequency data...', '&nbsp;');
$_T->printFooter(false);
@set_time_limit(0);
$sVariants = ' ';
$nDone = 0;
while ($nDone < $nToFetch && $sVariants) {
    $aVariants = $_DB->query('SELECT chromosome, position_g_start, position_g_end, `VariantOnGenome/DNA` AS DNA FROM ' . TABLE_VARIANTS . ' WHERE average_frequency IS NULL AND chromosome IS NOT NULL AND position_g_start IS NOT NULL AND position_g_end IS NOT NULL LIMIT ' . $nLimit)->fetchAllAssoc();
    if ($aVariants === array()) {
        // No results.
        $oPB->setProgress(100);
        // To prevent ending up in a loop because of a programming error, or unexpected results from the database, we'll redirect with a GET variable that we'll check for, here.
        if (ACTION == 'done') {
            // We were supposedly done before. Don't reload.
            $oPB->setMessage('Done.');
        } else {
            $oPB->setMessage('Done, reloading...');
            $oPB->redirectTo(CURRENT_PATH . '?done', 1);
        }
        die('    </BODY>' . "\n" . '</HTML>');
    } elseif (!$aVariants) {
        // Failed query,
        $oPB->setMessage('Error, did not get proper response from database.');
        die('    </BODY>' . "\n" . '</HTML>');
    } else {
        // Proceed.
Ejemplo n.º 6
0
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="js/bootstrap.min.js"></script>
</head>

<body>
<?php 
require_once './include/class.progressbar.php';
echo 'Starting&hellip;<br />';
$p = new ProgressBar();
echo '<div style="width: 300px;">';
$p->render();
echo '</div>';
for ($i = 0; $i < ($size = 100); $i++) {
    $p->setProgress($i * 100 / $size);
    usleep(1000000 * 0.1);
}
$p->setProgress(100);
echo 'Done.<br />';
?>


   

</body>

</html>
Ejemplo n.º 7
0
function sendMail()
{
    $checkbox_value = 0;
    $cfg = new ini_file();
    $cfg->setFileName('./include/config/account.ini');
    $cfg->load();
    $user_mail = $cfg->getElementValue('user', 'mail');
    $p = new ProgressBar();
    $mail = new PHPMailer();
    $mail->IsSMTP();
    //$mail->SMTPDebug= 2;
    //konfiguracja serwera
    $mail->PluginDir = "phpmailer/";
    $mail->Mailer = "smtp";
    $mail->Host = $cfg->getElementValue('server-config', 'Host');
    $mail->SMTPSecure = $cfg->getElementValue('server-config', 'SMTPSecure');
    $mail->Port = $cfg->getElementValue('server-config', 'Port');
    //
    $mail->SMTPKeepAlive = true;
    $mail->SMTPAuth = true;
    $mail->Username = $cfg->getElementValue('server-config', 'Login');
    $mail->Password = $cfg->getElementValue('server-config', 'Passwort');
    //koniec połączenia
    //baza danych
    $mydb = new Db();
    $qwery = "SELECT `id`, `email` FROM mail_data Where sended=" . $checkbox_value;
    $request = $mydb->getMysqli()->query($qwery);
    if ($request === false) {
        die('Nie można było odebrać danych do bazy' . ' z powodu blendu:' . $mydb->getMysqli()->error);
    }
    if ($request->num_rows == 0) {
        echo 'Brak danych w bazie';
        exit(1);
    }
    $i = 0;
    $size = $request->num_rows;
    $p->render();
    while ($row = $request->fetch_assoc()) {
        $id = $row['id'];
        $address = $row['email'];
        $token = md5(time());
        $mail->SetLanguage("pl", "phpmailer/language/");
        $mail->CharSet = "UTF-8";
        $mail->ContentType = "text/html";
        $mail->isHTML(true);
        $html = new HtmlParser("./mailform/form1 - Kopia.html");
        $mail->From = $user_mail;
        $mail->FromName = $cfg->getElementValue('user', 'FromName');
        $mail->Subject = "Tytuł wiadomości";
        $mail->msgHTML($html->getHtml());
        $mail->AddAddress($address);
        try {
            if ($mail->Send()) {
                $p->setProgress($i * 100 / $size);
            } else {
                throw new Exception("E-mail nie mógł zostać wysłany, przyczyna : {$mail->ErrorInfo}");
            }
        } catch (Exeption $e) {
            var_dump($e);
            exit;
        }
        $i++;
    }
    echo 'wysłano mail: ';
    $p->setProgress(100);
    //echo $html->getHtml();
    $mail->SmtpClose();
    //zamykamy połączeie
}