Update createFromTimestamp usage

This commit is contained in:
DariusIII
2024-06-05 19:09:23 +02:00
parent 7dfd450e8a
commit dc24705ee2
5 changed files with 9 additions and 8 deletions
+5 -4
View File
@@ -296,7 +296,7 @@ class Binaries
// Generate postdate for first record, for those that upgraded.
if ($groupMySQL['first_record_postdate'] === null && (int) $groupMySQL['first_record'] !== 0) {
$groupMySQL['first_record_postdate'] = $this->postdate($groupMySQL['first_record'], $groupNNTP);
UsenetGroup::query()->where('id', $groupMySQL['id'])->update(['first_record_postdate' => Carbon::createFromTimestamp($groupMySQL['first_record_postdate'])]);
UsenetGroup::query()->where('id', $groupMySQL['id'])->update(['first_record_postdate' => Carbon::createFromTimestamp($groupMySQL['first_record_postdate'], date_default_timezone_get())]);
}
// Get first article we want aka the oldest.
@@ -418,7 +418,8 @@ class Binaries
[
'first_record' => $scanSummary['firstArticleNumber'],
'first_record_postdate' => Carbon::createFromTimestamp(
$groupMySQL['first_record_postdate']
$groupMySQL['first_record_postdate'],
date_default_timezone_get()
),
]
);
@@ -434,7 +435,7 @@ class Binaries
->update(
[
'last_record' => $scanSummary['lastArticleNumber'],
'last_record_postdate' => Carbon::createFromTimestamp($scanSummary['lastArticleDate']),
'last_record_postdate' => Carbon::createFromTimestamp($scanSummary['lastArticleDate'], date_default_timezone_get()),
'last_updated' => now(),
]
);
@@ -1236,7 +1237,7 @@ class Binaries
if ($this->_echoCLI) {
$this->colorCli->primary(
PHP_EOL.'Found article #'.$wantedArticle.' which has a date of '.date('r', $articleTime).
', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime), true).'days.'
', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime, date_default_timezone_get())->diffInDays(Carbon::createFromTimestamp($articleTime), true).'days.'
);
}
+1 -1
View File
@@ -217,7 +217,7 @@ class NZBImport
$posterName = (string) $file->attributes()->poster;
}
if ($postDate === false) {
$postDate = Carbon::createFromTimestamp((string) $file->attributes()->date)->format('Y-m-d H:i:s');
$postDate = Carbon::createFromTimestamp((string) $file->attributes()->date, date_default_timezone_get())->format('Y-m-d H:i:s');
}
// Make a fake message array to use to check the blacklist.
+1 -1
View File
@@ -273,7 +273,7 @@ class PopulateAniDB
*/
private function populateMainTable(): void
{
$lastUpdate = Carbon::createFromTimestamp($this->lastUpdate);
$lastUpdate = Carbon::createFromTimestamp($this->lastUpdate, date_default_timezone_get());
$current = now();
if ($current->diff($lastUpdate)->format('%d') > $this->updateInterval) {
+1 -1
View File
@@ -270,7 +270,7 @@ class Tmux
public function relativeTime($_time): string
{
return Carbon::createFromTimestamp($_time)->ago();
return Carbon::createFromTimestamp($_time, date_default_timezone_get())->ago();
}
public function command_exist($cmd): bool
+1 -1
View File
@@ -100,7 +100,7 @@ class ReleaseFile extends Model
if ($createdTime === 0) {
$adjustedCreatedTime = now()->format('Y-m-d H:i:s');
} else {
$adjustedCreatedTime = Carbon::createFromTimestamp($createdTime)->format('Y-m-d H:i:s');
$adjustedCreatedTime = Carbon::createFromTimestamp($createdTime, date_default_timezone_get())->format('Y-m-d H:i:s');
}
} else {
$adjustedCreatedTime = $createdTime;