&1', Shell::AVAILABLE_COMMANDS); if ($shellOutput !== false && $shellOutput->isEmpty()) { $filepath = 'unzip'; } else { $possible_paths = array( '/usr/bin/unzip', '/opt/local/bin/unzip', ); foreach ($possible_paths as $path) { if (file_exists($path)) { $filepath = $path; break; } } } } return $filepath; } /** * * @return string[] */ public static function getWpAddonsSiteLists() { $addonsSites = array(); $pathsToCheck = DUPX_ArchiveConfig::getInstance()->getPathsMapping(); if (is_scalar($pathsToCheck)) { $pathsToCheck = array($pathsToCheck); } foreach ($pathsToCheck as $mainPath) { SnapIO::regexGlobCallback($mainPath, function ($path) use (&$addonsSites) { if (SnapWP::isWpHomeFolder($path)) { $addonsSites[] = $path; } }, array( 'regexFile' => false, 'recursive' => true, )); } return $addonsSites; } /** * Does the site look to be a WordPress site * * @return bool Returns true if the site looks like a WP site */ public static function isWordPress() { $absPathNew = PrmMng::getInstance()->getValue(PrmMng::PARAM_PATH_WP_CORE_NEW); if (!is_dir($absPathNew)) { return false; } if (($root_files = scandir($absPathNew)) == false) { return false; } $file_count = 0; foreach ($root_files as $file) { if (in_array($file, self::$wpCoreDirsList)) { $file_count++; } } return (count(self::$wpCoreDirsList) == $file_count); } }