Skip to content

Commit 4d2d187

Browse files
committed
Replace list_redirects filter with a function call
1 parent 97801ba commit 4d2d187

3 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/CrawledFiles.php

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

370370
/**
371-
* @param mixed[] $redirs
372371
* @return mixed[] redirects
373372
*/
374-
public static function wp2static_list_redirects( array $redirs ): array {
373+
public static function listRedirects(): array {
375374
global $wpdb;
376375

377376
$table_name = self::getTableName();
@@ -380,6 +379,7 @@ public static function wp2static_list_redirects( array $redirs ): array {
380379
"SELECT path, redirect_to FROM $table_name WHERE 0 < LENGTH(redirect_to)"
381380
);
382381

382+
$redirs = [];
383383
foreach ( $rows as $row ) {
384384
$redirs[ $row->path ] = [
385385
'url' => $row->path,

src/S3/Deployer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Aws\Credentials\Credentials;
1010
use Aws\Exception\AwsException;
1111
use Aws\S3\S3Client;
12+
use WP2Static\CrawledFiles;
1213
use WP2Static\Options;
1314
use WP2Static\WsLog;
1415

@@ -102,7 +103,7 @@ public function uploadFiles( string $processed_site_path ): void {
102103
}
103104
};
104105

105-
$redirects = apply_filters( 'wp2static_list_redirects', [] );
106+
$redirects = CrawledFiles::listRedirects();
106107

107108
self::uploadFilesIter( $file_arrays( $files, $redirects ) );
108109
}

src/WordPressAdmin.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ public static function registerHooks( string $bootstrap_file ): void {
5555
[ WPCron::class, 'wp2static_custom_cron_schedules' ]
5656
);
5757

58-
add_filter(
59-
Controller::getHookName( 'list_redirects' ),
60-
[ CrawledFiles::class, 'wp2static_list_redirects' ]
61-
);
62-
6358
add_filter(
6459
'cron_request',
6560
[ WPCron::class, 'wp2static_cron_with_http_basic_auth' ]

0 commit comments

Comments
 (0)