Exemplo n.º 1
0
function __shutdown_test()
{
    try {
        // We need to be root to delete test principals
        $myUManager = UMManager::getInstance();
        $subject = new Subject();
        $loginContext = new LoginContext('init', $subject);
        $subject->getPrivateCredentials()->append(new EyeosPasswordCredential('root', 'root'));
        $loginContext->login();
        // we need a fake shutdown process
        $procManager = ProcManager::getInstance();
        $myProcess = new Process('shutdown');
        $procManager->execute($myProcess);
        $procManager->setProcessLoginContext($myProcess->getPid(), $loginContext);
        // clean deletion of users
        foreach (UMManager::getInstance()->getAllUsers() as $user) {
            UMManager::getInstance()->deletePrincipal($user);
        }
        AdvancedPathLib::rmdirs(USERS_PATH, true);
    } catch (Exception $e) {
        echo 'Uncaught exception on shutdown!' . "\n";
        ExceptionStackUtil::printStackTrace($e, false);
    }
}
Exemplo n.º 2
0
 public function printStackTrace($htmlFormat = false)
 {
     ExceptionStackUtil::printStackTrace($this, $htmlFormat);
 }