Changeset 26371


Ignore:
Timestamp:
06/15/10 21:04:57 (7 years ago)
Author:
jval
Message:

Complement/fix r26367, refs #1626

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

Legend:

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

    r26367 r26371  
    658658 * then too. Important: If you don't have the same lang0 and auto workflow
    659659 * configuration in all language hosts you need to run the multilang.php
    660  * script instead and that one needs to be run at all language hosts and in
    661  * reverse language preference order!)
     660 * script instead and it needs to be run at all language hosts and in reverse
     661 * language preference order! It handles current language and configured
     662 * workflow(s) only and doesn't therefore e.g. delete removed untranslated
     663 * languages like the multilangs.php script does. Note: The scripts have
     664 * subtree support also. You can give a topic guid/id as a GET parameter:
     665 * 'topic'.)
    662666 * The order of languages matters. Content is synced to lang0 from the first
    663667 * matching language from the array. (If you copy exactly the same data as in
     
    692696 * workflow related code is only active when either of the settings is set.
    693697 *
    694  * Note: If you later disable this feature and execute the multilangs.php or
    695  * multilang.php script automatically generated lang0 content is deleted. If
    696  * you want duplicate langX content to be deleted instead (so that master
    697  * content is left to lang0 instead of langX - please note that you might of
    698  * course get mixed language contents to lang0 then - it's a feature not a
    699  * bug), define this setting as array('') before you run the script. (Naturally
    700  * you can remove it after you've executed the script.)
     698 * Note: If you later disable this feature and execute the multilangs.php
     699 * script automatically generated lang0 content is deleted. If you want
     700 * duplicate langX content to be deleted instead (so that master content is
     701 * left to lang0 instead of langX - please note that you might of course get
     702 * mixed language contents to lang0 then - it's a feature not a bug), define
     703 * this setting as array('') before you run the script. (Naturally you can
     704 * remove it after you've executed the script.)
    701705 *
    702706 * If disabled, define an empty array or false/null.
     
    730734 * then too. Important: If you don't have the same auto and lang0 workflow
    731735 * configuration in all language hosts you need to run the multilang.php
    732  * script instead and that one needs to be run at all language hosts and in
    733  * reverse language preference order!)
     736 * script instead and it needs to be run at all language hosts and in reverse
     737 * language preference order! It handles current language and configured
     738 * workflow(s) only and doesn't therefore e.g. delete removed untranslated
     739 * languages like the multilangs.php script does. Note: The scripts have
     740 * subtree support also. You can give a topic guid/id as a GET parameter:
     741 * 'topic'.)
    734742 * The order of languages matters. Untranslated content is being kept in sync
    735743 * with content from the first matching language from the array. Translated
     
    761769 * want to happen if you actually use lang0 content for something.
    762770 *
    763  * Note: If you later disable this feature and execute the multilangs.php or
    764  * multilang.php script automatically generated langX content is deleted.
     771 * Note: If you later disable this feature and execute the multilangs.php
     772 * script automatically generated langX content is deleted.
    765773 *
    766774 * If disabled, define an empty array or false/null.
  • branches/ragnaroek/midcom/midcom.core/midcom/exec/multilang.php

    r26251 r26371  
    88{
    99    $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 'Failed to get root topic. Aborting.');
     10}
     11
     12if (isset($_REQUEST['topic']))
     13{
     14    try
     15    {
     16        $topic = new midgard_topic($_REQUEST['topic']);
     17    }
     18    catch (Exception $e)
     19    {
     20        $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to get topic {$_REQUEST['topic']}. Aborting.");
     21    }
    1022}
    1123
     
    2335<p>Done.</p>
    2436
    25 <p>Note:
    26 If you have the same workflow languages in all language hosts, you can run
     37<h2>Notes</h2>
     38
     39<h3>Subtree support</h3>
     40<p>If you want to sync only certain subtree, give its guid/id as GET parameter: 'topic'.</p>
     41
     42<h3>multilangs.php</h3>
     43<p>If you have the same workflow languages in all language hosts, you can run
    2744/midcom-exec-midcom/multilangs.php which will sync the site tree in all
    28 languages in one go - and in correct order. Also: If you have workflow
    29 languages included which aren't actually accessible, the multilangs.php
    30 script will also handle those languages properly. So use it if you can
    31 (you have the same language configuration in all hosts).</p>
     45languages in one go - and in correct order.</p>
     46<p>If you have workflow languages included which aren't actually accessible,
     47the multilangs.php script will also handle those languages properly. Also if
     48you remove languages from the workflow or disable a workflow only the
     49multilangs.php script handles them.</p>
     50<p>So use it if you can (you have the same language configuration in all
     51hosts).</p>
  • branches/ragnaroek/midcom/midcom.core/midcom/exec/multilangs.php

    r26253 r26371  
    88{
    99    $_MIDCOM->generate_error(MIDCOM_ERRCRIT, 'Failed to get root topic. Aborting.');
     10}
     11
     12if (isset($_REQUEST['topic']))
     13{
     14    try
     15    {
     16        $topic = new midgard_topic($_REQUEST['topic']);
     17    }
     18    catch (Exception $e)
     19    {
     20        $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Failed to get topic {$_REQUEST['topic']}. Aborting.");
     21    }
    1022}
    1123
     
    3648midgard_connection::set_lang($real_lang);
    3749
     50midcom_services_multilang::tree($topic, false);
     51
    3852?>
    3953
    4054<p>Done.</p>
    4155
    42 <p>Note:
    43 If you don't have the same workflow languages in all language hosts, you should run
    44 /midcom-exec-midcom/multilang.php which will sync the site tree in the host language only.</p>
     56<h2>Notes</h2>
     57
     58<h3>Subtree support</h3>
     59<p>If you want to sync only certain subtree, give its guid/id as GET parameter: 'topic'.</p>
     60
     61<h3>multilang.php</h3>
     62<p>If you don't have the same workflow languages in all language hosts, you
     63should run /midcom-exec-midcom/multilang.php which will sync the site tree in
     64the host language only.</p>
  • branches/ragnaroek/midcom/midcom.core/midcom/services/multilang.php

    r26367 r26371  
    492492        }
    493493
    494         if ($GLOBALS['midcom_config']['multilang_auto_langs'])
    495         {
    496             self::sync($object, self::langs($GLOBALS['midcom_config']['multilang_auto_langs']), $domain, $is_update, false);
    497         }
    498 
    499         if ($GLOBALS['midcom_config']['multilang_lang0_langs'])
    500         {
    501             self::sync($object, self::langs($GLOBALS['midcom_config']['multilang_lang0_langs']), $domain, $is_update, true);
    502         }
    503 
    504         if (!$auto)
     494        if ($auto)
     495        {
     496            if ($GLOBALS['midcom_config']['multilang_auto_langs'])
     497            {
     498                self::sync($object, self::langs($GLOBALS['midcom_config']['multilang_auto_langs']), $domain, $is_update, false);
     499            }
     500
     501            if ($GLOBALS['midcom_config']['multilang_lang0_langs'])
     502            {
     503                self::sync($object, self::langs($GLOBALS['midcom_config']['multilang_lang0_langs']), $domain, $is_update, true);
     504            }
     505        }
     506        else
    505507        {
    506508            if ($languages = $object->get_languages())
     
    711713    // These can e.g. use $_MIDCOM freely.
    712714
    713     function tree($object, $memory_limit = null)
    714     {
     715    function tree($object, $auto = true, $memory_limit = null)
     716    {
     717        $is_update = null;
     718        if ($auto) $is_update = true;
     719
    715720        $restore_memory_limit = false;
    716721        if (!$memory_limit)
     
    720725        }
    721726
    722         self::syncs($object);
     727        self::syncs($object, $is_update);
    723728
    724729        if (   !empty($object->symlink)
     
    732737            {
    733738                $object = $topic;
    734                 self::syncs($object);
     739                self::syncs($object, $is_update);
    735740            }
    736741            else
     
    758763                while ($object = array_pop($objects))
    759764                {
    760                     self::tree($object, $memory_limit);
     765                    self::tree($object, $auto, $memory_limit);
    761766                }
    762767            }
Note: See TracChangeset for help on using the changeset viewer.