private static function _checkFiles($basePath, array $files, $fileModifiedSince, $isWpRoot = false, $isWpContent = false, $isWpAdmin = false) { wssLog(__METHOD__ . '(). Scanning: ' . WsdUtil::normalizePath($basePath)); foreach ($files as $file) { $_file = $basePath . $file; $_file = WsdUtil::normalizePath($_file); if (!is_file($_file)) { // if this is the root and wp-config.php file... if ($isWpRoot) { // safely ignore this file if (strcasecmp($file, 'wp-config-sample.php') == 0) { wssLog('wp-config-sample.php file is missing but can be ignored. Skipping file check.'); continue; } elseif (strcasecmp($file, 'wp-config.php') == 0) { // check one level above $path = realpath('../' . ABSPATH) . '/' . $file; if (is_file($path)) { $_file = $path; } else { //#! Mark file not found self::_markFileNotFound($_file); continue; } } elseif (strcasecmp($file, 'readme.html') == 0) { wssLog('readme.html file is missing but can be ignored. Skipping file check.'); continue; } } elseif ($isWpContent) { // Ignore WP's default themes and plugins if not found if (WsdUtil::canIgnoreScanPath($_file)) { wssLog($_file . ' file is missing but can be ignored. Skipping file check.'); continue; } } elseif ($isWpAdmin) { // safely ignore marked files from /wp-admin if (strcasecmp($file, 'install.php') == 0) { wssLog('wp-admin/install.php file is missing but can be ignored. Skipping file check.'); continue; } elseif (strcasecmp($file, 'upgrade.php') == 0) { wssLog('wp-admin/upgrade.php file is missing but can be ignored. Skipping file check.'); continue; } } //#! Mark file not found self::_markFileNotFound($_file); continue; } $mdate = filemtime($_file); if ($mdate > $fileModifiedSince) { //#! Mark file as modified self::_markFileModified($_file, $mdate); } } }
echo '<tbody>'; foreach ($acxFileList as $fileName => $v) { $filePath = $v['filePath']; if (false !== ($pos = stripos($filePath, 'readme'))) { if (!is_file($filePath)) { // safely ignore the readme file continue; } } $p = WsdUtil::getFilePermissions($filePath); $sp = $v['suggestedPermissions']; $cssClass = octdec($p) == octdec($sp) ? 'success' : 'error'; echo '<tr>'; echo '<td class="td_' . $cssClass . '"></td>'; echo '<td>', $fileName, '</td>'; echo '<td>', empty($filePath) ? 'Not Found' : WsdUtil::normalizePath($filePath), '</td>'; //@ Current if ($p > octdec('0')) { echo '<td>', $p, '</td>'; } else { echo '<td>', __('Not Found'), '</td>'; } //@ Suggested if (file_exists($filePath)) { echo '<td>', $sp, '</td>'; } else { if (is_file($filePath)) { echo '<td>0644</td>'; } elseif (is_dir($filePath)) { echo '<td class="center">0755</td>'; } else {