When variable_get() can be used while variable_set() has not been used?

StackOverflow https://stackoverflow.com/questions/22525774

  •  17-06-2023
  •  | 
  •  

Pergunta

I am studying a code of other programmer. All are clear except the following line:

 $line_max = variable_get('user_import_line_max', 1000);

How this line exactly works. It does not make any sense to me. As far I know variable_get() is used to retrieve the value of variable_set(). But there is no variable_set() method in my module. If the above line simply assign 1000 to $line_max. Why $line_max=1000; was not used?

this may be a silly question but we have to undergo through this process. Please help me. Thanks in advance.

Foi útil?

Solução

Using variable_get() opens up the possibility of setting a variable elsewhere in code or in settings.php to set the preferred value. Using settings.php is as simple as adding

$conf['user_import_line_max'] = 500;

at the end of the settings.php file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top