Skip to content

Commit

Permalink
PHP cs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdarwood007 committed Aug 6, 2024
1 parent 2ad4d70 commit eb20a18
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
5 changes: 3 additions & 2 deletions Maintenance/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ public static function jsonResponse(mixed $data, bool $success = true): void

// TODO: Improve this, move debug to the root.
$debug_data = [];

if (Maintenance::$tool->isDebug()) {
$debug_data = $data['debug'];
}
Expand All @@ -774,7 +775,7 @@ public static function jsonResponse(mixed $data, bool $success = true): void
echo json_encode([
'success' => $success,
'data' => $data,
'debug' => $debug_data
'debug' => $debug_data,
]);

die;
Expand Down Expand Up @@ -862,7 +863,7 @@ protected static function setThemeData(): void
Config::$modSettings['theme_dir'] = empty(self::$theme_dir) ? Config::$boarddir . '/Themes/default' : self::$theme_dir;
Config::$modSettings['theme_url'] = empty(self::$theme_url) ? 'Themes/default' : self::$theme_url;
Config::$modSettings['images_url'] = empty(self::$images_url) ? 'Themes/default/images' : self::$images_url;
}
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions Maintenance/Migration/MigrationBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace SMF\Maintenance\Migration;

use Exception;
use SMF\Config;
use SMF\Db\DatabaseApi as Db;
use SMF\Lang;
Expand Down Expand Up @@ -139,15 +138,16 @@ protected function query(string $identifier, string $db_string, array $db_values
}

// If this is JSON, we can throw it, modern code will catch this.
else if (Maintenance::isJson()) {
if (Maintenance::isJson()) {
$file = null;
$line = null;

foreach (debug_backtrace() as $step) {
$file = $step['file'];
$line = $step['line'];
break;
}

throw new \ErrorException($db_error_message, 0, E_USER_ERROR, $file, $line);
}

Expand Down
1 change: 0 additions & 1 deletion Maintenance/Migration/v2_1/CreateAlerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

namespace SMF\Maintenance\Migration\v2_1;

use SMF\Config;
use SMF\Db\DatabaseApi as Db;
use SMF\Maintenance\Maintenance;
use SMF\Maintenance\Migration\MigrationBase;
Expand Down
30 changes: 15 additions & 15 deletions Maintenance/Tools/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -1034,14 +1034,13 @@ public function migrations(): bool
'total' => Maintenance::$total_substeps,
'debug' => [
'call' => basename($migrationFile),
]
],
],
);

continue;
}
}
catch (Exception $ex) {
} catch (Exception $ex) {
Maintenance::jsonResponse(
[
'name' => $migration->name,
Expand All @@ -1054,7 +1053,7 @@ public function migrations(): bool
'msg' => $ex->getMessage(),
'file' => $ex->getFile(),
'line' => $ex->getLine(),
]
],
],
);

Expand All @@ -1067,10 +1066,10 @@ public function migrations(): bool
}

$res = false;

try {
$res = $migration->execute();
}
catch (Exception $ex) {
} catch (Exception $ex) {
Maintenance::jsonResponse(
[
'name' => $migration->name,
Expand All @@ -1083,7 +1082,7 @@ public function migrations(): bool
'msg' => $ex->getMessage(),
'file' => $ex->getFile(),
'line' => $ex->getLine(),
]
],
],
);

Expand All @@ -1100,8 +1099,8 @@ public function migrations(): bool
'start' => Maintenance::getCurrentStart(),
'total' => Maintenance::$total_substeps,
'debug' => [
'call' => basename($migrationFile)
]
'call' => basename($migrationFile),
],
],
);

Expand All @@ -1127,8 +1126,8 @@ public function migrations(): bool
'start' => Maintenance::getCurrentStart(),
'total' => Maintenance::$total_substeps,
'debug' => [
'call' => basename($migrationFile)
]
'call' => basename($migrationFile),
],
],
);
}
Expand Down Expand Up @@ -1231,10 +1230,11 @@ private function getUpgradeData(): void
$defined_vars = Config::getCurrentSettings();

$data = [];

try {
$data = isset($defined_vars['upgradeData']) ? Utils::jsonDecode(base64_decode($defined_vars['upgradeData']), true) : [];
} catch (Exception) {
}
catch (Exception) {}

$this->time_started = isset($data['started']) ? (int) $data['started'] : time();
$this->time_updated = isset($data['updated']) ? (int) $data['updated'] : time();
Expand Down Expand Up @@ -1412,7 +1412,7 @@ private function toggleSmStats(array &$settings): void

/**
* Get the name of the next migration, if any.
*
*
* @param int $substep Substep we are looking for
* @param array $files All files that we are running.
*/
Expand All @@ -1425,9 +1425,9 @@ private function getNextMigrationName(int $substep, array $files): string

$migrationFile = $files[$substep];
$migration = new $migrationFile();

return $migration->name;
}
catch (Exception) {
} catch (Exception) {
return '';
}
}
Expand Down

0 comments on commit eb20a18

Please sign in to comment.