Ejemplo n.º 1
0
 /**
  *	Method create or remove symlinks for all aliases of the domain
  *
  *	Method create or remove symlinks in directory with domain specific config and 
  *	in directory with virtual hosts (for purpose of apache)
  *
  *	@param bool  $create	if true, function create symlinks, otherwise remove them
  *	@return bool			return TRUE on success, FALSE on failure
  */
 function create_or_remove_all_symlinks($create)
 {
     $errors = array();
     if (false === ($dom_names = $this->get_domain_names(null))) {
         return false;
     }
     foreach ($dom_names as $v) {
         if ($create) {
             if (false === domain_create_symlinks($this->did, $v['name'], $errors)) {
                 ErrorHandler::add_error($errors);
                 return false;
             }
         } else {
             if (false === domain_remove_symlinks($v['name'], $errors)) {
                 ErrorHandler::add_error($errors);
                 return false;
             }
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  *	Method create new alias of the domain. 
  *
  *	@param string $alias	name of new alias
  *	@param array $errors	array with error messages
  *	@return bool			TRUE on success, FALSE on error
  */
 function _add_alias($alias, &$errors)
 {
     global $data;
     $values['id'] = $this->id;
     $values['name'] = $alias;
     if (count($this->dom_names)) {
         $disabled = true;
         // domain is disabled if all domain names are disabled
         foreach ($this->dom_names as $v) {
             $disabled = ($disabled and (bool) $v['disabled']);
         }
     } else {
         // POZOR! tady muze obcas nastavat problem pokud neexistujou zaznamy v DB
         $disabled = false;
     }
     $o = array();
     $o['disabled'] = $disabled;
     $o['set_canon'] = !(bool) count($this->dom_names);
     if (false === $data->add_domain_alias($values, $o, $errors)) {
         return false;
     }
     /* create symlinks and notify ser only if domain isn't disabled */
     if (!$disabled) {
         if (false === domain_create_symlinks($this->id, $values['name'], $errors)) {
             return false;
         }
         /* notify SER to reload domains */
         if (false === $data->reload_domains(null, $errors)) {
             return false;
         }
     }
     return true;
 }