Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443488
Commits
fda6b65d
Commit
fda6b65d
authored
15 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#644150
by sun: () is stateless, even with enabled caching.
parent
16ff5d1a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
includes/form.inc
+18
-6
18 additions, 6 deletions
includes/form.inc
with
18 additions
and
6 deletions
includes/form.inc
+
18
−
6
View file @
fda6b65d
...
...
@@ -227,8 +227,15 @@ function drupal_build_form($form_id, &$form_state) {
// have set $form_state['cache'] to indicate that the original form and the
// $form_state shall be cached. But the form may only be cached if the
// special 'no_cache' property is not set to TRUE.
if
(
$cacheable
&&
!
empty
(
$form_state
[
'cache'
])
&&
empty
(
$form_state
[
'no_cache'
]))
{
form_set_cache
(
$form_build_id
,
$original_form
,
$form_state
);
if
(
!
empty
(
$form_state
[
'cache'
])
&&
empty
(
$form_state
[
'no_cache'
]))
{
// Cache the form upon initial build of the form.
if
(
$cacheable
)
{
form_set_cache
(
$form_build_id
,
$original_form
,
$form_state
);
}
// After processing a cached form, only update the cached form state.
else
{
form_set_cache
(
$form_state
[
'input'
][
'form_build_id'
],
NULL
,
$form_state
);
}
}
}
...
...
@@ -372,11 +379,16 @@ function form_get_cache($form_build_id, &$form_state) {
function
form_set_cache
(
$form_build_id
,
$form
,
$form_state
)
{
// 6 hours cache life time for forms should be plenty.
$expire
=
21600
;
global
$user
;
if
(
$user
->
uid
)
{
$form
[
'#cache_token'
]
=
drupal_get_token
();
// Cache form structure.
if
(
isset
(
$form
))
{
if
(
$GLOBALS
[
'user'
]
->
uid
)
{
$form
[
'#cache_token'
]
=
drupal_get_token
();
}
cache_set
(
'form_'
.
$form_build_id
,
$form
,
'cache_form'
,
REQUEST_TIME
+
$expire
);
}
cache_set
(
'form_'
.
$form_build_id
,
$form
,
'cache_form'
,
REQUEST_TIME
+
$expire
);
// Cache form state.
if
(
!
empty
(
$form_state
[
'build_info'
])
||
!
empty
(
$form_state
[
'storage'
]))
{
$data
=
array
(
'build_info'
=>
$form_state
[
'build_info'
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment