Skip to content

Commit 7088d72

Browse files
committed
Rename filenamesToIgnore to pathsToIgnore
Because of URL discovery, we need a path-oriented filter rather than a file-oriented filter. The name makes this more clear.
1 parent d4104e1 commit 7088d72

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

src/CoreOptions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ public static function optionSpecs(): array {
256256
),
257257
self::makeOptionSpec(
258258
'array',
259-
'filenamesToIgnore',
259+
'pathsToIgnore',
260260
'1',
261-
'Directory and File Names to Ignore',
262-
'Directories and files with these names will be ignored.' .
261+
'Paths to Ignore',
262+
'Path matching these patterns will be ignored.' .
263263
' Glob syntax is supported via <a href="https://github.com/PHLAK/Splat">Splat</a>.',
264264
implode(
265265
"\n",
@@ -846,15 +846,15 @@ public static function savePosted( string $screen = 'core' ): void {
846846
[ 'name' => 'crawlConcurrency' ]
847847
);
848848

849-
$filenames_to_ignore = preg_replace(
849+
$paths_to_ignore = preg_replace(
850850
'/^\s+|\s+$/m',
851851
'',
852-
strval( filter_input( INPUT_POST, 'filenamesToIgnore' ) )
852+
strval( filter_input( INPUT_POST, 'pathsToIgnore' ) )
853853
);
854854
$wpdb->update(
855855
$table_name,
856-
[ 'blob_value' => $filenames_to_ignore ],
857-
[ 'name' => 'filenamesToIgnore' ]
856+
[ 'blob_value' => $paths_to_ignore ],
857+
[ 'name' => 'pathsToIgnore' ]
858858
);
859859

860860
$hosts_to_rewrite = preg_replace(

src/FileFiltering.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class FileFiltering {
1919
public function __construct() {
2020
$this->patterns_to_ignore = [];
2121

22-
$filenames_to_ignore = CoreOptions::getLineDelimitedBlobValue( 'filenamesToIgnore' );
22+
$paths_to_ignore = CoreOptions::getLineDelimitedBlobValue( 'pathsToIgnore' );
2323

24-
foreach ( $filenames_to_ignore as $filename ) {
24+
foreach ( $paths_to_ignore as $filename ) {
2525
$this->patterns_to_ignore[] = new FileIgnorePattern( $filename );
2626
}
2727
}

tests/unit/FileHelperTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public function testDeleteDirWithFiles() {
101101
* @return void
102102
*/
103103
public function testGetListOfLocalFilesByDir() {
104-
$filenames_to_ignore = CoreOptions::getDefaultLineDelimitedBlobValue(
105-
'filenamesToIgnore'
104+
$paths_to_ignore = CoreOptions::getDefaultLineDelimitedBlobValue(
105+
'pathsToIgnore'
106106
);
107107
$file_extensions_to_ignore = CoreOptions::getDefaultLineDelimitedBlobValue(
108108
'fileExtensionsToIgnore'
@@ -147,7 +147,7 @@ public function testGetListOfLocalFilesByDir() {
147147
];
148148
$actual = FilesHelper::getListOfLocalFilesByDir(
149149
$filepath,
150-
$filenames_to_ignore,
150+
$paths_to_ignore,
151151
$file_extensions_to_ignore
152152
);
153153
$this->assertEquals( $expected, $actual );
@@ -161,7 +161,7 @@ public function testGetListOfLocalFilesByDir() {
161161
];
162162
$actual = FilesHelper::getListOfLocalFilesByDir(
163163
$filepath,
164-
$filenames_to_ignore,
164+
$paths_to_ignore,
165165
$file_extensions_to_ignore
166166
);
167167
$this->assertEquals( $expected, $actual );
@@ -173,7 +173,7 @@ public function testGetListOfLocalFilesByDir() {
173173
];
174174
$actual = FilesHelper::getListOfLocalFilesByDir(
175175
$filepath,
176-
$filenames_to_ignore,
176+
$paths_to_ignore,
177177
$file_extensions_to_ignore
178178
);
179179

@@ -186,20 +186,20 @@ public function testGetListOfLocalFilesByDir() {
186186
* @return void
187187
*/
188188
public function testPathLooksCrawlable() {
189-
$filenames_to_ignore = CoreOptions::getDefaultLineDelimitedBlobValue(
190-
'filenamesToIgnore'
189+
$paths_to_ignore = CoreOptions::getDefaultLineDelimitedBlobValue(
190+
'pathsToIgnore'
191191
);
192192
$file_extensions_to_ignore = CoreOptions::getDefaultLineDelimitedBlobValue(
193193
'fileExtensionsToIgnore'
194194
);
195195

196196
$looks_crawlable = function ( $file_name ) use (
197-
&$filenames_to_ignore,
197+
&$paths_to_ignore,
198198
&$file_extensions_to_ignore
199199
) {
200200
return FilesHelper::pathLooksCrawlable(
201201
$file_name,
202-
$filenames_to_ignore,
202+
$paths_to_ignore,
203203
$file_extensions_to_ignore
204204
);
205205
};

views/advanced-options-page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<table class="widefat striped">
3434
<tbody>
35-
<?php echo $row( 'filenamesToIgnore' ); ?>
35+
<?php echo $row( 'pathsToIgnore' ); ?>
3636
<?php echo $row( 'logDetectionSteps' ); ?>
3737
</tbody>
3838
</table>

0 commit comments

Comments
 (0)