mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-12 10:31:09 +03:00
Do not rely on database state during installation
This commit is contained in:
parent
edef518da3
commit
037b823db9
@ -66,9 +66,9 @@ function locale_pattern_check($locale)
|
|||||||
|
|
||||||
function get_available_locales()
|
function get_available_locales()
|
||||||
{
|
{
|
||||||
if (!Database::isInitialized()) {
|
if (installation_in_progress()) {
|
||||||
// We cannot use database by some reasons, thus we only can use
|
// We cannot rely on the database during installation, thus we only can
|
||||||
// discovered locales as available locales.
|
// use discovered locales as available locales.
|
||||||
return discover_locales();
|
return discover_locales();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,9 +682,9 @@ function load_messages($locale)
|
|||||||
if (!isset($messages[$locale])) {
|
if (!isset($messages[$locale])) {
|
||||||
$messages[$locale] = array();
|
$messages[$locale] = array();
|
||||||
|
|
||||||
if (!Database::isInitialized()) {
|
if (installation_in_progress()) {
|
||||||
// Load localized strings from files because we cannot use database
|
// Load localized strings from files because we cannot rely on the
|
||||||
// by some reasons.
|
// database during installation.
|
||||||
$locale_file = MIBEW_FS_ROOT . "/locales/{$locale}/translation.po";
|
$locale_file = MIBEW_FS_ROOT . "/locales/{$locale}/translation.po";
|
||||||
$locale_data = read_locale_file($locale_file);
|
$locale_data = read_locale_file($locale_file);
|
||||||
|
|
||||||
@ -813,9 +813,10 @@ function get_localized_string($string, $locale)
|
|||||||
*/
|
*/
|
||||||
function save_message($locale, $key, $value)
|
function save_message($locale, $key, $value)
|
||||||
{
|
{
|
||||||
if (!Database::isInitialized()) {
|
if (installation_in_progress()) {
|
||||||
// We cannot save a message if the database was not initialized
|
// We cannot save a message if the installation is in progres because
|
||||||
// correctly by some reasons. Just do nothing in that case.
|
// there are no guarantees that database is initialized and has all
|
||||||
|
// necessary tables. Just do nothing in that case.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user