feat : depth for search and download source for updates

This commit is contained in:
Florian Schmitt 2024-01-30 21:17:10 +03:00
parent 1e3942f609
commit 5c7858c4e0
2 changed files with 57 additions and 22 deletions

View file

@ -283,6 +283,12 @@ function removePhpFpmConfig($user)
exec('service ' . $_SERVER['phpservice'] . ' reload', $output);
}
function upgradeWiki($srcDir, $destDir)
{
$output = 'Update ' . $destDir;
return $output;
}
function copyYesWikiFiles($domain, $user, $dbUser, $herseUser = null, $hersePass = null, $nossl = null)
{
$tmpFile = '/tmp/yeswiki.zip';
@ -343,13 +349,15 @@ function addStatistics()
}
function searchWikis($path, $pattern)
function searchWikis($path, $pattern, $depth = 1)
{
$it = new RecursiveDirectoryIterator($path);
$list = array();
$httpClient = HttpClientBuilder::buildDefault();
$nb = 0;
foreach (new RecursiveIteratorIterator($it) as $file) {
$files = new RecursiveIteratorIterator($it);
$files->setMaxDepth($depth);
foreach ($files as $file) {
if (preg_match('/' . preg_quote($pattern) . '$/i', $file)) {
$nb++;
$wakkaConfig = [];