variable_set

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/bootstrap.inc, строка 464

Версии
5 – 6
variable_set($name, $value)

Устанавливает постоянную переменную.

Параметры

$name Имя устанавливаемой переменной.

$value Устанавливаемое значение. Может быть любого типа данных, так как функция умеет сериализировать данные при необходимости.

▾ 51 функции вызывают variable_set()

block_example_block in developer/examples/block_example.module
Реализация hook_block().
cache_clear_all in includes/cache.inc
Очищает кэш. Если вызывается без аргументов, то очищаются таблицы с кэшами страниц и блоков.
cache_get in includes/cache.inc
Return data from the persistent cache.
color_scheme_form_submit in modules/color/color.module
Submit handler for color change form.
comment_update_1 in modules/comment/comment.install
Changed node_comment_statistics to use node->changed to avoid future timestamps.
default_profile_final in profiles/default/default.profile
Perform any final installation tasks for this profile.
drupal_cron_run in includes/common.inc
При вызове выполняет задачи cron
drupal_get_private_key in includes/common.inc
Гарантирует, что переменная персонального ключа, которая используется для генерации токенов установлена.
example_form_submit in ./example.profile
Form API submit for the example form.
example_profile_tasks in ./example.profile
Perform any final installation tasks for this profile.
file_directory_temp in includes/file.inc
Определеляет папку по умолчанию для хранения временных файлов.
filter_admin_overview_submit in modules/filter/filter.module
forum_block in modules/forum/forum.module
Реализация hook_block().
forum_form_submit in modules/forum/forum.module
Process forum form and container form submissions.
forum_taxonomy in modules/forum/forum.module
Implementation of hook_taxonomy().
hook_block in developer/hooks/core.php
Определяет блок или набор блоков.
hook_node_type in developer/hooks/node.php
Позволяет модулям осуществлять действия при изменении типа нод.
hook_taxonomy in developer/hooks/core.php
Выполняется при изменениях таксономии.
hook_update_index in developer/hooks/core.php
Обновляет полнотекстовый индекс Друпала для данного модуля.
install_complete in ./install.php
Page displayed when the installation is complete. Called from install.php.
multipage_form_example_custom_submit in developer/examples/multipage_form_example.module
node_type_form_submit in modules/node/content_types.inc
Implementation of hook_form_submit().
node_update_index in modules/node/node.module
Реализация hook_update_index().
node_update_shutdown in modules/node/node.module
shutdown function to make sure we always mark the last node processed.
profile_block in modules/profile/profile.module
Реализация hook_block().
statistics_block in modules/statistics/statistics.module
Реализация hook_block().
statistics_cron in modules/statistics/statistics.module
Реализация hook_cron().
system_node_type in modules/system/system.module
Implementation of hook_node_type().
system_settings_form_submit in modules/system/system.module
Execute the system_settings_form.
system_themes_submit in modules/system/system.module
system_theme_settings_submit in modules/system/system.module
system_update_1018 in modules/system/system.install
Change break tag (was removed, see 1020).
system_update_1019 in modules/system/system.install
Change variable format for user-defined e-mails.
system_update_1021 in modules/system/system.install
Update two more variables that were missing from system_update_1019.
system_update_1022 in modules/system/system.install
Add index on users created column.
system_update_119 in modules/system/system.install
system_update_126 in modules/system/system.install
system_update_145 in modules/system/system.install
system_update_151 in modules/system/system.install
system_update_160 in modules/system/system.install
system_update_165 in modules/system/system.install
system_update_179 in modules/system/system.install
Update base paths for relative URLs in custom blocks, profiles and various variables.
throttle_exit in modules/throttle/throttle.module
Implementation of hook_exit().
update_fix_access_table in ./update.php
update_fix_schema_version in ./update.php
If the schema version for Drupal core is stored in the variables table (4.6.x and earlier) move it to the schema_version column of the system table.
update_fix_sessions in ./update.php
System update 130 changes the sessions table, which breaks the update script's ability to use session variables. This changes the table appropriately.
update_fix_watchdog in ./update.php
System update 142 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.
update_fix_watchdog_115 in ./update.php
System update 115 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.
user_block in modules/user/user.module
Реализация hook_block().
_color_render_images in modules/color/color.module
Render images that match a given palette.
_forum_get_vid in modules/forum/forum.module
Returns the vocabulary id for forum navigation.

Код

<?php
function variable_set($name, $value) {
  global $conf;

  db_lock_table('variable');
  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
  db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
  db_unlock_tables();

  cache_clear_all('variables', 'cache');

  $conf[$name] = $value;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему