* along with Codendi; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ ini_set('max_execution_time', 0); ini_set('memory_limit', -1); require_once 'pre.php'; $time_start = microtime(true); // First: check if LDAP plugin is active $pluginManager = PluginManager::instance(); $ldapPlugin = $pluginManager->getPluginByName('ldap'); if ($pluginManager->isPluginAvailable($ldapPlugin)) { $ldapQuery = new LDAP_DirectorySynchronization($ldapPlugin->getLdap(), $ldapPlugin->getLogger()); //If script is executed with --dry-run option if (isset($argv[1]) && $argv[1] == "--dry-run") { $users_to_suspend = $ldapQuery->getLdapUserManager()->getUsersToBeSuspended(); $nbr_users_to_suspend = count($users_to_suspend); $nbr_active_users = $ldapQuery->getLdapUserManager()->getNbrActiveUsers(); if ($nbr_users_to_suspend == 0) { echo "No user will be suspended \n"; return; } $percentage_users_to_suspend = $nbr_users_to_suspend / $nbr_active_users * 100; echo "Number of users that will be suspended : " . $nbr_users_to_suspend . "\n"; echo "Number of active users : " . $nbr_active_users . "\n"; if (!($threshold_users_suspension = $ldapPlugin->getLdap()->getLDAPParam('threshold_users_suspension'))) { echo "Threshold : Is Not defined \n"; } else { echo "Threshold : " . $threshold_users_suspension . " % \n"; } echo "Percentage of users that will be suspended : " . $percentage_users_to_suspend . " % \n";