Révision 582db59d
Ajouté par Assos Assos il y a plus de 8 ans
drupal7/includes/common.inc | ||
---|---|---|
1057 | 1057 |
|
1058 | 1058 |
switch ($code) { |
1059 | 1059 |
case 200: // OK |
1060 |
case 201: // Created |
|
1061 |
case 202: // Accepted |
|
1062 |
case 203: // Non-Authoritative Information |
|
1063 |
case 204: // No Content |
|
1064 |
case 205: // Reset Content |
|
1065 |
case 206: // Partial Content |
|
1060 | 1066 |
case 304: // Not modified |
1061 | 1067 |
break; |
1062 | 1068 |
case 301: // Moved permanently |
... | ... | |
2812 | 2818 |
* into script execution a call such as set_time_limit(20) is made, the |
2813 | 2819 |
* script will run for a total of 45 seconds before timing out. |
2814 | 2820 |
* |
2815 |
* It also means that it is possible to decrease the total time limit if
|
|
2816 |
* the sum of the new time limit and the current time spent running the
|
|
2817 |
* script is inferior to the original time limit. It is inherent to the way
|
|
2818 |
* set_time_limit() works, it should rather be called with an appropriate
|
|
2819 |
* value every time you need to allocate a certain amount of time |
|
2821 |
* If the current time limit is not unlimited it is possible to decrease the
|
|
2822 |
* total time limit if the sum of the new time limit and the current time spent
|
|
2823 |
* running the script is inferior to the original time limit. It is inherent to
|
|
2824 |
* the way set_time_limit() works, it should rather be called with an
|
|
2825 |
* appropriate value every time you need to allocate a certain amount of time
|
|
2820 | 2826 |
* to execute a task than only once at the beginning of the script. |
2821 | 2827 |
* |
2822 | 2828 |
* Before calling set_time_limit(), we check if this function is available |
... | ... | |
2833 | 2839 |
*/ |
2834 | 2840 |
function drupal_set_time_limit($time_limit) { |
2835 | 2841 |
if (function_exists('set_time_limit')) { |
2836 |
@set_time_limit($time_limit); |
|
2842 |
$current = ini_get('max_execution_time'); |
|
2843 |
// Do not set time limit if it is currently unlimited. |
|
2844 |
if ($current != 0) { |
|
2845 |
@set_time_limit($time_limit); |
|
2846 |
} |
|
2837 | 2847 |
} |
2838 | 2848 |
} |
2839 | 2849 |
|
... | ... | |
5212 | 5222 |
fix_gpc_magic(); |
5213 | 5223 |
// Load all enabled modules |
5214 | 5224 |
module_load_all(); |
5225 |
// Reset drupal_alter() and module_implements() static caches as these |
|
5226 |
// include implementations for vital modules only when called early on |
|
5227 |
// in the bootstrap. |
|
5228 |
drupal_static_reset('drupal_alter'); |
|
5229 |
drupal_static_reset('module_implements'); |
|
5215 | 5230 |
// Make sure all stream wrappers are registered. |
5216 | 5231 |
file_get_stream_wrappers(); |
5217 | 5232 |
// Ensure mt_rand is reseeded, to prevent random values from one page load |
... | ... | |
5308 | 5323 |
* |
5309 | 5324 |
* Do not call this function from a test. Use $this->cronRun() instead. |
5310 | 5325 |
* |
5311 |
* @return |
|
5312 |
* TRUE if cron ran successfully. |
|
5326 |
* @return bool
|
|
5327 |
* TRUE if cron ran successfully and FALSE if cron is already running.
|
|
5313 | 5328 |
*/ |
5314 | 5329 |
function drupal_cron_run() { |
5315 | 5330 |
// Allow execution to continue even if the request gets canceled. |
... | ... | |
5371 | 5386 |
// Do not run if queue wants to skip. |
5372 | 5387 |
continue; |
5373 | 5388 |
} |
5374 |
$function = $info['worker callback'];
|
|
5389 |
$callback = $info['worker callback'];
|
|
5375 | 5390 |
$end = time() + (isset($info['time']) ? $info['time'] : 15); |
5376 | 5391 |
$queue = DrupalQueue::get($queue_name); |
5377 | 5392 |
while (time() < $end && ($item = $queue->claimItem())) { |
5378 | 5393 |
try { |
5379 |
$function($item->data);
|
|
5394 |
call_user_func($callback, $item->data);
|
|
5380 | 5395 |
$queue->deleteItem($item); |
5381 | 5396 |
} |
5382 | 5397 |
catch (Exception $e) { |
... | ... | |
7083 | 7098 |
* specification of a schema, as it was defined in a module's |
7084 | 7099 |
* hook_schema(). No additional default values will be set, |
7085 | 7100 |
* hook_schema_alter() is not invoked and these unprocessed |
7086 |
* definitions won't be cached. |
|
7101 |
* definitions won't be cached. To retrieve the schema after |
|
7102 |
* hook_schema_alter() has been invoked use drupal_get_schema(). |
|
7087 | 7103 |
* |
7088 | 7104 |
* This function can be used to retrieve a schema specification in |
7089 | 7105 |
* hook_schema(), so it allows you to derive your tables from existing |
... | ... | |
7156 | 7172 |
*/ |
7157 | 7173 |
function drupal_schema_field_types($table) { |
7158 | 7174 |
$table_schema = drupal_get_schema($table); |
7175 |
$field_types = array(); |
|
7159 | 7176 |
foreach ($table_schema['fields'] as $field_name => $field_info) { |
7160 | 7177 |
$field_types[$field_name] = isset($field_info['type']) ? $field_info['type'] : NULL; |
7161 | 7178 |
} |
... | ... | |
7363 | 7380 |
* Information stored in a module .info file: |
7364 | 7381 |
* - name: The real name of the module for display purposes. |
7365 | 7382 |
* - description: A brief description of the module. |
7366 |
* - dependencies: An array of shortnames of other modules this module requires. |
|
7383 |
* - dependencies: An array of dependency strings. Each is in the form |
|
7384 |
* 'project:module (versions)'; with the following meanings: |
|
7385 |
* - project: (optional) Project shortname, recommended to ensure uniqueness, |
|
7386 |
* if the module is part of a project hosted on drupal.org. If omitted, |
|
7387 |
* also omit the : that follows. The project name is currently ignored by |
|
7388 |
* Drupal core but is used for automated testing. |
|
7389 |
* - module: (required) Module shortname within the project. |
|
7390 |
* - (versions): Optional version information, consisting of one or more |
|
7391 |
* comma-separated operator/value pairs or simply version numbers, which |
|
7392 |
* can contain "x" as a wildcard. Examples: (>=7.22, <7.28), (7.x-3.x). |
|
7367 | 7393 |
* - package: The name of the package of modules this module belongs to. |
7368 | 7394 |
* |
7369 | 7395 |
* See forum.info for an example of a module .info file. |
... | ... | |
7443 | 7469 |
*/ |
7444 | 7470 |
function drupal_parse_info_format($data) { |
7445 | 7471 |
$info = array(); |
7446 |
$constants = get_defined_constants(); |
|
7447 | 7472 |
|
7448 | 7473 |
if (preg_match_all(' |
7449 | 7474 |
@^\s* # Start at the beginning of a line, ignoring leading whitespace |
... | ... | |
7483 | 7508 |
} |
7484 | 7509 |
|
7485 | 7510 |
// Handle PHP constants. |
7486 |
if (isset($constants[$value])) {
|
|
7487 |
$value = $constants[$value];
|
|
7511 |
if (preg_match('/^\w+$/i', $value) && defined($value)) {
|
|
7512 |
$value = constant($value);
|
|
7488 | 7513 |
} |
7489 | 7514 |
|
7490 | 7515 |
// Insert actual value. |
... | ... | |
7648 | 7673 |
* Parses a dependency for comparison by drupal_check_incompatibility(). |
7649 | 7674 |
* |
7650 | 7675 |
* @param $dependency |
7651 |
* A dependency string, for example 'foo (>=7.x-4.5-beta5, 3.x)'. |
|
7676 |
* A dependency string, which specifies a module dependency, and optionally |
|
7677 |
* the project it comes from and versions that are supported. Supported |
|
7678 |
* formats include: |
|
7679 |
* - 'module' |
|
7680 |
* - 'project:module' |
|
7681 |
* - 'project:module (>=version, version)' |
|
7652 | 7682 |
* |
7653 | 7683 |
* @return |
7654 | 7684 |
* An associative array with three keys: |
... | ... | |
7663 | 7693 |
* @see drupal_check_incompatibility() |
7664 | 7694 |
*/ |
7665 | 7695 |
function drupal_parse_dependency($dependency) { |
7696 |
$value = array(); |
|
7697 |
// Split out the optional project name. |
|
7698 |
if (strpos($dependency, ':')) { |
|
7699 |
list($project_name, $dependency) = explode(':', $dependency); |
|
7700 |
$value['project'] = $project_name; |
|
7701 |
} |
|
7666 | 7702 |
// We use named subpatterns and support every op that version_compare |
7667 | 7703 |
// supports. Also, op is optional and defaults to equals. |
7668 | 7704 |
$p_op = '(?P<operation>!=|==|=|<|<=|>|>=|<>)?'; |
... | ... | |
7671 | 7707 |
$p_major = '(?P<major>\d+)'; |
7672 | 7708 |
// By setting the minor version to x, branches can be matched. |
7673 | 7709 |
$p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)'; |
7674 |
$value = array(); |
|
7675 | 7710 |
$parts = explode('(', $dependency, 2); |
7676 | 7711 |
$value['name'] = trim($parts[0]); |
7677 | 7712 |
if (isset($parts[1])) { |
Formats disponibles : Unified diff
Update Drupal core to version 7.40