Skip to content

Commit 2139e0a

Browse files
committed
Return row objects directly in listRedirects
1 parent 4d2d187 commit 2139e0a

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/CrawledFiles.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static function getTotal(): int {
368368
}
369369

370370
/**
371-
* @return mixed[] redirects
371+
* @return object[] redirects
372372
*/
373373
public static function listRedirects(): array {
374374
global $wpdb;
@@ -379,14 +379,6 @@ public static function listRedirects(): array {
379379
"SELECT path, redirect_to FROM $table_name WHERE 0 < LENGTH(redirect_to)"
380380
);
381381

382-
$redirs = [];
383-
foreach ( $rows as $row ) {
384-
$redirs[ $row->path ] = [
385-
'url' => $row->path,
386-
'redirect_to' => $row->redirect_to,
387-
];
388-
}
389-
390-
return $redirs;
382+
return $rows;
391383
}
392384
}

src/S3/Deployer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ public function uploadFiles( string $processed_site_path ): void {
9090
}
9191

9292
foreach ( $redirects as $redirect ) {
93-
$path = $redirect['url'];
93+
$path = $redirect->path;
9494

9595
if ( mb_substr( $path, -1 ) === '/' ) {
9696
$path = $path . 'index.html';
9797
}
9898

9999
yield [
100100
'path' => $path,
101-
'redirect_to' => $redirect['redirect_to'],
101+
'redirect_to' => $redirect->redirect_to,
102102
];
103103
}
104104
};

0 commit comments

Comments
 (0)