本文整理汇总了PHP中variable_del函数的典型用法代码示例。如果您正苦于以下问题:PHP variable_del函数的具体用法?PHP variable_del怎么用?PHP variable_del使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了variable_del函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hook_cleaner_settings
/**
* Create Cleaner settings form.
*
* @return array
* Form of the cleaner settings page.
*/
function hook_cleaner_settings()
{
// Add CSS to the admin settings page.
drupal_add_css(drupal_get_path('module', 'cleaner') . '/cleaner.css');
$form = array();
$yes_no = array(t('No'), t('Yes'));
$inline = array('class' => array('container-inline'));
$interval = array(0 => t('Every time')) + Cleaner::$intervals;
$form['cleaner_cron'] = array('#type' => 'radios', '#title' => t('Run interval'), '#options' => $interval, '#default_value' => variable_get('cleaner_cron', 3600), '#description' => t('This is how often the options below will occur. The actions will occur on the next Cron run after this interval expires. "Every time" means on every Cron run.'), '#attributes' => $inline);
$form['cleaner_clear_cache'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up cache'), '#default_value' => variable_get('cleaner_clear_cache', 0), '#description' => Cleaner::cleanerGetCacheTablesTable(), '#attributes' => $inline);
$form['cleaner_empty_watchdog'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up Watchdog'), '#default_value' => variable_get('cleaner_empty_watchdog', 0), '#description' => t('There is a standard setting for controlling Watchdog contents. This is more useful for test sites.'), '#attributes' => $inline);
$cookie = session_get_cookie_params();
$select = db_select('sessions', 's')->fields('s', array('timestamp'))->condition('timestamp', REQUEST_TIME - $cookie['lifetime'], '<');
$count = $select->execute()->rowCount();
$form['cleaner_clean_sessions'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up Sessions table'), '#default_value' => variable_get('cleaner_clean_sessions', 0), '#description' => t('The sessions table can quickly become full with old, abandoned sessions. This will delete all sessions older than @interval (as set by your site administrator). There are currently @count such sessions.', array('@interval' => format_interval($cookie['lifetime']), '@count' => $count)), '#attributes' => $inline);
$form['cleaner_clean_cssdir'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up CSS files'), '#default_value' => variable_get('cleaner_clean_cssdir', 0), '#description' => t('The CSS directory can become full with stale and outdated cache files. This will delete all CSS cache files but the latest.'), '#attributes' => $inline);
$form['cleaner_clean_jsdir'] = array('#type' => 'radios', '#options' => $yes_no, '#title' => t('Clean up JS files'), '#default_value' => variable_get('cleaner_clean_jsdir', 0), '#description' => t('The JS directory can become full with stale and outdated cache files. This will delete all JS cache files but the latest.'), '#attributes' => $inline);
// We can only offer OPTIMIZE to MySQL users.
if (db_driver() == 'mysql') {
$form['cleaner_optimize_db'] = array('#type' => 'radios', '#options' => $yes_no + array('2' => 'Local only'), '#title' => t('Optimize tables with "overhead" space'), '#default_value' => variable_get('cleaner_optimize_db', 0), '#description' => t('The module will compress (optimize) all database tables with unused space. <strong>NOTE</strong>: During an optimization, the table will locked against any other activity; on a high vloume site, this may be undesirable. "Local only" means do not replicate the optimization (if it is being done).'), '#attributes' => $inline);
} else {
// If not MySQL, delete(reset) the variable.
variable_del('cleaner_optimize_db');
}
return array('cleaner' => $form);
}
示例2: doVariablesCleanupByTemplate
/**
* Cleans up variables by template.
*/
public static function doVariablesCleanupByTemplate($template)
{
$result = db_query("\n SELECT name FROM {variable}\n WHERE name LIKE '" . $template . "'");
foreach ($result as $row) {
variable_del($row->name);
}
}
示例3: reset_settings
/**
* Resets module settings
*/
public function reset_settings()
{
variable_del('mylivechat_id');
variable_del('mylivechat_displaytype');
variable_del('mylivechat_membership');
variable_del('mylivechat_encrymode');
variable_del('mylivechat_encrykey');
}
示例4: restTearDown
/**
* Tear down REST test.
*
* Call this from tearDown() method of your test class.
*/
protected function restTearDown()
{
// Delete storage.
unset($this->responseStorage);
// Unset response file variable.
variable_del('site_test_rest_response_file');
$this->refreshVariablesRunner();
}
示例5: variable_move
function variable_move($old, $new)
{
$val = variable_get($old, NULL);
if (!is_null($value)) {
variable_set($new, $val);
variable_del($old);
}
}
示例6: vdel
/**
* Method for deleting a key and its value from the caching mechanism.
*
* @param string $key
* The key that will be deleted, along with its value.
*
* @return NULL
* Returns after corresponding delete functionality finishes.
*/
public function vdel($key)
{
if ($this->memcacheExists) {
$this->mem->clear($key);
return;
}
variable_del($key);
}
示例7: marketplace_reset_settings
function marketplace_reset_settings()
{
global $theme_key;
variable_del('theme_' . $theme_key . '_settings');
variable_del('theme_settings');
$cache =& drupal_static('theme_get_setting', array());
$cache[$theme_key] = NULL;
}
示例8: clearAll
/**
* Clear all Zeitgeist cache entries.
*/
public static function clearAll()
{
$known_cids = array_keys(static::getCids());
foreach ($known_cids as $cid) {
$core_cid = static::prefixCid($cid);
cache_clear_all($core_cid, Cache::BIN);
}
variable_del(static::VARCIDS);
}
示例9: restoreVariables
/**
* Restores the initial values of the Drupal variables.
*
* @AfterScenario
*/
public function restoreVariables()
{
foreach ($this->initialVariables as $variable => $value) {
if ($value === NULL) {
variable_del($variable);
} else {
variable_set($variable, $value);
}
}
}
示例10: baseSetUp
/**
* Sets up modules for API tests, and saves the default branch for teardown.
*/
function baseSetUp()
{
// This is restored in the tearDown() function.
$this->default_branch = variable_get('api_default_branch', NULL);
variable_del('api_default_branch');
DrupalWebTestCase::setUp('drupal_queue', 'grammar_parser', 'ctools', 'api');
include_once drupal_get_path('module', 'api') . '/api.admin.inc';
include_once drupal_get_path('module', 'api') . '/parser.inc';
drupal_queue_include();
// Set up a super-user.
$this->super_user = $this->drupalCreateUser(array('access API reference', 'administer API reference', 'access content', 'access administration pages', 'administer blocks', 'administer nodes'));
$this->drupalLogin($this->super_user);
}
示例11: gd_cache_admin_settings_submit
function gd_cache_admin_settings_submit($form, &$form_state) {
$text = StringHelper::trim($form_state['values']['resources']);
$resourceIds = isset($text) ? gd_cache_parse_resources($text): NULL;
$storageValue = isset($resourceIds) ? implode("\n", $resourceIds) : NULL;
if (isset($storageValue)) {
variable_set(VARIABLE_NAME__CACHE_URL, $storageValue);
$message = t('@count URLs saved', array('@count' => count($resourceIds)));
}
else {
variable_del(VARIABLE_NAME__CACHE_URL);
$message = t('List of URLs is cleared');
}
drupal_set_message($message);
}
示例12: handle
/**
* Implements AcsfEventHandler::handle().
*/
public function handle()
{
drush_print(dt('Entered @class', array('@class' => get_class($this))));
if (!$this->isComplete()) {
$site = acsf_get_acsf_site();
$site->clean();
variable_del('acsf_duplication_scrub_status');
variable_set('site_name', $this->event->context['site_name']);
variable_set('install_time', time());
// As a preparatory step, remove any corrupt file entries that may prevent
// duplication from succeeding. Specifically, remove any file with an
// empty URI string.
db_delete('file_managed')->condition('uri', '')->execute();
$this->setComplete();
}
}
示例13: brafton_admin_form_submit
function brafton_admin_form_submit($form, &$form_state)
{
//reset the error report
if ($form_state['values']['brafton_clear_report']) {
variable_set('brafton_e_log', '');
//variable_set('brafton_clear_report', 0);
}
//runs importer if archive is loaded
//Handles background image for videos
if ($form_state['values']['brafton_video_end_cta_background'] != '') {
$file = file_load($form_state['values']['brafton_video_end_cta_background']);
// Change status to permanent.
$file->status = FILE_STATUS_PERMANENT;
// Save.
$newfile = file_save($file);
$name = basename('brafton.module', '.module');
file_usage_add($newfile, $name, $name, $newfile->fid);
variable_set('brafton_video_end_cta_background_url', $newfile->uri);
variable_set('brafton_video_end_cta_background_id', $newfile->fid);
} else {
if (!$form_state['values']['brafton_video_end_cta_background']['fid']) {
variable_set('brafton_video_end_cta_background_url', '');
variable_del('brafton_video_end_cta_background_id');
}
}
//Handles Button Image for videos
if ($form_state['values']['brafton_video_end_cta_button_image'] != '') {
$file = file_load($form_state['values']['brafton_video_end_cta_button_image']);
// Change status to permanent.
$file->status = FILE_STATUS_PERMANENT;
// Save.
$newfile = file_save($file);
$name = basename('brafton.module', '.module');
file_usage_add($newfile, $name, $name, $newfile->fid);
variable_set('brafton_video_end_cta_button_image_url', $newfile->uri);
variable_set('brafton_video_end_cta_button_image_id', $newfile->fid);
} else {
if (!$form_state['values']['brafton_video_end_cta_button_image']['fid']) {
variable_set('brafton_video_end_cta_button_image_url', '');
variable_del('brafton_video_end_cta_button_image_id');
}
}
//Ensure that the run manual imports
$form_state['values']['brafton_clear_report'] = 0;
}
示例14: tac_admin_submit
function tac_admin_submit($form, &$form_state)
{
db_delete('tac_map')->execute();
$vocabulary = $form_state['values']['vocabulary'];
if ($vocabulary > 0 && $vocabulary != variable_get('tac_vocabulary')) {
variable_set('tac_vocabulary', $vocabulary);
node_access_needs_rebuild(TRUE);
return;
} elseif ($vocabulary <= 0) {
variable_del('tac_vocabulary');
node_access_needs_rebuild(TRUE);
return;
}
$insert = db_insert('tac_map')->fields(array('rid', 'tid', 'grant_list', 'grant_create', 'grant_update', 'grant_delete'));
foreach ($form_state['values']['edit'] as $rid => $terms) {
foreach ($terms as $tid => $grants) {
$insert->values(array($rid, $tid, $grants['list'], $grants['create'], $grants['update'], $grants['delete']));
}
}
$insert->execute();
}
示例15: handle
/**
* Implements AcsfEventHandler::handle().
*/
public function handle()
{
drush_print(dt('Entered @class', array('@class' => get_class($this))));
$options = $this->event->context['scrub_options'];
variable_del('cron_last');
variable_del('cron_semaphore');
variable_del('node_cron_last');
variable_del('drupal_private_key');
variable_set('cron_key', drupal_hash_base64(drupal_random_bytes(55)));
// Ensure Drupal filesystem related configuration variables are correct for
// the new site. Consider the following variables:
// - file_directory_path
// - file_directory_temp
// - file_private_path
// - file_temporary_path
// Given the AH environment for Gardens, we want to leave the temp paths
// alone, and we want to delete the other variables, to ensure they reset to
// their defaults (because of scarecrow, these shouldn't exist in the
// variable table anyway).
$file_path_variables = array('file_directory_path', 'file_private_path');
foreach ($file_path_variables as $variable) {
variable_del($variable);
}
}