Skip to content

Commit 717c9c9

Browse files
committed
Merge file ignoring options
The options are already combined in code as globs.
1 parent d88d70a commit 717c9c9

File tree

3 files changed

+25
-65
lines changed

3 files changed

+25
-65
lines changed

src/CoreOptions.php

Lines changed: 25 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -254,43 +254,6 @@ public static function optionSpecs(): array {
254254
'Crawl Concurrency',
255255
'The maximum number of files that will be crawled at the same time.'
256256
),
257-
self::makeOptionSpec(
258-
'array',
259-
'fileExtensionsToIgnore',
260-
'1',
261-
'File Extensions to Ignore',
262-
'Files with these extensions will be ignored.',
263-
implode(
264-
"\n",
265-
[
266-
'.bat',
267-
'.crt',
268-
'.data', // et-cache puts these in wp-content/et-cache
269-
'.DS_Store',
270-
'.git',
271-
'.idea',
272-
'.ini',
273-
'.less',
274-
'.map',
275-
'.md',
276-
'.mo',
277-
'.php',
278-
'.PHP',
279-
'.phtml',
280-
'.po',
281-
'.pot',
282-
'.scss',
283-
'.sh',
284-
'.sql',
285-
'.SQL',
286-
'.tar.gz',
287-
'.tpl',
288-
'.txt',
289-
'.yarn',
290-
'.zip',
291-
]
292-
)
293-
),
294257
self::makeOptionSpec(
295258
'array',
296259
'filenamesToIgnore',
@@ -301,6 +264,31 @@ public static function optionSpecs(): array {
301264
implode(
302265
"\n",
303266
[
267+
'**.bat',
268+
'**.crt',
269+
'**.data', // et-cache puts these in wp-content/et-cache
270+
'**.DS_Store',
271+
'**.git',
272+
'**.idea',
273+
'**.ini',
274+
'**.less',
275+
'**.map',
276+
'**.md',
277+
'**.mo',
278+
'**.php',
279+
'**.PHP',
280+
'**.phtml',
281+
'**.po',
282+
'**.pot',
283+
'**.scss',
284+
'**.sh',
285+
'**.sql',
286+
'**.SQL',
287+
'**.tar.gz',
288+
'**.tpl',
289+
'**.txt',
290+
'**.yarn',
291+
'**.zip',
304292
'__MACOSX',
305293
'.babelrc',
306294
'.git',
@@ -858,17 +846,6 @@ public static function savePosted( string $screen = 'core' ): void {
858846
[ 'name' => 'crawlConcurrency' ]
859847
);
860848

861-
$file_extensions_to_ignore = preg_replace(
862-
'/^\s+|\s+$/m',
863-
'',
864-
strval( filter_input( INPUT_POST, 'fileExtensionsToIgnore' ) )
865-
);
866-
$wpdb->update(
867-
$table_name,
868-
[ 'blob_value' => $file_extensions_to_ignore ],
869-
[ 'name' => 'fileExtensionsToIgnore' ]
870-
);
871-
872849
$filenames_to_ignore = preg_replace(
873850
'/^\s+|\s+$/m',
874851
'',

src/FileFiltering.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ public function __construct() {
3030
foreach ( $filenames_to_ignore as $filename ) {
3131
$this->patterns_to_ignore[] = new FileIgnorePattern( $filename );
3232
}
33-
34-
$file_extensions_to_ignore = CoreOptions::getLineDelimitedBlobValue(
35-
'fileExtensionsToIgnore'
36-
);
37-
38-
$file_extensions_to_ignore =
39-
apply_filters(
40-
Controller::getHookName( 'file_extensions_to_ignore' ),
41-
$file_extensions_to_ignore
42-
);
43-
44-
foreach ( $file_extensions_to_ignore as $extension ) {
45-
$this->patterns_to_ignore[] = new FileIgnorePattern(
46-
"**$extension"
47-
);
48-
}
4933
}
5034

5135
/**

views/advanced-options-page.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
<table class="widefat striped">
3434
<tbody>
3535
<?php echo $row( 'filenamesToIgnore' ); ?>
36-
<?php echo $row( 'fileExtensionsToIgnore' ); ?>
3736
<?php echo $row( 'logDetectionSteps' ); ?>
3837
</tbody>
3938
</table>

0 commit comments

Comments
 (0)