Beispiel #1
0
 public static function getDBPrefix()
 {
     //Use alone for higher performance table prefix fetch
     $prefix = '';
     //Use for standard table prefix fetch (Lower performance, but no configuration required)
     if (self::$tablePrefix == '') {
         if (self::$config != '') {
             try {
                 $config = self::$config;
                 $prefix = $config->global->resources->db->table_prefix;
             } catch (Exception $e) {
             }
         } else {
             if (file_exists('app/etc/local.xml')) {
                 try {
                     $config = self::$config = simplexml_load_file('app/etc/local.xml');
                     $prefix = $config->global->resources->db->table_prefix;
                 } catch (Exception $e) {
                 }
             }
         }
         if ($prefix != '') {
             $prefix = $prefix . "_";
         }
         self::$tablePrefix = $prefix;
         return $prefix;
     } else {
         return self::$tablePrefix;
     }
 }