You are here

public function ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseIncludeFile in Audit Files 8.2

Same name and namespace in other branches
  1. 8.3 src/ServiceAuditFilesNotInDatabase.php \Drupal\auditfiles\ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseIncludeFile()
  2. 4.x src/ServiceAuditFilesNotInDatabase.php \Drupal\auditfiles\ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseIncludeFile()

Checks to see if the file is being included.

@todo Possibly add other file streams that are on the system but not the one being checked to the exclusions check.

Parameters

string $path: The complete file system path to the file.

string $file: The name of the file being checked.

string $exclusions: The list of files and directories that are not to be included in the list of files to check.

Return value

bool Returns TRUE, if the path or file is being included, or FALSE, if the path or file has been excluded.

1 call to ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseIncludeFile()
ServiceAuditFilesNotInDatabase::auditfilesNotInDatabaseGetFiles in src/ServiceAuditFilesNotInDatabase.php
Retrieves a list of files in the given path.

File

src/ServiceAuditFilesNotInDatabase.php, line 364

Class

ServiceAuditFilesNotInDatabase
Define all methods that are used on Files not in database functionality.

Namespace

Drupal\auditfiles

Code

public function auditfilesNotInDatabaseIncludeFile($path, $file, $exclusions) {
  if (empty($exclusions)) {
    return TRUE;
  }
  elseif (!preg_match('@' . $exclusions . '@', $file) && !preg_match('@' . $exclusions . '@', $path . DIRECTORY_SEPARATOR . $file)) {
    return TRUE;
  }

  // This path and/or file are being excluded.
  return FALSE;
}