Trying to get lang import to work in the installer; it's not working ATM - cache file is generated with lang_id = 0. Syncing to Nighthawk.
--- a/includes/functions.php Tue Nov 06 13:35:40 2007 -0500
+++ b/includes/functions.php Tue Nov 06 16:22:43 2007 -0500
@@ -3206,14 +3206,18 @@
$db->_die('functions.php - installing language');
$lang_id = $db->insert_id();
- if ( empty($lang_id) )
- return false;
+ if ( empty($lang_id) || $lang_id == 0 )
+ {
+ $db->_die('functions.php - invalid returned lang_id');
+ }
// Do we also need to install a language file?
if ( is_string($lang_file) && file_exists($lang_file) )
{
$lang = new Language($lang_id);
$lang->import($lang_file);
+ $lang->fetch(false);
+ $lang->regen_caches();
}
else if ( is_string($lang_file) && !file_exists($lang_file) )
{
--- a/includes/lang.php Tue Nov 06 13:35:40 2007 -0500
+++ b/includes/lang.php Tue Nov 06 16:22:43 2007 -0500
@@ -154,7 +154,8 @@
}
else
{
- $db->_die('lang.php - No strings for language ' . $this->lang_code);
+ if ( !defined('ENANO_ALLOW_LOAD_NOLANG') )
+ $db->_die('lang.php - No strings for language ' . $this->lang_code);
}
}
}
@@ -215,6 +216,9 @@
if ( !file_exists($file) )
$db->_die('lang.php - can\'t import language file: string file doesn\'t exist');
+ if ( $this->lang_id == 0 )
+ $db->_die('lang.php - BUG: trying to perform import when $lang->lang_id == 0');
+
$contents = trim(@file_get_contents($file));
if ( empty($contents) )
--- a/install.php Tue Nov 06 13:35:40 2007 -0500
+++ b/install.php Tue Nov 06 16:22:43 2007 -0500
@@ -586,9 +586,6 @@
$lang_file = ENANO_ROOT . "/language/english/enano.json";
install_language("eng", "English", "English", $lang_file);
- $lang = new Language('eng');
- $lang->import($lang_file);
-
return true;
}