📄 bigdump.php
字号:
if ($skipline) { $linenumber++; continue; } } // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings) $dumpline_deslashed = str_replace("\\\\", "", $dumpline); // Count ' and \' in the dumpline to avoid query break within a text field ending by ; // Please don't use double quotes ('"')to surround strings, it wont work $parents = substr_count($dumpline_deslashed, "'") - substr_count($dumpline_deslashed, "\\'"); if ($parents % 2 != 0) $inparents = !$inparents; // Add the line to query $query .= $dumpline; // Don't count the line if in parents (text fields may include unlimited linebreaks) if (!$inparents) $querylines++; // Stop if query contains more lines as defined by MAX_QUERY_LINES if ($querylines > MAX_QUERY_LINES) { echo ("<p class=\"error\">". JText::_('STOPPEDATLINE') ." $linenumber. </p>"); echo ("<p>". JText::sprintf('TOOMANYLINES',MAX_QUERY_LINES)."</p>"); $error = true; break; } $vars = $this->getVars(); $DBtype = JArrayHelper::getValue($vars, 'DBtype', 'mysql'); $DBhostname = JArrayHelper::getValue($vars, 'DBhostname', ''); $DBuserName = JArrayHelper::getValue($vars, 'DBuserName', ''); $DBpassword = JArrayHelper::getValue($vars, 'DBpassword', ''); $DBname = JArrayHelper::getValue($vars, 'DBname', ''); $DBPrefix = JArrayHelper::getValue($vars, 'DBPrefix', 'jos_'); $DBOld = JArrayHelper::getValue($vars, 'DBOld', 'bu'); //$migration = JArrayHelper::getValue($vars, 'migration', '0'); $migration = JRequest::getVar( 'migration', 0, 'post', 'bool' ); $db = & JInstallationHelper::getDBO($DBtype, $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix); if(JError::isError($db)) jexit(JText::_('CONNECTION FAIL'));// echo 'Done.<br />'; // Execute query if end of query detected (; as last character) AND NOT in parents if (ereg(";$", trim($dumpline)) && !$inparents) { if (!TESTMODE) { $db->setQuery(trim($query));// echo $query . '<br />'; if (!$db->Query()) { echo ("<p class=\"error\">".JText::_('Error at the line') ." $linenumber: ". trim($dumpline) . "</p>\n"); echo ("<p>".JText::_('Query:') . trim(nl2br(htmlentities($query))) ."</p>\n"); echo ("<p>MySQL: " . mysql_error() . "</p>\n"); $error = true; break; } $totalqueries++; $queries++; $query = ""; $querylines = 0; } } $linenumber++; } } // Get the current file position if (!$error) { if (!$gzipmode) $foffset = ftell($file); else $foffset = gztell($file); if (!$foffset) { echo ("<p class=\"error\">".JText::_('CANTREADPOINTER')."</p>\n"); $error = true; } } // Print statistics // echo ("<p class=\"centr\"><b>Statistics</b></p>\n"); if (!$error) { $lines_this = $linenumber - $_REQUEST["start"]; $lines_done = $linenumber -1; $lines_togo = ' ? '; $lines_tota = ' ? '; $queries_this = $queries; $queries_done = $totalqueries; $queries_togo = ' ? '; $queries_tota = ' ? '; $bytes_this = $foffset - $_REQUEST["foffset"]; $bytes_done = $foffset; $kbytes_this = round($bytes_this / 1024, 2); $kbytes_done = round($bytes_done / 1024, 2); $mbytes_this = round($kbytes_this / 1024, 2); $mbytes_done = round($kbytes_done / 1024, 2); if (!$gzipmode) { $bytes_togo = $filesize - $foffset; $bytes_tota = $filesize; $kbytes_togo = round($bytes_togo / 1024, 2); $kbytes_tota = round($bytes_tota / 1024, 2); $mbytes_togo = round($kbytes_togo / 1024, 2); $mbytes_tota = round($kbytes_tota / 1024, 2); $pct_this = ceil($bytes_this / $filesize * 100); $pct_done = ceil($foffset / $filesize * 100); $pct_togo = 100 - $pct_done; $pct_tota = 100; if ($bytes_togo == 0) { $lines_togo = '0'; $lines_tota = $linenumber -1; $queries_togo = '0'; $queries_tota = $totalqueries; } $pct_bar = "<div style=\"height:15px;width:$pct_done%;background-color:#000080;margin:0px;\"></div>"; } else { $bytes_togo = ' ? '; $bytes_tota = ' ? '; $kbytes_togo = ' ? '; $kbytes_tota = ' ? '; $mbytes_togo = ' ? '; $mbytes_tota = ' ? '; $pct_this = ' ? '; $pct_done = ' ? '; $pct_togo = ' ? '; $pct_tota = 100; $pct_bar = str_replace(' ', ' ', '<tt>[ Not available for gzipped files ]</tt>'); } /* echo (" <center> <table width=\"520\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\"> <tr><th class=\"bg4\"> </th><th class=\"bg4\">Session</th><th class=\"bg4\">Done</th><th class=\"bg4\">To go</th><th class=\"bg4\">Total</th></tr> <tr><th class=\"bg4\">Lines</th><td class=\"bg3\">$lines_this</td><td class=\"bg3\">$lines_done</td><td class=\"bg3\">$lines_togo</td><td class=\"bg3\">$lines_tota</td></tr> <tr><th class=\"bg4\">Queries</th><td class=\"bg3\">$queries_this</td><td class=\"bg3\">$queries_done</td><td class=\"bg3\">$queries_togo</td><td class=\"bg3\">$queries_tota</td></tr> <tr><th class=\"bg4\">Bytes</th><td class=\"bg3\">$bytes_this</td><td class=\"bg3\">$bytes_done</td><td class=\"bg3\">$bytes_togo</td><td class=\"bg3\">$bytes_tota</td></tr> <tr><th class=\"bg4\">KB</th><td class=\"bg3\">$kbytes_this</td><td class=\"bg3\">$kbytes_done</td><td class=\"bg3\">$kbytes_togo</td><td class=\"bg3\">$kbytes_tota</td></tr> <tr><th class=\"bg4\">MB</th><td class=\"bg3\">$mbytes_this</td><td class=\"bg3\">$mbytes_done</td><td class=\"bg3\">$mbytes_togo</td><td class=\"bg3\">$mbytes_tota</td></tr> <tr><th class=\"bg4\">%</th><td class=\"bg3\">$pct_this</td><td class=\"bg3\">$pct_done</td><td class=\"bg3\">$pct_togo</td><td class=\"bg3\">$pct_tota</td></tr> <tr><th class=\"bg4\">% bar</th><td class=\"bgpctbar\" colspan=\"4\">$pct_bar</td></tr> </table> </center> \n");*/ // Finish message and restart the script if ($linenumber < $_REQUEST["start"] + $linespersession) { echo ("<div id=\"installer\"><p class=\"successcentr\">".JText::_('CONGRATSEOF')."</p>\n"); // Do migration if($migration) { ?><br />Migration will continue shortly...</div> <form action="index.php" method="post" name="migrateForm" id="migrateForm" class="form-validate" target="migrationtarget"> <input type="hidden" name="task" value="postmigrate" /> <input type="hidden" name="migration" value="<?php echo $migration ?>" /> <input type="hidden" name="loadchecked" value="1" /> <input type="hidden" name="dataLoaded" value="1" /> <input type="hidden" name="DBtype" value="<?php echo $DBtype ?>" /> <input type="hidden" name="DBhostname" value="<?php echo $DBhostname ?>" /> <input type="hidden" name="DBuserName" value="<?php echo $DBuserName ?>" /> <input type="hidden" name="DBpassword" value="<?php echo $DBpassword ?>" /> <input type="hidden" name="DBname" value="<?php echo $DBname ?>" /> <input type="hidden" name="DBPrefix" value="<?php echo $DBPrefix ?>" /> </form> <script language="JavaScript" type="text/javascript">window.setTimeout('submitForm(this.document.migrateForm,"postmigrate")',500);</script> <?php } else echo '<br />'. JText::_('FINALIZEINSTALL').'</div>'; //echo ("<p class=\"centr\">Thank you for using this tool! Please rate <a href=\"http://www.hotscripts.com/Detailed/20922.html\" target=\"_blank\">Bigdump at Hotscripts.com</a></p>\n"); //echo ("<p class=\"centr\">You can send me some bucks or euros as appreciation <a href=\"http://www.ozerov.de/bigdump.php\" target=\"_blank\">via PayPal</a></p>\n"); $error = true; } else { if ($delaypersession != 0) echo ("<p class=\"centr\">".JText::sprintf('DELAYMSG',$delaypersession)."</p>\n"); ?><script language="JavaScript" type="text/javascript">window.setTimeout('submitForm(this.document.migrateForm,"dumpLoad")',500);</script> <div id="installer"><p><?php echo JText::_('LOADSQLFILE') ?></p></div> <form action="index.php" method="post" name="migrateForm" id="migrateForm" class="form-validate" target="migrationtarget"> <input type="hidden" name="task" value="dumpLoad" /> <input type="hidden" name="migration" value="<?php echo $migration ?>" /> <input type="hidden" name="loadchecked" value="1" /> <input type="hidden" name="dataLoaded" value="1" /> <input type="hidden" name="DBtype" value="<?php echo $DBtype ?>" /> <input type="hidden" name="DBhostname" value="<?php echo $DBhostname ?>" /> <input type="hidden" name="DBuserName" value="<?php echo $DBuserName ?>" /> <input type="hidden" name="DBpassword" value="<?php echo $DBpassword ?>" /> <input type="hidden" name="DBname" value="<?php echo $DBname ?>" /> <input type="hidden" name="DBPrefix" value="<?php echo $DBPrefix ?>" /> <input type="hidden" name="start" value="<?php echo $linenumber ?>" /> <input type="hidden" name="foffset" value="<?php echo $foffset ?>" /> <input type="hidden" name="totalqueries" value="<?php echo $totalqueries ?>" /> </form> <?php //echo ("<script language=\"JavaScript\" type=\"text/javascript\">window.setTimeout('location.href=\"" . $_SERVER["PHP_SELF"] . "?start=$linenumber&fn=" . $_REQUEST["fn"] . "&foffset=$foffset&totalqueries=$totalqueries\";',500+$delaypersession);</script>\n"); //echo ("<noscript>\n"); //echo ("<p class=\"centr\"><a href=\"" . $_SERVER["PHP_SELF"] . "?start=$linenumber&fn=" . $_REQUEST["fn"] . "&foffset=$foffset&totalqueries=$totalqueries\">Continue from the line $linenumber</a> (Enable JavaScript to do it automatically)</p>\n"); //echo ("</noscript>\n"); //echo ("<p class=\"centr\">Press <b><a href=\"" . $_SERVER["PHP_SELF"] . "\">STOP</a></b> to abort the import <b>OR WAIT!</b></p>\n"); } } else echo ("<p class=\"error\">".JText::_('STOPPEDONERROR')."</p>\n");}//if ($dbconnection) mysql_close();if ($file && !$gzipmode) fclose($file);else if ($file && $gzipmode) gzclose($file);//ob_flush();//die();?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -