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.
authorDan
Tue, 06 Nov 2007 16:22:43 -0500
changeset 241 c671f3bb8aed
parent 240 f0149a27df5f
child 242 78a94f7bb5e3
child 243 a7d0f2711df1
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.
includes/functions.php
includes/lang.php
install.php
--- 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;
 }