Пример #1
0
 /**
  * Implements \Drupal\Core\Form\FormInterface::submitForm().
  */
 public function submitForm(array &$form, array &$form_state)
 {
     $config = $this->config('update.settings');
     // See if the update_check_disabled setting is being changed, and if so,
     // invalidate all update status data.
     if ($form_state['values']['update_check_disabled'] != $config->get('check.disabled_extensions')) {
         update_storage_clear();
     }
     $config->set('check.disabled_extensions', $form_state['values']['update_check_disabled'])->set('check.interval_days', $form_state['values']['update_check_frequency'])->set('notification.emails', $form_state['notify_emails'])->set('notification.threshold', $form_state['values']['update_notification_threshold'])->save();
     parent::submitForm($form, $form_state);
 }
Пример #2
0
/**
 * Respond to themes being disabled.
 *
 * @param array $theme_list
 *   Array containing the names of the themes being disabled.
 *
 * @see theme_disable()
 */
function hook_themes_disabled($theme_list)
{
    // Clear all update module caches.
    update_storage_clear();
}
Пример #3
0
 /**
  * Tests that exactly one fetch task per project is created and not more.
  */
 function testFetchTasks()
 {
     $projecta = array('name' => 'aaa_update_test');
     $projectb = array('name' => 'bbb_update_test');
     $queue = \Drupal::queue('update_fetch_tasks');
     $this->assertEqual($queue->numberOfItems(), 0, 'Queue is empty');
     update_create_fetch_task($projecta);
     $this->assertEqual($queue->numberOfItems(), 1, 'Queue contains one item');
     update_create_fetch_task($projectb);
     $this->assertEqual($queue->numberOfItems(), 2, 'Queue contains two items');
     // Try to add project a again.
     update_create_fetch_task($projecta);
     $this->assertEqual($queue->numberOfItems(), 2, 'Queue still contains two items');
     // Clear storage and try again.
     update_storage_clear();
     update_create_fetch_task($projecta);
     $this->assertEqual($queue->numberOfItems(), 2, 'Queue contains two items');
 }