diff --git a/include/class.page.php b/include/class.page.php index a49a7b263d12632ee662aba4c1288c2bcf4616b9..2e502548acadf4aa2ce56e3ce9e3cfc5d55c5ad6 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -275,13 +275,9 @@ class Page extends VerySimpleModel { $this->isactive = (bool) $vars['isactive']; $this->notes = Format::sanitize($vars['notes']); - if (!isset($this->id)) { - if ($this->save()) { - $this->content_id = $this->id; - $rv = $this->save(); - } - } - elseif ($this->save()) + $isnew = !isset($this->id); + $rv = $this->save(); + if (!$isnew) $rv = $this->saveTranslations($vars, $errors); // Attach inline attachments from the editor diff --git a/include/upgrader/streams/core/9143a511-00000000.cleanup.sql b/include/upgrader/streams/core/9143a511-00000000.cleanup.sql new file mode 100644 index 0000000000000000000000000000000000000000..f020b9af3e4ea6bb0fdcbce8e4083571a703aac8 --- /dev/null +++ b/include/upgrader/streams/core/9143a511-00000000.cleanup.sql @@ -0,0 +1,28 @@ +/** + * @signature 959aca6ed189cd918d227a3ea8a135a3 + * @version v1.9.6 + * @title Retire `private`, `required`, and `edit_mask` for fields + * + */ + +ALTER TABLE `%TABLE_PREFIX%form_field` + DROP `private`, + DROP `required`, + DROP `edit_mask`; + +ALTER TABLE `%TABLE_PREFIX%content` + DROP `lang`; + +-- DROP IF EXISTS `%content.content_id` +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = '%TABLE_PREFIX%content' + AND table_schema = DATABASE() + AND column_name = 'content_id' + ) > 0, + "SELECT 1", + "ALTER TABLE `%TABLE_PREFIX%content` DROP `content_id`" +)); +PREPARE stmt FROM @s; +EXECUTE stmt; diff --git a/include/upgrader/streams/core/9143a511-959aca6e.cleanup.sql b/include/upgrader/streams/core/9143a511-959aca6e.cleanup.sql deleted file mode 100644 index 1961edddc1fbecdbf9c5404443f2cc3357be90db..0000000000000000000000000000000000000000 --- a/include/upgrader/streams/core/9143a511-959aca6e.cleanup.sql +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @signature 959aca6ed189cd918d227a3ea8a135a3 - * @version v1.9.6 - * @title Retire `private`, `required`, and `edit_mask` for fields - * - */ - -ALTER TABLE `%TABLE_PREFIX%form_field` - DROP `private`, - DROP `required`, - DROP `edit_mask`; diff --git a/include/upgrader/streams/core/9143a511-959aca6e.patch.sql b/include/upgrader/streams/core/9143a511-959aca6e.patch.sql deleted file mode 100644 index 706c255b39657fb9bb58d5f014a99fc6813dfd99..0000000000000000000000000000000000000000 --- a/include/upgrader/streams/core/9143a511-959aca6e.patch.sql +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @signature 959aca6ed189cd918d227a3ea8a135a3 - * @version v1.9.6 - * @title Retire `private`, `required`, and `edit_mask` for fields - * - */ - --- Finished with patch -UPDATE `%TABLE_PREFIX%config` - SET `value` = '959aca6ed189cd918d227a3ea8a135a3' - WHERE `key` = 'schema_signature' AND `namespace` = 'core'; diff --git a/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql b/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql index 39d7cb4698d1aa81e7f3fc2e48b0a7943fe86931..67a21aa7759080efc95cc08428285ce8490462c9 100644 --- a/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql +++ b/include/upgrader/streams/core/f5692e24-4323a6a8.patch.sql @@ -69,11 +69,7 @@ ALTER TABLE `%TABLE_PREFIX%help_topic` -- Add `content_id` to the content table to allow for translations RENAME TABLE `%TABLE_PREFIX%page` TO `%TABLE_PREFIX%content`; ALTER TABLE `%TABLE_PREFIX%content` - CHANGE `type` `type` varchar(32) NOT NULL default 'other', - ADD `content_id` int(10) unsigned NOT NULL default 0 AFTER `id`; - -UPDATE `%TABLE_PREFIX%content` - SET `content_id` = `id`; + CHANGE `type` `type` varchar(32) NOT NULL default 'other'; DROP TABLE IF EXISTS `%TABLE_PREFIX%user_account`; CREATE TABLE `%TABLE_PREFIX%user_account` ( diff --git a/setup/inc/streams/core/install-mysql.sql b/setup/inc/streams/core/install-mysql.sql index 7914d88d4e9deb50f818c8ae9e000e26982b5670..9226cabec2cb0d5981029bbef412095bbacbf419 100644 --- a/setup/inc/streams/core/install-mysql.sql +++ b/setup/inc/streams/core/install-mysql.sql @@ -799,12 +799,10 @@ CREATE TABLE `%TABLE_PREFIX%task` ( -- pages CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%content` ( `id` int(10) unsigned NOT NULL auto_increment, - `content_id` int(10) unsigned NOT NULL default '0', `isactive` tinyint(1) unsigned NOT NULL default '0', `type` varchar(32) NOT NULL default 'other', `name` varchar(255) NOT NULL, `body` text NOT NULL, - `lang` varchar(16) NOT NULL default 'en_US', `notes` text, `created` datetime NOT NULL, `updated` datetime NOT NULL,