Ignore:
Timestamp:
10/19/08 11:41:51 (4 years ago)
Author:
hverton
Message:

language packs now store the install timestamp in the configuration table
modified the "installed" detection code to fix an issue when upgrading from v7.1 to v7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/ExiteCMS/translations/php-files/modules/translations/langpack.template

    r1835 r1869  
    119119                if (!CMS_CLI) $variables['message'] .= sprintf($locale['307'],LP_LOCALE, LP_LANGUAGE); 
    120120            } 
     121            // update the install timestamp in the config 
     122            if (isset($settings['LanguagePack.'.LP_LANGUAGE])) { 
     123                $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = '".LP_DATE."' WHERE cfg_name = 'LanguagePack.".LP_LANGUAGE."'"); 
     124            } else { 
     125                $result = dbquery("INSERT INTO ".$db_prefix."configuration (cfg_name, cfg_value) VALUES ('LanguagePack.".LP_LANGUAGE."', '".LP_DATE."')"); 
     126            } 
    121127        } 
    122128    } 
     
    140146 
    141147        // check the last update of the locale 
    142         $variables['last_update'] = dbfunction("MAX(locales_datestamp)", "locales", "locales_code = '".LP_LOCALE."' AND locales_name NOT LIKE 'modules%'"); 
     148        $variables['last_update'] = isset($settings['LanguagePack.'.LP_LANGUAGE]) ? $settings['LanguagePack.'.LP_LANGUAGE] : dbfunction("MAX(locales_datestamp)", "locales", "locales_code = '".LP_LOCALE."' AND locales_name NOT LIKE 'modules%'"); 
    143149         
    144150        // check if this language pack has been installed 
    145151        $variables['can_install'] = dbcount("(*)", "locale", "locale_code = '".LP_LOCALE."'") == 0; 
    146         $variables['can_remove'] = $variables['can_install'] ? FALSE : TRUE; 
    147         $variables['can_upgrade'] = $variables['can_remove']; 
     152        $variables['can_remove'] = LP_LOCALE != "en" && $variables['can_install'] == false; 
     153        $variables['can_upgrade'] = $variables['can_install'] == false && $variables['last_update'] < LP_DATE; 
    148154     
    149155        // define the body panel variables 
Note: See TracChangeset for help on using the changeset viewer.