Projet

Général

Profil

Révision ed9a13f1

Ajouté par Assos Assos il y a presque 4 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/feeds/plugins/FeedsHTTPFetcher.inc
73 73
    return $this->sanitizeRawOptimized($this->raw);
74 74
  }
75 75

  
76
  /**
77
   * Returns the configured value for the request timeout option.
78
   *
79
   * @return int
80
   *   Timeout in seconds to wait for an HTTP get request to finish.
81
   */
76 82
  public function getTimeout() {
77 83
    return $this->timeout;
78 84
  }
79 85

  
86
  /**
87
   * Sets the request timeout option.
88
   *
89
   * @param int $timeout
90
   *   Timeout in seconds to wait for an HTTP get request to finish.
91
   */
80 92
  public function setTimeout($timeout) {
81 93
    $this->timeout = $timeout;
82 94
  }
......
151 163
        $source->existing()->import();
152 164
      }
153 165
      catch (Exception $e) {
154
        // In case of an error, respond with a 503 Service (temporary) unavailable.
166
        // In case of an error, respond with a 503 Service (temporary)
167
        // unavailable.
155 168
        $source->log('import', 'An exception occurred: %exception', array('%exception' => $e->getMessage()), WATCHDOG_ERROR);
156 169
        header('HTTP/1.1 503 "Not Found"', NULL, 503);
157 170
        drupal_exit();
......
219 232
    $form['advanced']['request_timeout'] = array(
220 233
      '#type' => 'textfield',
221 234
      '#title' => t('Request timeout'),
222
      '#description' => t('Timeout in seconds to wait for an HTTP get request to finish.</br>' .
223
                         '<b>Note:</b> this setting will override the global setting.</br>' .
224
                         'When left empty, the global value is used.'),
235
      '#description' => t('Timeout in seconds to wait for an HTTP get request to finish.') . '<br />' . t('<strong>Note:</strong> if left empty, the global timeout setting will be used, which is @timeout seconds. You can set the global timeout setting by setting the variable "@variable".', array(
236
        '@timeout' => variable_get('http_request_timeout', 30),
237
        '@variable' => 'http_request_timeout',
238
      )),
225 239
      '#default_value' => $this->config['request_timeout'],
226 240
      '#element_validate' => array('element_validate_integer_positive'),
227 241
      '#maxlength' => 3,
228
      '#size'=> 30,
242
      '#size' => 30,
229 243
    );
230 244
    $form['advanced']['accept_invalid_cert'] = array(
231 245
      '#type' => 'checkbox',
......
348 362
   */
349 363
  public function importPeriod(FeedsSource $source) {
350 364
    if ($this->subscriber($source->feed_nid)->subscribed()) {
351
      return 259200; // Delay for three days if there is a successful subscription.
365
      // Delay for three days if there is a successful subscription.
366
      return 259200;
352 367
    }
353 368
  }
354 369

  
......
358 373
  protected function subscriber($subscriber_id) {
359 374
    return PushSubscriber::instance($this->id, $subscriber_id, 'PuSHSubscription', PuSHEnvironment::instance());
360 375
  }
376

  
361 377
}
362 378

  
363 379
/**
......
414 430
      ->condition('subscriber_id', $this->subscriber_id)
415 431
      ->execute();
416 432
  }
433

  
417 434
}
418 435

  
419 436
/**
420 437
 * Provide environmental functions to the PuSHSubscriber library.
421 438
 */
422 439
class PuSHEnvironment implements PuSHSubscriberEnvironmentInterface {
440

  
423 441
  /**
424 442
   * Singleton.
425 443
   */
......
446 464
      case 'error':
447 465
        $severity = WATCHDOG_ERROR;
448 466
        break;
467

  
449 468
      case 'warning':
450 469
        $severity = WATCHDOG_WARNING;
451 470
        break;
471

  
452 472
      default:
453 473
        $severity = WATCHDOG_NOTICE;
454 474
        break;
......
456 476
    feeds_dbg($msg);
457 477
    watchdog('FeedsHTTPFetcher', $msg, array(), $severity);
458 478
  }
479

  
459 480
}

Formats disponibles : Unified diff