diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 508e4a76173fd44cd6b5d4165f64ea2a97f5c6cc..ed5e881e760e14df1e9b86898c213ba0e88dbe9f 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -337,62 +337,6 @@ function node_entity_extra_field_info() { return $extra; } -/** - * Updates all nodes of one type to be of another type. - * - * @param string $old_id - * The current node type of the nodes. - * @param string $new_id - * The new node type of the nodes. - * - * @return int - * The number of nodes whose node type field was modified. - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * \Drupal\Core\Entity\EntityStorageInterface::updateType instead. - * - * @see https://www.drupal.org/node/3323340 - */ -function node_type_update_nodes($old_id, $new_id) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Entity\EntityStorageInterface::updateType instead. See https://www.drupal.org/node/3294237', E_USER_DEPRECATED); - return \Drupal::entityTypeManager()->getStorage('node')->updateType($old_id, $new_id); -} - -/** - * Loads a node revision from the database. - * - * @param int $vid - * The node revision id. - * - * @return \Drupal\node\NodeInterface|null - * A fully-populated node entity, or NULL if the node is not found. - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * \Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead. - * - * @see https://www.drupal.org/node/3323340 - */ -function node_revision_load($vid = NULL) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead. See https://www.drupal.org/node/3294237', E_USER_DEPRECATED); - return \Drupal::entityTypeManager()->getStorage('node')->loadRevision($vid); -} - -/** - * Deletes a node revision. - * - * @param int $revision_id - * The revision ID to delete. - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * \Drupal\Core\Entity\RevisionableStorageInterface::deleteRevision instead. - * - * @see https://www.drupal.org/node/3323340 - */ -function node_revision_delete($revision_id) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Entity\RevisionableStorageInterface::deleteRevision instead. See https://www.drupal.org/node/3294237', E_USER_DEPRECATED); - \Drupal::entityTypeManager()->getStorage('node')->deleteRevision($revision_id); -} - /** * Checks whether the current page is the full page view of the passed-in node. * @@ -708,56 +652,6 @@ function node_user_predelete($account) { } } -/** - * Finds the most recently changed nodes that are available to the current user. - * - * @param $number - * (optional) The maximum number of nodes to find. Defaults to 10. - * - * @return \Drupal\node\NodeInterface[] - * An array of node entities or an empty array if there are no recent nodes - * visible to the current user. - * - * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use - * \Drupal::entityQuery() instead. - * - * @see https://www.drupal.org/node/3356516 - */ -function node_get_recent($number = 10) { - @trigger_error(__METHOD__ . ' is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal::entityQuery() instead. See https://www.drupal.org/node/3356516', E_USER_DEPRECATED); - $account = \Drupal::currentUser(); - $query = \Drupal::entityQuery('node'); - - if (!$account->hasPermission('bypass node access')) { - // If the user is able to view their own unpublished nodes, allow them - // to see these in addition to published nodes. Check that they actually - // have some unpublished nodes to view before adding the condition. - $access_query = \Drupal::entityQuery('node') - ->accessCheck(TRUE) - ->condition('uid', $account->id()) - ->condition('status', NodeInterface::NOT_PUBLISHED); - if ($account->hasPermission('view own unpublished content') && ($own_unpublished = $access_query->execute())) { - $query->orConditionGroup() - ->condition('status', NodeInterface::PUBLISHED) - ->condition('nid', $own_unpublished, 'IN'); - } - else { - // If not, restrict the query to published nodes. - $query->condition('status', NodeInterface::PUBLISHED); - } - } - $nids = $query - ->accessCheck(TRUE) - ->sort('changed', 'DESC') - ->range(0, $number) - ->addTag('node_access') - ->execute(); - - $nodes = Node::loadMultiple($nids); - - return $nodes ? $nodes : []; -} - /** * Implements hook_page_top(). */ diff --git a/core/modules/node/src/Form/NodeRevisionDeleteForm.php b/core/modules/node/src/Form/NodeRevisionDeleteForm.php index 1d6af272b731b97fe29f5cb7b05fd60da856c47f..e9ff3f86b7801fb97049b260e926e7e1ad1baa9b 100644 --- a/core/modules/node/src/Form/NodeRevisionDeleteForm.php +++ b/core/modules/node/src/Form/NodeRevisionDeleteForm.php @@ -2,7 +2,6 @@ namespace Drupal\node\Form; -use Drupal\Core\Database\Connection; use Drupal\Core\Access\AccessManagerInterface; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Entity\EntityStorageInterface; @@ -68,21 +67,16 @@ class NodeRevisionDeleteForm extends ConfirmFormBase { * The node storage. * @param \Drupal\Core\Entity\EntityStorageInterface $node_type_storage * The node type storage. - * @param \Drupal\Core\Access\AccessManagerInterface|\Drupal\Core\Database\Connection $access_manager + * @param \Drupal\Core\Access\AccessManagerInterface $access_manager * The access manager. * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter * The date formatter service. */ - public function __construct(EntityStorageInterface $node_storage, EntityStorageInterface $node_type_storage, AccessManagerInterface|Connection $access_manager, DateFormatterInterface $date_formatter) { + public function __construct(EntityStorageInterface $node_storage, EntityStorageInterface $node_type_storage, AccessManagerInterface $access_manager, DateFormatterInterface $date_formatter) { $this->nodeStorage = $node_storage; $this->nodeTypeStorage = $node_type_storage; $this->accessManager = $access_manager; $this->dateFormatter = $date_formatter; - if ($access_manager instanceof Connection) { - $this->connection = $access_manager; - $this->accessManager = func_get_arg(3); - @trigger_error('Calling ' . __CLASS__ . '::_construct() with the $connection argument is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3343754', E_USER_DEPRECATED); - } } /** diff --git a/core/modules/node/tests/src/Kernel/NodeDeprecationTest.php b/core/modules/node/tests/src/Kernel/NodeDeprecationTest.php deleted file mode 100644 index 4157f1ea1a40aeed544361cd0a8222871ab8e90f..0000000000000000000000000000000000000000 --- a/core/modules/node/tests/src/Kernel/NodeDeprecationTest.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -namespace Drupal\Tests\node\Kernel; - -use Drupal\KernelTests\KernelTestBase; -use Drupal\Core\Database\Connection; -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\node\Form\NodeRevisionDeleteForm; - -/** - * Tests the deprecations in the node.module file. - * - * @group node - * @group legacy - */ -class NodeDeprecationTest extends KernelTestBase { - - /** - * {@inheritdoc} - */ - protected static $modules = ['user', 'node']; - - /** - * Tests the deprecation of node_revision_load. - * - * @see node_revision_load() - */ - public function testNodeRevisionLoadDeprecation(): void { - $this->installEntitySchema('node'); - $this->expectDeprecation('node_revision_load is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Entity\RevisionableStorageInterface::loadRevision instead. See https://www.drupal.org/node/3294237'); - node_revision_load(1); - } - - /** - * Tests the deprecation of node_revision_delete. - * - * @see node_revision_delete() - */ - public function testNodeRevisionDeleteDeprecation(): void { - $this->installEntitySchema('node'); - $this->expectDeprecation('node_revision_delete is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Entity\RevisionableStorageInterface::deleteRevision instead. See https://www.drupal.org/node/3294237'); - node_revision_delete(1); - } - - /** - * Tests the deprecation of node_type_update_nodes. - * - * @see node_type_update_nodes() - */ - public function testNodeTypeUpdateNodesDeprecation(): void { - $this->installEntitySchema('node'); - $this->expectDeprecation('node_type_update_nodes is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Entity\EntityStorageInterface::updateType instead. See https://www.drupal.org/node/3294237'); - node_type_update_nodes(1, 2); - } - - /** - * Tests the deprecation of NodeRevisionDeleteForm constructor. - */ - public function testNodeRevisionDeleteFormConstructorDeprecation(): void { - $this->expectDeprecation('Calling Drupal\node\Form\NodeRevisionDeleteForm::_construct() with the $connection argument is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3343754'); - new NodeRevisionDeleteForm( - $this->createMock(EntityStorageInterface::class), - $this->createMock(EntityStorageInterface::class), - $this->createMock(Connection::class), - $this->createMock(DateFormatterInterface::class), - ); - } - -}