mirror of
https://github.com/friendica/friendica
synced 2025-04-25 09:10:11 +00:00
Apply suggestions from code review
Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
parent
965caf98a5
commit
925c30280c
3 changed files with 9 additions and 11 deletions
|
@ -104,9 +104,7 @@ class DBKeyValueStorage extends AbstractKeyValueStorage
|
||||||
public function offsetUnset($offset)
|
public function offsetUnset($offset)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$return = $this->database->delete(self::DB_KEY_VALUE_TABLE, ['k' => $offset]);
|
if (!$this->database->delete(self::DB_KEY_VALUE_TABLE, ['k' => $offset])) {
|
||||||
|
|
||||||
if (!$return) {
|
|
||||||
throw new \Exception(sprintf('database deletion failed: %s', $this->database->errorMessage()));
|
throw new \Exception(sprintf('database deletion failed: %s', $this->database->errorMessage()));
|
||||||
}
|
}
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ class DBStructure
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('The version number must be numeric');
|
throw new \Asika\SimpleConsole\CommandArgsException('The version number must be numeric');
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::keyValue()->set( 'build', $version);
|
DI::keyValue()->set('build', $version);
|
||||||
echo DI::l10n()->t('The database version had been set to %s.', $version);
|
echo DI::l10n()->t('The database version had been set to %s.', $version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,14 +176,14 @@ class DBStructure
|
||||||
public static function performUpdate(bool $enable_maintenance_mode = true, bool $verbose = false): string
|
public static function performUpdate(bool $enable_maintenance_mode = true, bool $verbose = false): string
|
||||||
{
|
{
|
||||||
if ($enable_maintenance_mode) {
|
if ($enable_maintenance_mode) {
|
||||||
DI::keyValue()->set( 'maintenance', 1);
|
DI::keyValue()->set('maintenance', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = self::update($verbose, true);
|
$status = self::update($verbose, true);
|
||||||
|
|
||||||
if ($enable_maintenance_mode) {
|
if ($enable_maintenance_mode) {
|
||||||
DI::keyValue()->set( 'maintenance', 0);
|
DI::keyValue()->set('maintenance', 0);
|
||||||
DI::keyValue()->set( 'maintenance_reason', '');
|
DI::keyValue()->set('maintenance_reason', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
|
@ -496,7 +496,7 @@ class DBStructure
|
||||||
if ($errors) {
|
if ($errors) {
|
||||||
DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
|
DI::config()->set('system', 'dbupdate', self::UPDATE_FAILED);
|
||||||
} else {
|
} else {
|
||||||
DI::config()->set( 'system', 'dbupdate', self::UPDATE_SUCCESSFUL);
|
DI::config()->set('system', 'dbupdate', self::UPDATE_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ class Summary extends BaseAdmin
|
||||||
$warningtext[] = DI::l10n()->t('The last update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear. (Some of the errors are possibly inside the logfile.)');
|
$warningtext[] = DI::l10n()->t('The last update failed. Please run "php bin/console.php dbstructure update" from the command line and have a look at the errors that might appear. (Some of the errors are possibly inside the logfile.)');
|
||||||
}
|
}
|
||||||
|
|
||||||
$last_worker_call = DI::keyValue()->get('last_worker_execution') ?? false;
|
$last_worker_call = DI::keyValue()->get('last_worker_execution');
|
||||||
if (!$last_worker_call) {
|
if (!$last_worker_call) {
|
||||||
$warningtext[] = DI::l10n()->t('The worker was never executed. Please check your database structure!');
|
$warningtext[] = DI::l10n()->t('The worker was never executed. Please check your database structure!');
|
||||||
} elseif ((strtotime(DateTimeFormat::utcNow()) - strtotime($last_worker_call)) > 60 * 60) {
|
} elseif ((strtotime(DateTimeFormat::utcNow()) - strtotime($last_worker_call)) > 60 * 60) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue