Changeset 26295


Ignore:
Timestamp:
06/08/10 15:01:12 (7 years ago)
Author:
jval
Message:

Handle theoretical move from lang0 workflow to auto workflow by deleting duplicate lang0 contents when lang0 content isn't used for anything, refs #1626

Location:
branches/ragnaroek/midcom/midcom.core/midcom
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ragnaroek/midcom/midcom.core/midcom/config/midcom_config.php

    r26268 r26295  
    736736 * It's recommended to use this workflow only when you have a legitimate use
    737737 * case for it. Otherwise you should use the lang0 workflow.
     738 *
     739 * A special case: If you use the lang0 workflow for the same content as in
     740 * this language host, you need to specify the lang0 languages even if this
     741 * language host doesn't really need the lang0 workflow for anything. This
     742 * applies to the built-in default_lang=lang0 workflow too (in which case
     743 * define multilang_lang0_langs as array('')).
     744 * Otherwise lang0 content might be deleted by this workflow as unnecessary
     745 * content (if lang0 has same content as langX) which you naturally don't
     746 * want to happen if you actually use lang0 content for something.
    738747 *
    739748 * If disabled, define an empty array or false/null.
  • branches/ragnaroek/midcom/midcom.core/midcom/services/multilang.php

    r26294 r26295  
    322322                {
    323323                    $object->set_parameter($domain, $real_lang, true);
     324
     325                    if (   !$GLOBALS['midcom_config']['multilang_lang0_langs']
     326                        && !isset($langs[''])
     327                        && $real_lang)
     328                    {
     329                        self::set_default_lang_to_lang();
     330                        midgard_connection::set_lang('');
     331
     332                        try
     333                        {
     334                            $class = get_class($object);
     335                            $object_in_lang0 = new $class($object->guid);
     336
     337                            self::is_real(false);
     338                            $object_in_lang0->delete();
     339                            self::is_real(true);
     340                        }
     341                        catch (Exception $e)
     342                        {
     343                            // Nothing to do. Object doesn't have content in lang0.
     344                        }
     345
     346                        midgard_connection::set_lang($real_lang);
     347                        self::set_default_lang_back();
     348                    }
    324349                }
    325350
Note: See TracChangeset for help on using the changeset viewer.