Изменяет поле в типе материалов

@internal
@param array $params параметры поля
760863
public function updateField($params)
    {
        
        $params = self::fix_field_params($params);

        $alias = $this->table;
            
		$f = DbConnection::getDbConnection()->fetchArray('SELECT type,len,name FROM types_fields WHERE field_id='.$params['field_id']);
        if (!$f) throw new Exception\CMS(Exception\CMS::EDIT_FIELD);
                
        $type_old = $f[0];
        $len_old  = $f[1];
        $name_old = $f[2];
          
		if (isset($params['type']) && $params['type']) {
			
			if ($type_old != $params['type']) {
					
						  // изменился тип поля
						
						  if ($params['type'] != FIELD_LINKSET && $params['type'] != FIELD_LINKSET2 && $params['type'] != FIELD_MATSET) {
						
							  $params['len'] = stripslashes($params['len']);
							  $def = str_replace('%',$params['len'],$this->field_def[$params['type']]);
							  $params['len'] = (integer) $params['len'];
							
								if ($type_old == FIELD_LINKSET || $type_old == FIELD_LINKSET2 || $type_old == FIELD_MATSET) {
								  
								if ($params['type'] >= 0) 
									$action = 'ADD';
									else $action = false;
								  
									self::drop_link_table($alias, $name_old, $type_old, $len_old, $this->id, $params['pseudo_type']);
								
							} 
							else {
							
								if ($type_old >= 0) { 
							
									if ($params['type'] >= 0) 
									{
										$action = "CHANGE `".$name_old."`";
									}
									else
									{
										DbConnection::getDbConnection()->executeQuery("alter table `$alias` drop `".$name_old."`");
										$action = false;
									}
									
								} else {
								
									$action = 'ADD';
								
								}
									   
							}                     
							
							if ($action)
									DbConnection::getDbConnection()->executeQuery("alter table `$alias` $action `".$params['name']."` $def");
								
						  } else {
						
							if ($type_old >= 0) {
								if ($type_old != FIELD_LINKSET && $type_old != FIELD_LINKSET2 && $type_old != FIELD_MATSET ) {
									  DbConnection::getDbConnection()->executeQuery("alter table `$alias` drop `".$name_old."`");
								} 
								else {
									  self::drop_link_table($alias, $name_old, $type_old, $len_old, $this->id, $params['pseudo_type']);
								}
							}
							self::create_link_table($alias, $params['name'], $params['type'], $params['len'], $this->id, $params['pseudo_type']);
							
						  }
					
			} 
			elseif ($type_old >= 0 && ($params['name'] != $name_old || $params['len'] != $len_old)) {
					
						  if ($params['type']!=FIELD_LINKSET && $params['type']!=FIELD_LINKSET2 && $params['type']!=FIELD_MATSET) {
							  $params['len'] = stripslashes($params['len']);
							  $def = str_replace('%',$params['len'],$this->field_def[$params['type']]);
							  $sql = "alter table `$alias` change `".trim($f[2])."` `".$params['name']."` $def";
							  $params['len'] = (integer) $params['len'];
						  } 
						  else {
							  $tbl = self::get_table($params['type'], $params['len'], $this->id,$params['pseudo_type']);
							  $tbl1 = self::get_table($f[0],$f[1], $this->id,$params['pseudo_type']);
							  $sql = "alter table ".$alias."_".$tbl1."_".$f[2]." rename ".$alias."_".$tbl."_".$params['name'];
						  }
						  DbConnection::getDbConnection()->executeQuery($sql);
					  
			}
			
			$sql = "UPDATE types_fields 
					SET name='".$params['name']."',
						type=".$params['type'].",
						pseudo_type=".$params['pseudo_type'].",
						len=".$params['len'].",
						describ='".$params['describ']."',
						shw=".$params['shw'].",
						required=".$params['required'].",
						default_value='".$params['default_value']."',
						editor=".$params['editor'].",
						editor_user='".$params['editor_user']."',
						page='".$params['page']."',
						tag='".$params['tag']."'
					WHERE field_id=".$params['field_id'];			
		}
		else 
		{
			$sql = "UPDATE types_fields 
					SET 
						describ='".$params['describ']."',
						default_value='".$params['default_value']."',
						page='".$params['page']."'
					WHERE field_id=".$params['field_id'];			
		}
		
		DbConnection::getDbConnection()->executeQuery($sql);    
    }
