Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
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` = CASE WHEN `publish_up` IN ('0000-00-00 00:00:00', '1000-01-01 00:00:00') THEN NULL ELSE `publish_up` END,
`publish_down` = CASE WHEN `publish_down` IN ('0000-00-00 00:00:00', '1000-01-01 00:00:00') THEN NULL ELSE `publish_down` END,
`checked_out_time` = CASE WHEN `checked_out_time` IN ('0000-00-00 00:00:00', '1000-01-01 00:00:00') THEN NULL ELSE `checked_out_time` END;
`checked_out_time` = CASE WHEN `checked_out_time` IN ('0000-00-00 00:00:00', '1000-01-01 00:00:00') THEN NULL ELSE `checked_out_time` END;

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';
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -10,4 +14,14 @@ ALTER TABLE "#__newsfeeds" ALTER COLUMN "checked_out_time" DROP DEFAULT;
UPDATE "#__newsfeeds" SET
"publish_up" = CASE WHEN "publish_up" = '1970-01-01 00:00:00' THEN NULL ELSE "publish_up" END,
"publish_down" = CASE WHEN "publish_down" = '1970-01-01 00:00:00' THEN NULL ELSE "publish_down" END,
"checked_out_time" = CASE WHEN "checked_out_time" = '1970-01-01 00:00:00' THEN NULL ELSE "checked_out_time" END;
"checked_out_time" = CASE WHEN "checked_out_time" = '1970-01-01 00:00:00' THEN NULL ELSE "checked_out_time" END;

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';
4 changes: 2 additions & 2 deletions components/com_newsfeeds/Model/CategoryModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions components/com_newsfeeds/Model/NewsfeedModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . ')');
}

Expand Down
4 changes: 2 additions & 2 deletions installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions installation/sql/postgresql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down