Skip to content

Commit

Permalink
backup --no-create-db
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Apr 9, 2022
1 parent 52edfa1 commit b7c1102
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/Repositories/ToolRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function backupDatabase()
$config = config("database.connections.$connectionName");
$filename = sprintf('%s/%s.database.%s.sql', sys_get_temp_dir(), basename(base_path()), date('Ymd.His'));
$command = sprintf(
'mysqldump --user=%s --password=%s --port=%s --single-transaction --databases %s >> %s',
'mysqldump --user=%s --password=%s --port=%s --single-transaction --no-create-db --databases %s >> %s',
$config['username'], $config['password'], $config['port'], $config['database'], $filename,
);
$result = exec($command, $output, $result_code);
Expand Down
17 changes: 8 additions & 9 deletions app/Repositories/TrackerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,7 @@ public function announce(Request $request): \Illuminate\Http\Response
do_log("[" . get_class($exception) . "] " . $exception->getMessage() . "\n" . $exception->getTraceAsString(), 'error');
$repDict = $this->generateFailedAnnounceResponse("system error, report to sysop please, hint: " . nexus()->getRequestId());
} finally {
$setUpdate = "[USER_SET_UPDATE] user: " . $user->id;
foreach ($this->userUpdates as $key => $value) {
$setUpdate .= ", $key = $value";
}
do_log($setUpdate);
if (isset($user) && count($this->userUpdates)) {
// $user->update($this->userUpdates);
$user->fill($this->userUpdates);
$willBeUpdate = "[USER_ACTUAL_UPDATE] user: " . $user->id;
foreach ($user->getDirty() as $key => $value) {
Expand Down Expand Up @@ -862,10 +856,15 @@ public function scrape(Request $request): \Illuminate\Http\Response
do_log("[" . get_class($exception) . "] " . $exception->getMessage() . "\n" . $exception->getTraceAsString(), 'error');
$repDict = $this->generateFailedAnnounceResponse("system error, report to sysop please, hint: " . nexus()->getRequestId());
} finally {
do_log("userUpdates: " . nexus_json_encode($this->userUpdates));
if (isset($user) && count($this->userUpdates)) {
$user->update($this->userUpdates);
do_log(last_query(), 'debug');
$user->fill($this->userUpdates);
$willBeUpdate = "[USER_ACTUAL_UPDATE] user: " . $user->id;
foreach ($user->getDirty() as $key => $value) {
$willBeUpdate .= ", $key = $value";
}
do_log($willBeUpdate);
$user->save();
do_log(last_query());
}
return $this->sendFinalAnnounceResponse($repDict);
}
Expand Down
2 changes: 1 addition & 1 deletion include/constants.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.0');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-04-06');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-04-09');
defined('IN_TRACKER') || define('IN_TRACKER', true);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
Expand Down

0 comments on commit b7c1102

Please sign in to comment.