src/Biz/Util/MySQLDumper.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Util;
use Biz\BaseService;
class MySQLDumper extends BaseService
{
public $target = '';
private $dbSettings = array();
private $internelSetting = array(
'exclude' => array(),
'isDropTable' => true,
'hasTransaction' => true,
'lockread' => true,
'lockwrite' => true,
'isextend' => true,
);
private $connection;
public function __construct($connection, $settings = array())
{
$this->connection = $connection;
$this->dbSettings = $settings;
$this->connection->exec('SET NAMES utf8');
}
protected function getSet($key)
{
if (array_key_exists($key, $this->dbSettings)) {
return $this->dbSettings[$key];
} else {
return $this->internelSetting[$key];
}
}
public function export($target)
{
$target .= '.gz';
if (!is_writable(dirname($target))) {
throw new \Exception('无导出目录写权限,无法导出数据库', 1);
}
$tables = array();
foreach ($this->connection->query('SHOW TABLES') as $table) {
$tables[] = current($table);
}
$file = gzopen($target, 'wb');
$this->lineWrite($file, "-- --------------------------------------------------\n");
$this->lineWrite($file, '-- ---------------- 导出数据库'."\n");
$this->lineWrite($file, '-- ---------------- 时间:'.date('Y-m-d H:i:s')."\n\n");
$this->lineWrite($file, '-- ---------------- 数据库:'."{$this->connection->getDatabase()}"." \n\n");
$this->lineWrite($file, '-- ---------------- 主机:'."{$this->connection->getHost()} "."\n\n");
$this->lineWrite($file, "-- --------------------------------------------------\n\n\n");
foreach ($tables as $table) {
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。