mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
File must have a text MIME type to be indexed
This commit is contained in:
@@ -47,10 +47,20 @@ function phpGrep($path, $base) {
|
||||
if (is_dir($filePath)) {
|
||||
$ret .= phpGrep($filePath, $base);
|
||||
} else {
|
||||
// Check if we should scan within this file, by only considering files that may contain functions & classes
|
||||
// Check if we should scan within this file, by only considering files that may contain functions & classes...
|
||||
// Must be in the indexableFileExts list
|
||||
if (false === in_array($filePathExt, $indexableFileExts)) {
|
||||
continue;
|
||||
}
|
||||
$finfo = "text";
|
||||
// Must have a MIME type string starting with "text"
|
||||
if (function_exists('finfo_open')) {
|
||||
$finfoMIME = finfo_open(FILEINFO_MIME);
|
||||
$finfo = finfo_file($finfoMIME, $filePath);
|
||||
}
|
||||
if (strpos($finfo, "text")) {
|
||||
continue;
|
||||
}
|
||||
// Check if file appears to be the same (same size and mtime), if so, continue as we'll assume it's not changed
|
||||
if (isset($prevIndexData['files'][$filePath]) &&
|
||||
$prevIndexData['files'][$filePath]['size'] === stat($filePath)['size'] &&
|
||||
|
||||
Reference in New Issue
Block a user