&1'); if ($shellOutput->getCode() >= 0 && $shellOutput->isEmpty()) { $filepath = 'unzip'; } else { $possible_paths = [ '/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(): array { $addonsSites = []; $pathsToCheck = DUPX_ArchiveConfig::getInstance()->getPathsMapping(); if (is_scalar($pathsToCheck)) { $pathsToCheck = [$pathsToCheck]; } foreach ($pathsToCheck as $mainPath) { SnapIO::regexGlobCallback($mainPath, function ($path) use (&$addonsSites): void { if (SnapWP::isWpHomeFolder($path)) { $addonsSites[] = $path; } }, [ '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); } }