コード例 #1
0
ファイル: variants.php プロジェクト: LOVDnl/LOVD3
 }
 define('LOG_EVENT', 'VariantUpload' . $_GET['type']);
 define('PAGE_TITLE', 'Upload a ' . $_GET['type'] . ' file');
 $_T->printHeader();
 $_T->printTitle();
 require ROOT_PATH . 'inc-lib-form.php';
 // Maximum number of unsupported variants that will be printed to the user.
 $nMaxListedUnsupported = 100;
 // Calculate maximum uploadable file size.
 // VCF files are approximately 116 bytes per variant, so 50 MB should allow for half a million variants.
 // SeattleSeq variants may take up as much as 750 bytes per variant because they duplicate a lot of information in cases with several transcripts.
 // Either way, LOVD has a maximum file size limit of 100 MB.
 // Anyways, the server settings are probably much lower.
 $nMaxSizeLOVD = 100 * 1024 * 1024;
 // 100MB LOVD limit.
 $nMaxSize = min($nMaxSizeLOVD, lovd_convertIniValueToBytes(ini_get('upload_max_filesize')), lovd_convertIniValueToBytes(ini_get('post_max_size')));
 function lovd_getVCFLine($fInput)
 {
     // This function reads and returns one line in $fInput.
     // It also updates the progress bar ($_BAR) and automatically skips empty lines. Returns false on EOF.
     global $_BAR, $_FILES;
     static $nParsedBytes;
     if (!isset($nParsedBytes)) {
         $nParsedBytes = 0;
     }
     // Automatically skip empty lines.
     do {
         $sLine = fgets($fInput);
         $nParsedBytes += strlen($sLine);
     } while ($sLine !== false && !trim($sLine));
     // Update the progress bar and return the line.
コード例 #2
0
ファイル: import.php プロジェクト: LOVDnl/LOVD3
                         }
                     }
                 }
                 if (!lovd_endLine()) {
                     break;
                 }
             }
             break;
         }
     }
 }
 if (!lovd_error()) {
     // Start parsing and put everything in memory.
     // Get at least 128MB memory.
     // FIXME: Increase memory limit based on file size? Use memory_get_usage() to predict running out of memory?
     if (lovd_convertIniValueToBytes(ini_get('memory_limit')) < 128 * 1024 * 1024) {
         ini_set('memory_limit', '128M');
     }
     $_T->printHeader();
     $_T->printTitle('Import data in LOVD format');
     // Load progress bar.
     require ROOT_PATH . 'class/progress_bar.php';
     $_BAR = array(new ProgressBar('parser', 'Parsing file...'));
     $_BAR[0]->setMessageVisibility('done', true);
     // Now, the actual parsing...
     foreach ($aData as $i => $sLine) {
         $sLine = trim($sLine);
         if (!$sLine) {
             if (!lovd_endLine()) {
                 break;
             }