public static function queryAllWithDBCache($query, $prefix = null, $type = 'both', $count = -1) { $cache = queryCache::getInstance(); $cache->reset($query, $prefix); if (!$cache->load()) { $cache->contents = POD::queryAllWithCache($query, $type, $count); $cache->update(); } return $cache->contents; }
function getCategories($blogid, $format = 'tree') { global $database; global $__gCacheCategoryTree, $__gCacheCategoryRaw; if ($format == 'tree' && !empty($__gCacheCategoryTree)) { return $__gCacheCategoryTree; } else { if ($format == 'raw' && !empty($__gCacheCategoryRaw)) { return $__gCacheCategoryRaw; } } $rows = POD::queryAllWithCache("SELECT *\n\t\t\tFROM {$database['prefix']}Categories\n\t\t\tWHERE blogid = {$blogid}\n\t\t\t\tAND id >= 0\n\t\t\tORDER BY parent, priority"); $categories = array(); if (empty($rows)) { $rows = array(); } if ($format == 'raw') { foreach ($rows as $category) { $categories[$category['id']] = $category; } $__gCacheCategoryRaw = $categories; return $categories; } foreach ($rows as $category) { if ($category['parent'] == null) { $category['children'] = array(); $categories[$category['id']] = $category; } else { if (isset($categories[$category['parent']])) { array_push($categories[$category['parent']]['children'], $category); } } } $__gCacheCategoryTree = $categories; return $categories; }
function getCurrentSetting($name) { global $database, $activePlugins; global $pluginSetting; if (!in_array($name, $activePlugins)) { return false; } if (empty($pluginSetting)) { $settings = POD::queryAllWithCache("SELECT name, settings \n\t\t\t\tFROM {$database['prefix']}Plugins \n\t\t\t\tWHERE blogid = " . getBlogId(), MYSQL_NUM); foreach ($settings as $k => $v) { $pluginSetting[$v[0]] = $v[1]; } } if (isset($pluginSetting[$name])) { return $pluginSetting[$name]; } return null; }
function queryAllWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1) { $cache = new queryCache($query, $prefix); if (!$cache->load()) { $cache->contents = POD::queryAllWithCache($query, $type, $count); $cache->update(); } return $cache->contents; }
function queryAllWithDBCache($query, $prefix = null, $type = MYSQL_BOTH, $count = -1) { // requireComponent('Needlworks.Cache.PageCache'); $cache = new queryCache($query, $prefix); if (!$cache->load()) { $cache->contents = POD::queryAllWithCache($query, $type, $count); $cache->update(); } return $cache->contents; }