/**
  * Remove all pub SSH keys previously associated to a user
  *
  * @param User $user
  */
 protected function removeUserExistingKeys($user)
 {
     $keydir = 'keydir';
     if (is_dir($keydir)) {
         $dir = new DirectoryIterator($keydir);
         foreach ($dir as $file) {
             $userbase = $user->getUserName() . '@';
             if (preg_match('/^' . $userbase . '[0-9]+.pub$/', $file)) {
                 $this->gitExec->rm($file->getPathname());
             }
         }
     }
 }
 public function deleteMirror($old_hostname)
 {
     $git_modifications = $this->gitolite_conf_writer->deleteMirror($old_hostname);
     foreach ($git_modifications->toRemove() as $file) {
         $file_path = $this->getAdminPath() . '/' . $file;
         if (is_dir($file_path)) {
             if (!$this->gitExec->recursiveRm($file)) {
                 return false;
             }
         } elseif (is_file($file_path)) {
             if (!$this->gitExec->rm($file)) {
                 return false;
             }
         }
     }
     return true;
 }