reduce some nesting of the code loops

pull/145/head
David Goodwin 7 years ago
parent 898a8145f2
commit f8d7844767

@ -74,7 +74,9 @@ while (($domain = readdir($fr)) !== false) {
//
// Check if it's a dir
//
if ($domain != "." and $domain != ".." and filetype($homedir .'/'. $domain) == "dir") {
if ($domain == "." || $domain == ".." || filetype($homedir .'/'. $domain) != "dir") {
continue;
}
//
// Open the (assumed) DOMAIN directory
//
@ -83,7 +85,10 @@ while (($domain = readdir($fr)) !== false) {
//
// Check for directories assuming it's a user account
//
if ($user!="." and $user!=".." and filetype($homedir .'/'. $domain .'/'. $user) == "dir") {
if ($user == "." || $user == ".." || filetype($homedir .'/'. $domain .'/'. $user) != "dir") {
continue;
}
//
// if the dir 'new' exists inside then it's an account
//
@ -96,8 +101,6 @@ while (($domain = readdir($fr)) !== false) {
echo "UNKNOWN : " . $homedir ."/". $domain ."/". $user ."/new NOT FOUND. Possibly not an account. Leaving untouched\n";
}
}
}
}
}
//
// OK, got an array of accounts from the dir, Now connect to the DB and check them
@ -159,7 +162,10 @@ if (is_array($dir)) {
//
// Is this a user array?
//
if (is_array($value)) {
if (!is_array($value)) {
continue;
}
//
// Go through and nuke the folders
//
@ -167,11 +173,8 @@ if (is_array($dir)) {
// Nuke.. need any more explanations?
$path = $homedir . '/' . $key . '/' . $user;
$sieve_path = $homedir . '/.sieve/' . $key . '/' . $user;
$sieve_exists = false;
$sieve_exists = file_exists($sieve_path);
// check if user has Sieve filters created
if (file_exists($sieve_path)) {
$sieve_exists = true;
}
if ($MAKE_CHANGES) {
deldir($path);
if ($sieve_exists) {
@ -185,7 +188,6 @@ if (is_array($dir)) {
}
}
}
}
}
echo "Cleanup process completed\n";

Loading…
Cancel
Save