示例#1
0
 static function tableExists($table)
 {
     $db = JFactory::getDBO();
     $prefix = $db->getPrefix();
     $table = str_replace('#__', '', $table);
     $table = str_replace($prefix, '', $table);
     $table = $db->getPrefix() . $table;
     if (isset(self::$cache[$table])) {
         return self::$cache[$table];
     }
     $q = "SHOW TABLES LIKE '" . $table . "'";
     $db->setQuery($q);
     $r = $db->loadResult();
     if (empty(self::$cache)) {
         self::$cache = array();
     }
     if (!empty($r)) {
         self::$cache[$table] = true;
         return true;
     }
     self::$cache[$table] = false;
     return false;
 }