Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
195503e2
Commit
195503e2
authored
Sep 19, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2338571
by znerol: Remove SessionManager::startLazy().
parent
2a0254f9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
153 additions
and
149 deletions
+153
-149
core/authorize.php
core/authorize.php
+1
-1
core/includes/install.core.inc
core/includes/install.core.inc
+1
-1
core/lib/Drupal/Core/Authentication/Provider/Cookie.php
core/lib/Drupal/Core/Authentication/Provider/Cookie.php
+1
-1
core/lib/Drupal/Core/DrupalKernel.php
core/lib/Drupal/Core/DrupalKernel.php
+3
-9
core/lib/Drupal/Core/Session/SessionManager.php
core/lib/Drupal/Core/Session/SessionManager.php
+38
-25
core/lib/Drupal/Core/Session/SessionManagerInterface.php
core/lib/Drupal/Core/Session/SessionManagerInterface.php
+0
-16
core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
+32
-32
core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
...odules/entity_crud_hook_test/entity_crud_hook_test.module
+56
-56
core/modules/system/tests/modules/service_provider_test/src/TestClass.php
...tem/tests/modules/service_provider_test/src/TestClass.php
+1
-1
core/modules/system/tests/modules/session_test/session_test.services.yml
...stem/tests/modules/session_test/session_test.services.yml
+1
-0
core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php
...ession_test/src/EventSubscriber/SessionTestSubscriber.php
+19
-7
No files found.
core/authorize.php
View file @
195503e2
...
...
@@ -49,7 +49,7 @@
* TRUE if the current user can run authorize.php, and FALSE if not.
*/
function
authorize_access_allowed
()
{
\
Drupal
::
service
(
'session_manager'
)
->
start
Lazy
();
\
Drupal
::
service
(
'session_manager'
)
->
start
();
return
Settings
::
get
(
'allow_authorize_operations'
,
TRUE
)
&&
\
Drupal
::
currentUser
()
->
hasPermission
(
'administer software updates'
);
}
...
...
core/includes/install.core.inc
View file @
195503e2
...
...
@@ -1453,7 +1453,7 @@ function install_load_profile(&$install_state) {
* An array of information about the current installation state.
*/
function
install_bootstrap_full
()
{
\
Drupal
::
service
(
'session_manager'
)
->
start
Lazy
();
\
Drupal
::
service
(
'session_manager'
)
->
start
();
}
/**
...
...
core/lib/Drupal/Core/Authentication/Provider/Cookie.php
View file @
195503e2
...
...
@@ -47,7 +47,7 @@ public function applies(Request $request) {
public
function
authenticate
(
Request
$request
)
{
// Global $user is deprecated, but the session system is still based on it.
global
$user
;
$this
->
sessionManager
->
start
Lazy
();
$this
->
sessionManager
->
start
();
if
(
$this
->
sessionManager
->
isStarted
())
{
return
$user
;
}
...
...
core/lib/Drupal/Core/DrupalKernel.php
View file @
195503e2
...
...
@@ -672,16 +672,13 @@ protected function getKernelParameters() {
*/
protected
function
initializeContainer
(
$rebuild
=
FALSE
)
{
$this
->
containerNeedsDumping
=
FALSE
;
$session_manager_state
=
0
;
$session_manager_sta
r
te
d
=
FALSE
;
if
(
isset
(
$this
->
container
))
{
// If there is a session manager, close and save the session.
if
(
$this
->
container
->
initialized
(
'session_manager'
))
{
$session_manager
=
$this
->
container
->
get
(
'session_manager'
);
if
(
$session_manager
->
isStartedLazy
())
{
$session_manager_state
|=
0x1
;
}
if
(
$session_manager
->
isStarted
())
{
$session_manager_state
|=
0x2
;
$session_manager_sta
r
te
d
=
TRUE
;
$session_manager
->
save
();
}
unset
(
$session_manager
);
...
...
@@ -712,10 +709,7 @@ protected function initializeContainer($rebuild = FALSE) {
$this
->
attachSynthetic
(
$container
);
$this
->
container
=
$container
;
if
(
$session_manager_state
&
0x1
)
{
$this
->
container
->
get
(
'session_manager'
)
->
startLazy
();
}
if
(
$session_manager_state
&
0x2
)
{
if
(
$session_manager_started
)
{
$this
->
container
->
get
(
'session_manager'
)
->
start
();
}
\
Drupal
::
setContainer
(
$this
->
container
);
...
...
core/lib/Drupal/Core/Session/SessionManager.php
View file @
195503e2
...
...
@@ -114,7 +114,7 @@ public function __construct(RequestStack $request_stack, Connection $connection,
/**
* {@inheritdoc}
*/
public
function
start
Lazy
()
{
public
function
start
()
{
global
$user
;
if
((
$this
->
started
||
$this
->
startedLazy
)
&&
!
$this
->
closed
)
{
...
...
@@ -129,53 +129,66 @@ public function startLazy() {
// session is only started on demand in save(), making
// anonymous users not use a session cookie unless something is stored in
// $_SESSION. This allows HTTP proxies to cache anonymous pageviews.
$result
=
$this
->
start
();
$result
=
$this
->
start
Now
();
if
(
$user
->
isAuthenticated
()
||
!
$this
->
isSessionObsolete
())
{
drupal_page_is_cacheable
(
FALSE
);
}
}
else
{
// Set a session identifier for this request. This is necessary because
// we lazily start sessions at the end of this request, and some
// processes (like \Drupal::csrfToken()) needs to know the future
// session ID in advance.
if
(
empty
(
$result
))
{
$user
=
new
AnonymousUserSession
();
// Randomly generate a session identifier for this request. This is
// necessary because \Drupal\user\TempStoreFactory::get() wants to know
// the future session ID of a lazily started session in advance.
//
// @todo: With current versions of PHP there is little reason to generate
// the session id from within application code. Consider using the
// default php session id instead of generating a custom one:
// https://www.drupal.org/node/2238561
$this
->
setId
(
Crypt
::
randomBytesBase64
());
if
(
$is_https
&&
$this
->
isMixedMode
())
{
$session_id
=
Crypt
::
randomBytesBase64
();
$cookies
->
set
(
$insecure_session_name
,
$session_id
);
}
// Initialize the session global and attach the Symfony session bags.
$_SESSION
=
array
();
$this
->
loadSession
();
// NativeSessionStorage::loadSession() sets started to TRUE, reset it to
// FALSE here.
$this
->
started
=
FALSE
;
$this
->
startedLazy
=
TRUE
;
$result
=
FALSE
;
}
date_default_timezone_set
(
drupal_get_user_timezone
());
$this
->
startedLazy
=
TRUE
;
return
$result
;
}
/**
* {@inheritdoc}
*/
public
function
isStartedLazy
()
{
return
$this
->
startedLazy
;
}
/**
* {@inheritdoc}
* Forcibly start a PHP session.
*
* @return boolean
* TRUE if the session is started.
*/
p
ublic
function
start
()
{
p
rotected
function
start
Now
()
{
if
(
!
$this
->
isEnabled
()
||
$this
->
isCli
())
{
return
;
return
FALSE
;
}
if
(
$this
->
startedLazy
)
{
// Save current session data before starting it, as PHP will destroy it.
$session_data
=
$_SESSION
;
}
// Save current session data before starting it, as PHP will destroy it.
$session_data
=
isset
(
$_SESSION
)
?
$_SESSION
:
NULL
;
$result
=
parent
::
start
();
// Restore session data.
if
(
!
empty
(
$session_data
)
)
{
$_SESSION
+
=
$session_data
;
if
(
$this
->
startedLazy
)
{
$_SESSION
=
$session_data
;
}
return
$result
;
...
...
@@ -203,7 +216,7 @@ public function save() {
// There is session data to store. Start the session if it is not already
// started.
if
(
!
$this
->
getSaveHandler
()
->
isActive
())
{
$this
->
start
();
$this
->
start
Now
();
if
(
$this
->
requestStack
->
getCurrentRequest
()
->
isSecure
()
&&
$this
->
isMixedMode
())
{
$insecure_session_name
=
$this
->
getInsecureName
();
$params
=
session_get_cookie_params
();
...
...
@@ -282,7 +295,7 @@ public function regenerate($destroy = FALSE, $lifetime = NULL) {
// Preserve the logged in user, as it will be reset to anonymous
// by \Drupal\Core\Session\SessionHandler::read().
$account
=
$user
;
$this
->
start
();
$this
->
start
Now
();
$user
=
$account
;
}
date_default_timezone_set
(
drupal_get_user_timezone
());
...
...
core/lib/Drupal/Core/Session/SessionManagerInterface.php
View file @
195503e2
...
...
@@ -14,22 +14,6 @@
*/
interface
SessionManagerInterface
extends
SessionStorageInterface
{
/**
* Starts a session if appropriate cookies are on the request.
*
* @return bool
* TRUE if the session was started.
*/
public
function
startLazy
();
/**
* Determines whether the session was started lazily.
*
* @return bool
* TRUE if the session was started lazily.
*/
public
function
isStartedLazy
();
/**
* Ends a specific user's session(s).
*
...
...
core/modules/system/src/Tests/Entity/EntityCrudHookTest.php
View file @
195503e2
...
...
@@ -55,7 +55,7 @@ protected function setUp() {
* Checks the order of CRUD hook execution messages.
*
* entity_crud_hook_test.module implements all core entity CRUD hooks and
* stores a message for each in $
_SESSION
['entity_crud_hook_test'].
* stores a message for each in $
GLOBALS
['entity_crud_hook_test'].
*
* @param $messages
* An array of plain-text messages in the order they should appear.
...
...
@@ -64,7 +64,7 @@ protected function assertHookMessageOrder($messages) {
$positions
=
array
();
foreach
(
$messages
as
$message
)
{
// Verify that each message is found and record its position.
$position
=
array_search
(
$message
,
$
_SESSION
[
'entity_crud_hook_test'
]);
$position
=
array_search
(
$message
,
$
GLOBALS
[
'entity_crud_hook_test'
]);
if
(
$this
->
assertTrue
(
$position
!==
FALSE
,
$message
))
{
$positions
[]
=
$position
;
}
...
...
@@ -91,7 +91,7 @@ public function testBlockHooks() {
'entity_crud_hook_test_entity_create called for type block'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$entity
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -101,7 +101,7 @@ public function testBlockHooks() {
'entity_crud_hook_test_entity_insert called for type block'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$entity
=
Block
::
load
(
$entity
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -109,7 +109,7 @@ public function testBlockHooks() {
'entity_crud_hook_test_block_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$entity
->
label
=
'New label'
;
$entity
->
save
();
...
...
@@ -120,7 +120,7 @@ public function testBlockHooks() {
'entity_crud_hook_test_entity_update called for type block'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$entity
->
delete
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -155,7 +155,7 @@ public function testCommentHooks() {
));
$node
->
save
();
$nid
=
$node
->
id
();
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$comment
=
entity_create
(
'comment'
,
array
(
'cid'
=>
NULL
,
...
...
@@ -176,7 +176,7 @@ public function testCommentHooks() {
'entity_crud_hook_test_entity_create called for type comment'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$comment
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -186,7 +186,7 @@ public function testCommentHooks() {
'entity_crud_hook_test_entity_insert called for type comment'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$comment
=
Comment
::
load
(
$comment
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -194,7 +194,7 @@ public function testCommentHooks() {
'entity_crud_hook_test_comment_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$comment
->
setSubject
(
'New subject'
);
$comment
->
save
();
...
...
@@ -205,7 +205,7 @@ public function testCommentHooks() {
'entity_crud_hook_test_entity_update called for type comment'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$comment
->
delete
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -241,7 +241,7 @@ public function testFileHooks() {
'entity_crud_hook_test_entity_create called for type file'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$file
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -251,7 +251,7 @@ public function testFileHooks() {
'entity_crud_hook_test_entity_insert called for type file'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$file
=
file_load
(
$file
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -259,7 +259,7 @@ public function testFileHooks() {
'entity_crud_hook_test_file_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$file
->
setFilename
(
'new.entity_crud_hook_test.file'
);
$file
->
save
();
...
...
@@ -270,7 +270,7 @@ public function testFileHooks() {
'entity_crud_hook_test_entity_update called for type file'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$file
->
delete
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -304,7 +304,7 @@ public function testNodeHooks() {
'entity_crud_hook_test_entity_create called for type node'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$node
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -314,7 +314,7 @@ public function testNodeHooks() {
'entity_crud_hook_test_entity_insert called for type node'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$node
=
node_load
(
$node
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -322,7 +322,7 @@ public function testNodeHooks() {
'entity_crud_hook_test_node_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$node
->
title
=
'New title'
;
$node
->
save
();
...
...
@@ -333,7 +333,7 @@ public function testNodeHooks() {
'entity_crud_hook_test_entity_update called for type node'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$node
->
delete
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -358,7 +358,7 @@ public function testTaxonomyTermHooks() {
'module'
=>
'entity_crud_hook_test'
,
));
$vocabulary
->
save
();
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$term
=
entity_create
(
'taxonomy_term'
,
array
(
'vid'
=>
$vocabulary
->
id
(),
...
...
@@ -373,7 +373,7 @@ public function testTaxonomyTermHooks() {
'entity_crud_hook_test_entity_create called for type taxonomy_term'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$term
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -383,7 +383,7 @@ public function testTaxonomyTermHooks() {
'entity_crud_hook_test_entity_insert called for type taxonomy_term'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$term
=
entity_load
(
'taxonomy_term'
,
$term
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -391,7 +391,7 @@ public function testTaxonomyTermHooks() {
'entity_crud_hook_test_taxonomy_term_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$term
->
setName
(
'New name'
);
$term
->
save
();
...
...
@@ -402,7 +402,7 @@ public function testTaxonomyTermHooks() {
'entity_crud_hook_test_entity_update called for type taxonomy_term'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$term
->
delete
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -432,7 +432,7 @@ public function testTaxonomyVocabularyHooks() {
'entity_crud_hook_test_entity_create called for type taxonomy_vocabulary'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$vocabulary
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -442,7 +442,7 @@ public function testTaxonomyVocabularyHooks() {
'entity_crud_hook_test_entity_insert called for type taxonomy_vocabulary'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$vocabulary
=
entity_load
(
'taxonomy_vocabulary'
,
$vocabulary
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -450,7 +450,7 @@ public function testTaxonomyVocabularyHooks() {
'entity_crud_hook_test_taxonomy_vocabulary_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$vocabulary
->
name
=
'New name'
;
$vocabulary
->
save
();
...
...
@@ -461,7 +461,7 @@ public function testTaxonomyVocabularyHooks() {
'entity_crud_hook_test_entity_update called for type taxonomy_vocabulary'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$vocabulary
->
delete
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -489,7 +489,7 @@ public function testUserHooks() {
'entity_crud_hook_test_entity_create called for type user'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$account
->
save
();
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -499,7 +499,7 @@ public function testUserHooks() {
'entity_crud_hook_test_entity_insert called for type user'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
user_load
(
$account
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
@@ -507,7 +507,7 @@ public function testUserHooks() {
'entity_crud_hook_test_user_load called'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
$account
->
name
=
'New name'
;
$account
->
save
();
...
...
@@ -518,7 +518,7 @@ public function testUserHooks() {
'entity_crud_hook_test_entity_update called for type user'
,
));
$
_SESSION
[
'entity_crud_hook_test'
]
=
array
();
$
GLOBALS
[
'entity_crud_hook_test'
]
=
array
();
user_delete
(
$account
->
id
());
$this
->
assertHookMessageOrder
(
array
(
...
...
core/modules/system/tests/modules/entity_crud_hook_test/entity_crud_hook_test.module
View file @
195503e2
...
...
@@ -11,390 +11,390 @@
* Implements hook_entity_create().
*/
function
entity_crud_hook_test_entity_create
(
EntityInterface
$entity
)
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called for type '
.
$entity
->
getEntityTypeId
());
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called for type '
.
$entity
->
getEntityTypeId
());
}
/**
* Implements hook_ENTITY_TYPE_create() for block entities.
*/
function
entity_crud_hook_test_block_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_create() for comment entities.
*/
function
entity_crud_hook_test_comment_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_create() for file entities.
*/
function
entity_crud_hook_test_file_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_create() for node entities.
*/
function
entity_crud_hook_test_node_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_create() for taxonomy_term entities.
*/
function
entity_crud_hook_test_taxonomy_term_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_create() for taxonomy_vocabulary entities.
*/
function
entity_crud_hook_test_taxonomy_vocabulary_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_create() for user entities.
*/
function
entity_crud_hook_test_user_create
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_entity_presave().
*/
function
entity_crud_hook_test_entity_presave
(
EntityInterface
$entity
)
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called for type '
.
$entity
->
getEntityTypeId
());
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called for type '
.
$entity
->
getEntityTypeId
());
}
/**
* Implements hook_ENTITY_TYPE_presave() for block entities.
*/
function
entity_crud_hook_test_block_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_presave() for comment entities.
*/
function
entity_crud_hook_test_comment_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_presave() for file entities.
*/
function
entity_crud_hook_test_file_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_presave() for node entities.
*/
function
entity_crud_hook_test_node_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_presave() for taxonomy_term entities.
*/
function
entity_crud_hook_test_taxonomy_term_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_presave() for taxonomy_vocabulary entities.
*/
function
entity_crud_hook_test_taxonomy_vocabulary_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_ENTITY_TYPE_presave() for user entities.
*/
function
entity_crud_hook_test_user_presave
()
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called'
);
}
/**
* Implements hook_entity_insert().
*/
function
entity_crud_hook_test_entity_insert
(
EntityInterface
$entity
)
{
$
_SESSION
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called for type '
.
$entity
->
getEntityTypeId
());
$
GLOBALS
[
'entity_crud_hook_test'
][]
=
(
__FUNCTION__
.
' called for type '
.
$entity
->
getEntityTypeId
());
}