From f81c7606e5b91c1df39ad8c27b5a1ac6d8c3a2ab Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Tue, 30 Dec 2014 09:44:18 +1300 Subject: [PATCH] CRM-15764. Remove bogus opendir() call. opendir($cmsIncludePath) appears to have been used as is_dir(), not required since we check file_exists("$cmsIncludePath/file.xxx") and that indicates that the directory exists. --- CRM/Utils/System/Drupal.php | 4 +--- CRM/Utils/System/Drupal6.php | 4 +--- CRM/Utils/System/WordPress.php | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index 06cb699977..8445519253 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -784,9 +784,7 @@ AND u.status = 1 $cmsRoot = $firstVar . '/' . implode('/', $pathVars); $cmsIncludePath = "$cmsRoot/includes"; // Stop if we find bootstrap. - // - // @TODO What is opendir() here for? - if (opendir($cmsIncludePath) && file_exists("$cmsIncludePath/bootstrap.inc")) { + if (file_exists("$cmsIncludePath/bootstrap.inc")) { $valid = TRUE; break; } diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 665a7c4595..2847fc5a9d 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -728,9 +728,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { $cmsRoot = $firstVar . '/' . implode('/', $pathVars); $cmsIncludePath = "$cmsRoot/includes"; // Stop if we found bootstrap. - // - // @TODO What is opendir() here for? - if (opendir($cmsIncludePath) && file_exists("$cmsIncludePath/bootstrap.inc")) { + if (file_exists("$cmsIncludePath/bootstrap.inc")) { $valid = TRUE; break; } diff --git a/CRM/Utils/System/WordPress.php b/CRM/Utils/System/WordPress.php index 10169a1362..a656a44be1 100644 --- a/CRM/Utils/System/WordPress.php +++ b/CRM/Utils/System/WordPress.php @@ -509,7 +509,7 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { */ public function validInstallDir($dir) { $includePath = "$dir/wp-includes"; - if (opendir($includePath) && file_exists("$includePath/version.php")) { + if (file_exists("$includePath/version.php")) { return TRUE; } return FALSE; -- 2.25.1