Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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,2 +1,6 @@
ALTER TABLE `#__menu` ADD COLUMN `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE `#__menu` ADD COLUMN `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE `#__menu` ADD COLUMN `publish_up` datetime;
ALTER TABLE `#__menu` ADD COLUMN `publish_down` datetime;

ALTER TABLE `#__menu` MODIFY `checked_out_time` datetime NULL DEFAULT NULL;

UPDATE `#__menu` SET `checked_out_time` = NULL WHERE `checked_out_time` = '0000-00-00 00:00:00';
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
INSERT INTO `#__menu` (`menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `level`, `component_id`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `lft`, `rgt`, `home`, `language`, `client_id`, `publish_up`, `publish_down`) VALUES ('main', 'com_messages_manager', 'Private Messages', '', 'Messaging/Private Messages', 'index.php?option=com_messages&view=messages', 'component', 1, 10, 2, 15, 0, '0000-00-00 00:00:00', 0, 0, 'class:messages', 0, '', 17, 20, 0, '*', 1, '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `#__menu` (`menutype`, `title`, `alias`, `note`, `path`, `link`, `type`, `published`, `parent_id`, `level`, `component_id`, `checked_out`, `checked_out_time`, `browserNav`, `access`, `img`, `template_style_id`, `params`, `lft`, `rgt`, `home`, `language`, `client_id`, `publish_up`, `publish_down`)
SELECT 'main', 'com_messages_manager', 'Private Messages', '', 'Messaging/Private Messages', 'index.php?option=com_messages&view=messages', 'component', 1, 10, 2, `extension_id`, 0, NULL, 0, 0, 'class:messages-add', 0, '', 18, 19, 0, '*', 1, NULL, NULL FROM `#__extensions` WHERE `name` = 'com_messages';
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
ALTER TABLE "#__menu" ADD COLUMN "publish_up" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL;
ALTER TABLE "#__menu" ADD COLUMN "publish_down" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL;
ALTER TABLE "#__menu" ADD COLUMN "publish_up" timestamp without time zone;
ALTER TABLE "#__menu" ADD COLUMN "publish_down" timestamp without time zone;

ALTER TABLE "#__menu" ALTER COLUMN "checked_out_time" DROP NOT NULL;
ALTER TABLE "#__menu" ALTER COLUMN "checked_out_time" DROP DEFAULT;

UPDATE "#__menu" SET "checked_out_time" = NULL WHERE "checked_out_time" = '1970-01-01 00:00:00';
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
INSERT INTO "#__menu" ("menutype", "title", "alias", "note", "path", "link", "type", "published", "parent_id", "level", "component_id", "checked_out", "checked_out_time", "browserNav", "access", "img", "template_style_id", "params", "lft", "rgt", "home", "language", "client_id")
SELECT 'main', 'com_messages_manager', 'Private Messages', '', 'Messaging/Private Messages', 'index.php?option=com_messages&view=messages', 'component', 1, 10, 2, "extension_id", 0, '1970-01-01 00:00:00', 0, 0, 'class:messages-add', 0, '', 18, 19, 0, '*', 1 FROM "#__extensions" WHERE "name" = 'com_messages';
INSERT INTO "#__menu" ("menutype", "title", "alias", "note", "path", "link", "type", "published", "parent_id", "level", "component_id", "checked_out", "checked_out_time", "browserNav", "access", "img", "template_style_id", "params", "lft", "rgt", "home", "language", "client_id", "publish_up", "publish_down")
SELECT 'main', 'com_messages_manager', 'Private Messages', '', 'Messaging/Private Messages', 'index.php?option=com_messages&view=messages', 'component', 1, 10, 2, "extension_id", 0, NULL, 0, 0, 'class:messages-add', 0, '', 18, 19, 0, '*', 1, NULL, NULL FROM "#__extensions" WHERE "name" = 'com_messages';
10 changes: 5 additions & 5 deletions administrator/components/com_menus/Table/MenuTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ public function check()
// Set publish_up to null date if not set
if (!$this->publish_up)
{
$this->publish_up = $db->getNullDate();
$this->publish_up = null;
}

// Set publish_down to null date if not set
if (!$this->publish_down)
{
$this->publish_down = $db->getNullDate();
$this->publish_down = null;
}

// Check the publish down date is not earlier than publish up.
if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up)
if (!is_null($this->publish_down) && !is_null($this->publish_up) && $this->publish_down < $this->publish_up)
{
$this->setError(Text::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));

Expand All @@ -88,8 +88,8 @@ public function check()
if ((int) $this->home)
{
// Set the publish down/up always for home.
$this->publish_up = $db->getNullDate();
$this->publish_down = $db->getNullDate();
$this->publish_up = null;
$this->publish_down = null;
}
}

Expand Down
82 changes: 41 additions & 41 deletions installation/sql/mysql/joomla.sql

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions installation/sql/postgresql/joomla.sql

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions libraries/src/Menu/SiteMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function load()
{
$loader = function ()
{
$nullDate = $this->db->getNullDate();
$currentDate = Factory::getDate()->toSql();

$query = $this->db->getQuery(true)
Expand Down Expand Up @@ -135,22 +134,20 @@ public function load()
->extendWhere(
'AND',
[
$this->db->quoteName('m.publish_up') . ' = :nullDate1',
$this->db->quoteName('m.publish_up') . ' IS NULL',
$this->db->quoteName('m.publish_up') . ' <= :currentDate1',
],
'OR'
)
->bind(':nullDate1', $nullDate)
->bind(':currentDate1', $currentDate)
->extendWhere(
'AND',
[
$this->db->quoteName('m.publish_down') . ' = :nullDate2',
$this->db->quoteName('m.publish_down') . ' IS NULL',
$this->db->quoteName('m.publish_down') . ' >= :currentDate2',
],
'OR'
)
->bind(':nullDate2', $nullDate)
->bind(':currentDate2', $currentDate)
->order($this->db->quoteName('m.lft'));

Expand Down
23 changes: 21 additions & 2 deletions libraries/src/Table/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
*/
class Menu extends Nested
{
/**
* Indicates that columns fully support the NULL value in the database
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
protected $_supportNullValue = true;

/**
* Constructor
*
Expand Down Expand Up @@ -144,6 +152,17 @@ public function check()
return false;
}

// Set publish_up, publish_down to null if not set
if (!$this->publish_up)
{
$this->publish_up = null;
}

if (!$this->publish_down)
{
$this->publish_down = null;
}

return true;
}

Expand All @@ -157,7 +176,7 @@ public function check()
* @see Table::store()
* @since 1.6
*/
public function store($updateNulls = false)
public function store($updateNulls = true)
{
$db = $this->getDbo();

Expand Down Expand Up @@ -277,7 +296,7 @@ public function store($updateNulls = false)

$table->home = 0;
$table->checked_out = 0;
$table->checked_out_time = $db->getNullDate();
$table->checked_out_time = null;
$table->store();
}
}
Expand Down