1193958
public function build(array $params = null) 
    {
        if(null !== $params) {
            $this->setParams($params);
        }
        
        $this->adapter = $this->getDoctrinePaginatorAdapter();
		$this->setCurrentPageNumber($this->getParam('page', 1));
		$this->setDefaultItemCountPerPage($this->getParam('limit', 30));
    }
956413
private function setSaltFromParams(array $params)
    {
        $salt = $this->getMatchingData($params, '/^[\.\\A-Za-z0-9]{22}$/');
        $this->salt = (! empty($salt)) ? $salt : self::DEFAULT_SALT;
    }
315986
public function setParams($params = null)
    {
        if (isset($params)) {
            $this->params = (array) $params;
        } else {
            $this->params = $this->cli->parseParams($this->server->cliArgs());
        }

        return $this;
    }
1043870
protected function runConsole(array $params): void
    {
        $kernel = $this->app->make(KernelContract::class);

        $status = $kernel->handle(
            $input = new ArgvInput(array_values($params)),
            new ConsoleOutput()
        );

        $kernel->terminate($input, $status);

        exit($status);
    }
1242957
public function setParams($params): void
    {
        if (!\is_array($params) && !\is_object($params)) {
            throw new EventException(
                'Event parameters must be an array or object; received `' . \gettype($params) . '`'
            );
        }

        $this->params = $params;
    }
759520
public function push($params)
    {
        foreach ($params as $key => $value) {
            array_set($this->params, $key, $value);
        }
        return $this;
    }
1176611
public function prepareParms($params)
    {
        if (is_array($params)) {
            foreach ($params as $key => $value) {
                array_push($this->setParams, $value);
            }
        } else {
            array_push($this->setParams, $params);
        }
    }
49019
final public function bind(array $params = array())
	{
		$params = $this->bindConversion($params);
		array_map(
			[$this, 'bindParam'],
			array_keys($params),
			array_values($params)
		);

		return $this;
	}
1309622
public function execute (Array $params)
    {
        try {
            $this->_validateParameters($params);
            
            // スケルトンファイルを取得する
            $skeleton = $this->_getSkeletonFile();

            // スケルトンファイルのコンテンツを置換
            $skeleton = str_replace('${command}', $this->command_name, $skeleton);
            file_put_contents(LIB.'/'.APP.'/Commands/'.$this->command_name.'.php', $skeleton);

            $this->log($this->command_name.' command is created!', 'success');
        
        } catch (\Exception $e) {
            $this->errorLog($e->getMessage());
        }
    }
1355464
public function addParams(array $params): self
    {
        foreach ($params as $name => $value) {
            $this->addParam($name, $value);
        }

        return $this;
    }
153760
public function setupParams($params = [])
    {
        if (is_array($params)) {
            $this->params = array_merge($this->params, $params);
        }
        return $this;
    }
665364
public function setUrlParams(array $params) {
		foreach ($params as $param => $value) {
			$this->setUrlParam($param, $value);
		}
		
		return $this;
	}
1260808
public function bind(array $params)
    {
        foreach ($params as $key => $value) {
            $this->addParam($value, $key);
        }
        return $this;
    }
496420
public function setJsInitParams($params)
    {
        foreach ($params as $k => $v) {
            $this->setJsInitParam($k, $v);
        }

        return $this;
    }
258906
public function mergeParameters(array $params = null)
    {
        if (null !== $params) {
            $parameters = $this->getParameters();
            $out = [];
            $i = 1;
            foreach ($parameters as $key => $parameter) {
                $out["rule$i"] = $parameter;
                $i++;
            }
            foreach ($params as $key => $param) {
                $out["rule$i"] = $param;
                $i++;
            }

            $this->setParameters($out);
        }
    }
1371738
public function initialize(array $params)
    {
        $this->params = $params;
        switch ($params['type']) {
            case self::TYPE_PROCESS:
                $this->establishProcessConnection();
                break;
            case self::TYPE_SOCKET:
            default:
                $this->establishSocketConnection();
                break;
        }
    }