Skip to content
Snippets Groups Projects
Commit 850afe33 authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #3188647: Change the reset timestamp for all nodes provided by all...

Issue #3188647: Change the reset timestamp for all nodes provided by all custom default content modules
parent a3b07a9e
No related branches found
No related tags found
No related merge requests found
...@@ -237,7 +237,7 @@ function varbase_assemble_extra_components(array &$install_state) { ...@@ -237,7 +237,7 @@ function varbase_assemble_extra_components(array &$install_state) {
} }
// Reset timestamp for nodes. // Reset timestamp for nodes.
$node_ids = [1]; $node_ids = \Drupal::entityQuery('node')->execute();
$batch['operations'][] = ['varbase_reset_timestamp_for_nodes', (array) $node_ids]; $batch['operations'][] = ['varbase_reset_timestamp_for_nodes', (array) $node_ids];
if (count($uninstall_components) > 0) { if (count($uninstall_components) > 0) {
...@@ -460,14 +460,16 @@ function varbase_uninstall_component($uninstall_component) { ...@@ -460,14 +460,16 @@ function varbase_uninstall_component($uninstall_component) {
/** /**
* Batch to reset timestamp for selected nodes. * Batch to reset timestamp for selected nodes.
* *
* @param int|array $nid * @param int|array $node_ids
* The Node ID. * The Node IDs.
*/ */
function varbase_reset_timestamp_for_nodes($nid) { function varbase_reset_timestamp_for_nodes($node_ids) {
$node = Node::load($nid); foreach($node_ids as $nid) {
if (isset($node)) { $node = Node::load($nid);
$node->created = \Drupal::time()->getCurrentTime(); if (isset($node)) {
$node->save(); $node->created = \Drupal::time()->getCurrentTime();
$node->save();
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment