Exemple #1
0
 public function remove()
 {
     $hook = new \Innomatic\Process\Hook($this->rootDA, 'innomatic', 'domain.user.remove');
     if ($hook->callHooks('calltime', $this, array('domainserial' => $this->domainserial, 'userid' => $this->userid)) == \Innomatic\Process\Hook::RESULT_OK) {
         if ($this->userid != 0) {
             $result = $this->domainDA->execute('DELETE FROM domain_users WHERE id=' . (int) $this->userid);
             // Remove user dir
             $domain_query = $this->rootDA->execute('SELECT domainid FROM domains WHERE id=' . (int) $this->domainserial);
             if ($this->container->getHome() . 'core/domains/' . $domain_query->getFields('domainid') . '/users/' . $this->username != $this->container->getHome() . 'core/domains/' . $domain_query->getFields('domainid') . '/users/') {
                 \Innomatic\Io\Filesystem\DirectoryUtils::unlinkTree($this->container->getHome() . 'core/domains/' . $domain_query->getFields('domainid') . '/users/' . $this->username, 0755);
             }
             // Remove cached items
             $cache_gc = new \Innomatic\Datatransfer\Cache\CacheGarbageCollector();
             $cache_gc->removeUserItems((int) $this->userid);
             //$this->htp->remuser( $this->username );
             if ($hook->callHooks('userremoved', $this, array('domainserial' => $this->domainserial, 'userid' => $this->userid)) != \Innomatic\Process\Hook::RESULT_OK) {
                 $result = false;
             }
             $this->userid = 0;
             $this->userExists = false;
         }
     }
     return $result;
 }