View more context

 

wmk

well, a PR for onBeforeDuplicate() would be great! Maybe switchable with a config variable in case you really don't need it. But when you duplicate a DO I suppose to get all content (and if configured all relations) duplicated. Normal text is also duplicated.

Conan

Yes it is a well needed feature, I might have time to look at it during the weekend. 🙂

blueskies

Has anyone had issues with new SiteConfig records being added? I'm suspecting Fluent is doing something odd.... I have a situation now where I have an Extended SiteConfig (with some translatable text-fields) and there are now suddenly 3 SiteConfig records in the database.... When I go to /settings in the CMS it's displaying the content for SiteConfig record #1 but the the website is using the SiteConfig record #3 (the newest one added)....

blueskies

Hmmm... this is very odd, because I haven't yet found out what triggers it (so I can't really raise an issue in github about it 😞 ). But it's good to hear I'm not crazy and seeing things 🤪 I've seen it once happen on the live server... suddenly there were some SiteConfig things missing from /admin/settings and when we dug into the db, we saw there were multiple SiteConfigs (and one quite "fresh" one with some blank fields). This happened after we upgraded to 4.4.4 to fix the bug listed in https://github.com/tractorcow-farm/silverstripe-fluent/issues/570. So we assumed it was possibly left over from that nasty bug.

But then yesterday, in my local dev, I was adding some more fields to the Extended SiteConfig, I dev/build, and I filled them in. Then I couldn't decided on the variable names, so I changed them a few times, dev/build a few times, and suddenly there were 3 SiteConfig entries in my local db. So I'm not entirely sure what triggers it or what is happening.... Have you narrowed down when the extra Siteconfig records are created?

Show 1 attachment(s)
baukezwaan

We are experiencing an issue with the handling of deletes in the latest version(s) of Fluent. When the latest record of for instance a Page is deleted, the deteleBaseRecord is being called.
This function deletes the record from several tables, and does this based on ID. This goes wrong for the _Localised table. There the selection should be on RecordID instead.

How to reproduce:

• fresh install of SS4 + Fluent ^4 (tested on 4.4.1 and 4.4.3) • create some Locales • add some pages, and save them in multiple languages (to make the ID higher than the RecordID in the version table) • Now; add a new page via the CMS • Remember the ID (for instance id=16) • Check which record is in SiteTree_Localised on ID=16 • Delete the page via the CMS • See record ID=16 is gone in SiteTree_Localised (instead of RecordID=16)

The snippet below fixes the issue, but probably not in the most elegant way... :face_with_head_bandage:

    protected function deleteBaseRecord(DataObject $record)
    {

        //... (collapsed)

        foreach ($queriedTables as $table) {

            if (strpos(strtolower($table), '_localised') > 0 ) {
                $delete = SQLDelete::create("\"{$table}\"", array('"RecordID"' => $record->ID));
            } else {
                $delete = SQLDelete::create("\"{$table}\"", array('"ID"' => $record->ID));
            }
Hide attachment content
greg_808

yes i am running on Fluent 4.4.4. I wasn’t able to find out when the new siteconfigs are added.

blueskies

An issue was raised about the extra SiteConfig records here: https://github.com/tractorcow-farm/silverstripe-fluent/issues/495 Hopefully we'll get to the bottom of it. Do you have any extra info to post? Or can you confirm you see the issue with a plain custom SiteConfig?

Show 1 attachment(s)
derralf

Hi,
I've got a weird problem with Siteconfig.

SiteConfig has extension CustomSiteConfig
SiteConfig has fluent extension
(see config below)

Somehow:

• multiple SiteConfig-Rows are created in DB • for the multiple SiteConfig-Rows localised are created • the right translations are not found

See Example below.

In the Backend I see the translations (SiteConfig ID 1 gets translated, see below).
But no translation is shown in Frontend or accessible via PHP*. Seems like the CMS thinks the fields are NULL (see below)

* e.g.
$SiteConfig = SiteConfig::current_site_config();
var_dump($SiteConfig->MailTo);

mysite.yml

---
Name: myproject
---
...
SilverStripe\SiteConfig\SiteConfig:
  extensions:
    - App\Extension\CustomSiteConfig

fluentconfig.yml

---
Name: myfluentconfig
After:
  - '#versionedfiles'
  - '#myproject'
---
...
...
SilverStripe\SiteConfig\SiteConfig:
  extensions:
    - 'TractorCow\Fluent\Extension\FluentExtension'
  translate:
    - 'Title'
    - 'Tagline'
    - 'MailSubject'
    - 'MailThankYouMessage'
    - 'ContactMapInfoWindowTitle'
    - 'ContactMapInfoWindowAddress'
...
...

Table SiteConfig

The "NULL-Fields" are not shown in CMS, all fields seem to have been filled out.
The following returns NULL in it_IT and de_DE though "mailto:[email protected]|[email protected]" is shown in Backend in all Languages:

$SiteConfig = SiteConfig::current_site_config();
var_dump($SiteConfig->MailTo);

Table SiteConfig_Localised

Values from ID 2 and 4 are shown in Frontend.
Values from ID 3 and 5 shown in Backend.
So the shown/displayed values can not be edited. And the values that I can edit are not used/shown in Frontend/PHP.

Edit:
If I use class CustomSiteConfig extends FluentExtension
I get this Error:
[Emergency] Uncaught SilverStripe\ORM\Connect\DatabaseException: Couldn't run query: ALTER TABLE "SiteConfig_Localised" DROP INDEX "Fluent_Record", ADD unique "Fluent_Record" ("RecordID","Locale","RecordID","Locale") 42S21-1060: Duplicate column name 'RecordID'

Hide attachment content
blueo

FWIW I've had site config objects created in a test that then hang over into the main DB. Something to do with SiteConfig::create() vs SiteConfig::current_site_config()