Multilingual: change Default Locale breaks Global blocks

Permalink 9 0 Browser Info Environment
Changin default language break global blocks.

To test:
1) install concrete5 8.1 (empty site) and use default elemental theme
2) add new locale and make it default
3) go to page

An exception occurred while executing 'insert into Pages (cID, siteTreeID, ptID, cParentID, uID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cInheritPermissionsFromCID, cDisplayOrder, pkgID, cIsActive) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["161", null, "1", null, "1", "TEMPLATE", null, null, 0, 0, 1]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'cParentID' cannot be null


If you remove Global blocks from elemental theme then page works and is editable.

https://www.concrete5.org/community/forums/usage/missing-sitetree-ca...


Status: New
jruutu replied on at Permalink Reply
I’ve been trying to solve this bug and found out what causes this. Shortly I changed the default locale and after that deleted that original locale.

When trying to find reason of this I ended in Concrete\Core\Page\Page class and method getByPath(…). In line 88, query $db->fetchColumn(…), don’t find any results.

The sql to that query is
select Pages.cID from PagePaths inner join Pages on Pages.cID = PagePaths.cID where cPath = '/!stacks' and siteTreeID = 3


If I change siteTreeID to 1 I got correct page. When querying Pages table with siteTreeID = 1 I got following rows + some pages which I added.

149 /!drafts/view.php
150 /!stacks/view.php
151 /page_not_found.php
152 /desktop.php

So it seems that when changing locale those global system pages don’t get updated to correct SiteTree. If I change Pages table row cID 150 siteTreeID to 3, global blocks works, or at least it looks like that.

In my site, siteTree 1 is deleted so I only has 2-14, 3 is default.

Should it be so, that global blocks belongs to siteTree 0? So if current siteTree don’t have correct page then try to find “global siteTree 0”.

Because if I understood correctly, current situation is that changing current locale break at least global blocks.

Now trying to figure out what should I do. Should I go and change all SiteTree 3 references to SiteTree 1 or is it possible to find some better solution? Any help would be more than welcome.
jruutu replied on at Permalink Reply
I noticed that global blocks are not listed anymore in “Stacks & Global Areas”.

If I comment out line 288 in Concrete\Controller\SinglePage\Dashboard\Blocks\ Stacks those global blocks are shown. Because I really like the feature that you can’t edit global blocks when editing pages, so those global blocks should be accessible in dashboard.


public function view()
    {
        $parent = Page::getByPath(STACKS_PAGE_PATH, 'RECENT', $this->getSite());
        $stm = new StackList();
       // $stm->filterByParentID($parent->getCollectionID());   //line 288
        $stm->excludeGlobalAreas();
        $this->deliverStackList($stm);
        $this->set('canMoveStacks', $this->canMoveStacks($parent));
        $this->set('showGlobalAreasFolder', true);
    }


Should there be possibility show all GlobalAreas? Example checkbox show all?

concrete5 Environment Information

# concrete5 Version
Core Version - 8.1.0
Version Installed - 8.1.0
Database Version - 20170123000000

# concrete5 Packages
None

# concrete5 Overrides
languages/cs_CZ/LC_MESSAGES/messages.mo, languages/cs_CZ/LC_MESSAGES, languages/cs_CZ, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/en_GB/LC_MESSAGES/messages.mo, languages/en_GB/LC_MESSAGES, languages/en_GB, languages/es_PE/LC_MESSAGES/messages.mo, languages/es_PE/LC_MESSAGES, languages/es_PE, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE, languages/cs_CZ/LC_MESSAGES/messages.mo, languages/cs_CZ/LC_MESSAGES, languages/cs_CZ, languages/da_DK/LC_MESSAGES/messages.mo, languages/da_DK/LC_MESSAGES, languages/da_DK, languages/de_DE/LC_MESSAGES/messages.mo, languages/de_DE/LC_MESSAGES, languages/de_DE, languages/el_GR/LC_MESSAGES/messages.mo, languages/el_GR/LC_MESSAGES, languages/el_GR, languages/en_GB/LC_MESSAGES/messages.mo, languages/en_GB/LC_MESSAGES, languages/en_GB, languages/es_PE/LC_MESSAGES/messages.mo, languages/es_PE/LC_MESSAGES, languages/es_PE, languages/es_PY/LC_MESSAGES/messages.mo, languages/es_PY/LC_MESSAGES, languages/es_PY, languages/fi_FI/LC_MESSAGES/messages.mo, languages/fi_FI/LC_MESSAGES, languages/fi_FI, languages/it_IT/LC_MESSAGES/messages.mo, languages/it_IT/LC_MESSAGES, languages/it_IT, languages/ja_JP/LC_MESSAGES/messages.mo, languages/ja_JP/LC_MESSAGES, languages/ja_JP, languages/nb_NO/LC_MESSAGES/messages.mo, languages/nb_NO/LC_MESSAGES, languages/nb_NO, languages/nl_NL/LC_MESSAGES/messages.mo, languages/nl_NL/LC_MESSAGES, languages/nl_NL, languages/pt_BR/LC_MESSAGES/messages.mo, languages/pt_BR/LC_MESSAGES, languages/pt_BR, languages/ru_RU/LC_MESSAGES/messages.mo, languages/ru_RU/LC_MESSAGES, languages/ru_RU, languages/sv_SE/LC_MESSAGES/messages.mo, languages/sv_SE/LC_MESSAGES, languages/sv_SE

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
apache2handler

# PHP Version
5.5.38

# PHP Extensions
apache2handler, bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imap, intl, json, ldap, libxml, mbstring, mcrypt, memcached, mhash, mysql, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 128M
post_max_size - 64M
sql.safe_mode - Off
upload_max_filesize - 64M
ldap.max_links - Unlimited
memcached.sess_lock_max_wait - 0
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36