diff --git a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-06-29.sql b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-06-29.sql index 36a43fcb382c1..d7c5e1e0d9e9d 100644 --- a/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-06-29.sql +++ b/administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-06-29.sql @@ -1,7 +1,26 @@ +ALTER TABLE `#__newsfeeds` MODIFY `created` datetime NOT NULL; +ALTER TABLE `#__newsfeeds` MODIFY `modified` datetime NOT NULL; + ALTER TABLE `#__newsfeeds` MODIFY `publish_up` datetime NULL DEFAULT NULL; ALTER TABLE `#__newsfeeds` MODIFY `publish_down` datetime NULL DEFAULT NULL; ALTER TABLE `#__newsfeeds` MODIFY `checked_out_time` datetime NULL DEFAULT NULL; +UPDATE `#__newsfeeds` SET `modified` = `created` WHERE `modified` = '0000-00-00 00:00:00'; + UPDATE `#__newsfeeds` SET `publish_up` = NULL WHERE `publish_up` = '0000-00-00 00:00:00'; UPDATE `#__newsfeeds` SET `publish_down` = NULL WHERE `publish_down` = '0000-00-00 00:00:00'; UPDATE `#__newsfeeds` SET `checked_out_time` = NULL WHERE `checked_out_time` = '0000-00-00 00:00:00'; + +UPDATE `#__ucm_content` SET `core_modified_time` = `core_created_time` + WHERE `core_type_alias` = 'com_newsfeeds.newsfeed' + AND `core_modified_time` = '0000-00-00 00:00:00'; + +UPDATE `#__ucm_content` SET `core_publish_up` = NULL + WHERE `core_type_alias` = 'com_newsfeeds.newsfeed' + AND `core_publish_up` = '0000-00-00 00:00:00'; +UPDATE `#__ucm_content` SET `core_publish_down` = NULL + WHERE `core_type_alias` = 'com_newsfeeds.newsfeed' + AND `core_publish_down` = '0000-00-00 00:00:00'; +UPDATE `#__ucm_content` SET `core_checked_out_time` = NULL + WHERE `core_type_alias` = 'com_newsfeeds.newsfeed' + AND `core_checked_out_time` = '0000-00-00 00:00:00'; diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-06-29.sql b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-06-29.sql index bf1f50f89fa6c..df9bb2c27d00c 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-06-29.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-06-29.sql @@ -1,3 +1,7 @@ +ALTER TABLE "#__newsfeeds" ALTER COLUMN "created" DROP DEFAULT; + +ALTER TABLE "#__newsfeeds" ALTER COLUMN "modified" DROP DEFAULT; + ALTER TABLE "#__newsfeeds" ALTER COLUMN "publish_up" DROP NOT NULL; ALTER TABLE "#__newsfeeds" ALTER COLUMN "publish_up" DROP DEFAULT; @@ -7,6 +11,22 @@ ALTER TABLE "#__newsfeeds" ALTER COLUMN "publish_down" DROP DEFAULT; ALTER TABLE "#__newsfeeds" ALTER COLUMN "checked_out_time" DROP NOT NULL; ALTER TABLE "#__newsfeeds" ALTER COLUMN "checked_out_time" DROP DEFAULT; +UPDATE "#__newsfeeds" SET "modified" = "created" WHERE "modified" = '1970-01-01 00:00:00'; + UPDATE "#__newsfeeds" SET "publish_up" = NULL WHERE "publish_up" = '1970-01-01 00:00:00'; UPDATE "#__newsfeeds" SET "publish_down" = NULL WHERE "publish_down" = '1970-01-01 00:00:00'; UPDATE "#__newsfeeds" SET "checked_out_time" = NULL WHERE "checked_out_time" = '1970-01-01 00:00:00'; + +UPDATE "#__ucm_content" SET "core_modified_time" = "core_created_time" + WHERE "core_type_alias" = 'com_newsfeeds.newsfeed' + AND "core_modified_time" = '1970-01-01 00:00:00'; + +UPDATE "#__ucm_content" SET "core_publish_up" = NULL + WHERE "core_type_alias" = 'com_newsfeeds.newsfeed' + AND "core_publish_up" = '1970-01-01 00:00:00'; +UPDATE "#__ucm_content" SET "core_publish_down" = NULL + WHERE "core_type_alias" = 'com_newsfeeds.newsfeed' + AND "core_publish_down" = '1970-01-01 00:00:00'; +UPDATE "#__ucm_content" SET "core_checked_out_time" = NULL + WHERE "core_type_alias" = 'com_newsfeeds.newsfeed' + AND "core_checked_out_time" = '1970-01-01 00:00:00'; diff --git a/administrator/components/com_newsfeeds/sql/install.mysql.utf8.sql b/administrator/components/com_newsfeeds/sql/install.mysql.utf8.sql index 11df5f72df791..efa5072feb61e 100644 --- a/administrator/components/com_newsfeeds/sql/install.mysql.utf8.sql +++ b/administrator/components/com_newsfeeds/sql/install.mysql.utf8.sql @@ -12,22 +12,22 @@ CREATE TABLE IF NOT EXISTS `#__newsfeeds` ( `numarticles` int(10) unsigned NOT NULL DEFAULT 1, `cache_time` int(10) unsigned NOT NULL DEFAULT 3600, `checked_out` int(10) unsigned NOT NULL DEFAULT 0, - `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out_time` datetime, `ordering` int(11) NOT NULL DEFAULT 0, `rtl` tinyint(4) NOT NULL DEFAULT 0, `access` int(10) unsigned NOT NULL DEFAULT 0, `language` char(7) NOT NULL DEFAULT '', `params` text NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL, `created_by` int(10) unsigned NOT NULL DEFAULT 0, `created_by_alias` varchar(255) NOT NULL DEFAULT '', - `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` datetime NOT NULL, `modified_by` int(10) unsigned NOT NULL DEFAULT 0, `metakey` text NOT NULL, `metadesc` text NOT NULL, `metadata` text NOT NULL, - `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', - `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_up` datetime, + `publish_down` datetime, `description` text NOT NULL, `version` int(10) unsigned NOT NULL DEFAULT 1, `hits` int(10) unsigned NOT NULL DEFAULT 0, diff --git a/components/com_newsfeeds/Model/CategoryModel.php b/components/com_newsfeeds/Model/CategoryModel.php index a0be4b3b44c05..e45e26bc4a099 100644 --- a/components/com_newsfeeds/Model/CategoryModel.php +++ b/components/com_newsfeeds/Model/CategoryModel.php @@ -181,8 +181,8 @@ protected function getListQuery() if ($this->getState('filter.publish_date')) { - $query->where('(' . $query->isNullDatetime('a.publish_up') . ' OR a.publish_up <= ' . $db->quote($nowDate) . ')') - ->where('(' . $query->isNullDatetime('a.publish_down') . ' OR a.publish_down >= ' . $db->quote($nowDate) . ')'); + $query->where('(a.publish_up IS NULL OR a.publish_up <= ' . $db->quote($nowDate) . ')') + ->where('(a.publish_down IS NULL OR a.publish_down >= ' . $db->quote($nowDate) . ')'); } // Filter by search in title diff --git a/components/com_newsfeeds/Model/NewsfeedModel.php b/components/com_newsfeeds/Model/NewsfeedModel.php index 9b0ca782731c9..eac112b932cf7 100644 --- a/components/com_newsfeeds/Model/NewsfeedModel.php +++ b/components/com_newsfeeds/Model/NewsfeedModel.php @@ -115,8 +115,8 @@ public function &getItem($pk = null) if (is_numeric($published)) { $query->where('(a.published = ' . (int) $published . ' OR a.published =' . (int) $archived . ')') - ->where('(' . $query->isNullDatetime('a.publish_up') . ' OR a.publish_up <= ' . $db->quote($nowDate) . ')') - ->where('(' . $query->isNullDatetime('a.publish_down') . ' OR a.publish_down >= ' . $db->quote($nowDate) . ')') + ->where('(a.publish_up IS NULL OR a.publish_up <= ' . $db->quote($nowDate) . ')') + ->where('(a.publish_down IS NULL OR a.publish_down >= ' . $db->quote($nowDate) . ')') ->where('(c.published = ' . (int) $published . ' OR c.published =' . (int) $archived . ')'); } diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index e578254b42070..3afe20052d82e 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -1567,10 +1567,10 @@ CREATE TABLE IF NOT EXISTS `#__newsfeeds` ( `access` int(10) unsigned NOT NULL DEFAULT 0, `language` char(7) NOT NULL DEFAULT '', `params` text NOT NULL, - `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created` datetime NOT NULL, `created_by` int(10) unsigned NOT NULL DEFAULT 0, `created_by_alias` varchar(255) NOT NULL DEFAULT '', - `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` datetime NOT NULL, `modified_by` int(10) unsigned NOT NULL DEFAULT 0, `metakey` text NOT NULL, `metadesc` text NOT NULL, diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index 1653726dd3678..a5d32908ba5e6 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -1564,10 +1564,10 @@ CREATE TABLE IF NOT EXISTS "#__newsfeeds" ( "access" bigint DEFAULT 0 NOT NULL, "language" varchar(7) DEFAULT '' NOT NULL, "params" text NOT NULL, - "created" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "created" timestamp without time zone NOT NULL, "created_by" integer DEFAULT 0 NOT NULL, "created_by_alias" varchar(255) DEFAULT '' NOT NULL, - "modified" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "modified" timestamp without time zone NOT NULL, "modified_by" integer DEFAULT 0 NOT NULL, "metakey" text NOT NULL, "metadesc" text NOT NULL,