From debff0c1ec454ddbfe1e5e2ff29bac08fe75f59a Mon Sep 17 00:00:00 2001
From: Oleksii Melnichenko <oleksii.melnichenko@blinkreaction.com>
Date: Wed, 30 Mar 2016 13:13:20 +0300
Subject: [PATCH] Patch for the https://www.drupal.org/node/2355527

---
 core/modules/history/history.install                 |  9 +++++++++
 core/modules/history/history.module                  |  2 +-
 core/modules/system/src/Form/SiteInformationForm.php | 16 ++++++++++++++++
 core/profiles/standard/standard.install              |  3 +++
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/core/modules/history/history.install b/core/modules/history/history.install
index dcfd871..b155909 100644
--- a/core/modules/history/history.install
+++ b/core/modules/history/history.install
@@ -39,3 +39,12 @@ function history_schema() {
 
   return $schema;
 }
+
+/**
+ * Implements hook_update_N().
+ *
+ * Set node.new.limit variable default value.
+ */
+function history_update_8001() {
+  \Drupal::configFactory()->getEditable('system.site')->set('node.new.limit', 720)->save(TRUE);
+}
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index 79a28d6..4f27b0f 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -19,7 +19,7 @@
  * Entities changed within this time may be marked as new, updated, or read,
  * depending on their state for the current user. Defaults to 30 days ago.
  */
-define('HISTORY_READ_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
+define('HISTORY_READ_LIMIT', REQUEST_TIME - \Drupal::config('system.site')->get('node.new.limit') * 60 * 60);
 
 /**
  * Implements hook_help().
diff --git a/core/modules/system/src/Form/SiteInformationForm.php b/core/modules/system/src/Form/SiteInformationForm.php
index 1b1e3a6..6a2bc4b 100644
--- a/core/modules/system/src/Form/SiteInformationForm.php
+++ b/core/modules/system/src/Form/SiteInformationForm.php
@@ -155,6 +155,21 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.'),
     );
 
+    $form['new_limit'] = array(
+      '#type' => 'details',
+      '#title' => t('Node "new" limit settings'),
+      '#open' => TRUE,
+    );
+    $form['new_limit']['node_new_limit'] = array(
+      '#type' => 'number',
+      '#title' => t('Node "new" limit'),
+      '#default_value' => $site_config->get('node.new.limit'),
+      '#size' => 40,
+      '#min' => 1,
+      '#required' => TRUE,
+      '#description' => t('In <b>hours</b>. Defaults set to 30 days ago.'),
+    );
+
     return parent::buildForm($form, $form_state);
   }
 
@@ -215,6 +230,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
       ->set('page.front', $form_state->getValue('site_frontpage'))
       ->set('page.403', $form_state->getValue('site_403'))
       ->set('page.404', $form_state->getValue('site_404'))
+      ->set('node.new.limit', $form_state->getValue('node_new_limit'))
       ->save();
 
     parent::submitForm($form, $form_state);
diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install
index 744963a..8377fb2 100644
--- a/core/profiles/standard/standard.install
+++ b/core/profiles/standard/standard.install
@@ -17,6 +17,9 @@
 function standard_install() {
   // Set front page to "node".
   \Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save(TRUE);
+  
+  // Set default time before entities changed.
+  \Drupal::configFactory()->getEditable('system.site')->set('node.new.limit', 720)->save(TRUE);
 
   // Allow visitor account creation with administrative approval.
   $user_settings = \Drupal::configFactory()->getEditable('user.settings');
-- 
1.9.5.msysgit.0

