From 47894da32aad7bf1965167fd67961f37aa97e4f6 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 21 Sep 2019 14:49:06 +0200 Subject: [PATCH 1/3] Create new content records with null value for published up and down --- libraries/src/Table/Content.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index b3345499bf960..70db7bd520502 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -252,20 +252,20 @@ public function check() $this->hits = 0; } - // Set publish_up to null date if not set + // Set publish_up to null if not set if (!$this->publish_up) { - $this->publish_up = $this->_db->getNullDate(); + $this->publish_up = null; } - // Set publish_down to null date if not set + // Set publish_down to null if not set if (!$this->publish_down) { - $this->publish_down = $this->_db->getNullDate(); + $this->publish_down = null; } // Check the publish down date is not earlier than publish up. - if ($this->publish_down < $this->publish_up && $this->publish_down > $this->_db->getNullDate()) + if (!is_null($this->publish_up) && !is_null($this->publish_down) && $this->publish_down < $this->publish_up) { // Swap the dates. $temp = $this->publish_up; @@ -273,10 +273,10 @@ public function check() $this->publish_down = $temp; } - // Set modified to null date if not set + // Set modified to created date if not set if (!$this->modified) { - $this->modified = $this->_db->getNullDate(); + $this->modified = $this->created; } // Clean up keywords -- eliminate extra spaces between phrases @@ -321,7 +321,7 @@ public function check() * * @since 1.6 */ - public function store($updateNulls = false) + public function store($updateNulls = true) { $date = Factory::getDate(); $user = Factory::getUser(); From 27db4329ef872ee3138f129bcc61384d4ca531f5 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 21 Sep 2019 15:15:07 +0200 Subject: [PATCH 2/3] Set publish down to null when sanitizing table in articles model --- administrator/components/com_content/Model/ArticleModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_content/Model/ArticleModel.php b/administrator/components/com_content/Model/ArticleModel.php index 43c4b8d65d57f..5ebbd65897a96 100644 --- a/administrator/components/com_content/Model/ArticleModel.php +++ b/administrator/components/com_content/Model/ArticleModel.php @@ -337,7 +337,7 @@ protected function prepareTable($table) if ($table->state == Workflow::CONDITION_PUBLISHED && intval($table->publish_down) == 0) { - $table->publish_down = $this->getDbo()->getNullDate(); + $table->publish_down = null; } // Increment the content version number. From b6cb7656660cc3d25bba13a0d26a0fdd119c031a Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Thu, 26 Sep 2019 00:03:00 +0200 Subject: [PATCH 3/3] Move modified check down to store routine --- libraries/src/Table/Content.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/src/Table/Content.php b/libraries/src/Table/Content.php index 70db7bd520502..da2f1acf7a592 100644 --- a/libraries/src/Table/Content.php +++ b/libraries/src/Table/Content.php @@ -273,12 +273,6 @@ public function check() $this->publish_down = $temp; } - // Set modified to created date if not set - if (!$this->modified) - { - $this->modified = $this->created; - } - // Clean up keywords -- eliminate extra spaces between phrases // and cr (\r) and lf (\n) characters from string if (!empty($this->metakey)) @@ -345,6 +339,12 @@ public function store($updateNulls = true) { $this->created_by = $user->get('id'); } + + // Set modified to created date if not set + if (!$this->modified) + { + $this->modified = $this->created; + } } // Verify that the alias is unique