本文整理汇总了PHP中build_datastore函数的典型用法代码示例。如果您正苦于以下问题:PHP build_datastore函数的具体用法?PHP build_datastore怎么用?PHP build_datastore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_datastore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_notice_datastore
function build_notice_datastore()
{
global $vbulletin;
$notice_cache = array();
$notice_result = $vbulletin->db->query_read("\n\t\tSELECT notice.noticeid, notice.persistent, notice.dismissible,\n\t\t\t noticecriteria.criteriaid, noticecriteria.condition1, \n\t\t\t noticecriteria.condition2, noticecriteria.condition3\n\t\tFROM " . TABLE_PREFIX . "notice AS notice\n\t\tLEFT JOIN " . TABLE_PREFIX . "noticecriteria AS noticecriteria USING(noticeid)\n\t\tWHERE notice.active = 1\n\t\tORDER BY notice.displayorder, notice.title\n\t");
$tmp_notice = false;
$counter = 1;
$num_rows = $vbulletin->db->num_rows($notice_result);
while ($notice = $vbulletin->db->fetch_array($notice_result)) {
if ($tmp_notice !== false and $tmp_notice['noticeid'] != $notice['noticeid']) {
$notice_cache["{$tmp_notice['noticeid']}"]['persistent'] = $tmp_notice['persistent'];
$notice_cache["{$tmp_notice['noticeid']}"]['dismissible'] = $tmp_notice['dismissible'];
}
if ($notice['criteriaid']) {
foreach (array('condition1', 'condition2', 'condition3') as $condition) {
$notice_cache["{$notice['noticeid']}"]["{$notice['criteriaid']}"][] = $notice["{$condition}"];
}
}
if ($counter == $num_rows) {
$notice_cache["{$notice['noticeid']}"]['persistent'] = $notice['persistent'];
$notice_cache["{$notice['noticeid']}"]['dismissible'] = $notice['dismissible'];
} else {
$tmp_notice = $notice;
++$counter;
}
}
$vbulletin->db->free_result($notice_result);
build_datastore('noticecache', serialize($notice_cache), 1);
}
示例2: build_profilefield_cache
function build_profilefield_cache()
{
global $vbulletin;
$fields = $vbulletin->db->query_read("
SELECT profilefieldid, hidden, required, editable, form
FROM " . TABLE_PREFIX . "profilefield AS profilefield
WHERE hidden = 1
OR (required = 3 AND editable IN (1,2) AND form = 0)
");
$hiddenfields = '';
$requiredfields = array();
while ($field = $vbulletin->db->fetch_array($fields))
{
if ($field['hidden'] == 1)
{
$hiddenfields .= ", '' AS field$field[profilefieldid]";
}
if ($field['form'] == 0 AND $field['required'] == 3 AND ($field['editable'] == 1 OR $field['editable'] == 2))
{
$requiredfields['field' . $field['profilefieldid']] = $field['profilefieldid'];
}
}
$item = array(
'hidden' => $hiddenfields,
'required' => $requiredfields,
);
build_datastore('profilefield', serialize($item), 1);
}
示例3: build_language_datastore
/**
* Builds the languages datastore item
*
* @return array The data inserted into datastore
*/
function build_language_datastore()
{
global $vbulletin;
$languagecache = array();
$languages = $vbulletin->db->query_read("\n\t\tSELECT languageid, title, userselect\n\t\tFROM " . TABLE_PREFIX . "language\n\t\tORDER BY title\n\t");
while ($language = $vbulletin->db->fetch_array($languages)) {
$languagecache["{$language['languageid']}"] = $language;
}
build_datastore('languagecache', serialize($languagecache), 1);
return $languagecache;
}
示例4: build_navigation_datastore
function build_navigation_datastore()
{
global $db, $vbulletin;
$result = array();
$data = $db->query_read_slave("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "navigation\n\t\tWHERE state & " . $vbulletin->bf_misc_navstate['deleted'] . " = 0\n\t\tORDER BY navtype, displayorder\n\t");
while ($row = $db->fetch_array($data)) {
$result[] = $row;
}
build_datastore('navdata', serialize($result), 1);
return $result ? $result : false;
}
示例5: USING
function &build_ranks()
{
global $vbulletin;
$ranks = $vbulletin->db->query_read_slave("\n\t\tSELECT ranklevel AS l, minposts AS m, rankimg AS i, type AS t, stack AS s, display AS d, ranks.usergroupid AS u\n\t\tFROM " . TABLE_PREFIX . "ranks AS ranks\n\t\tLEFT JOIN " . TABLE_PREFIX . "usergroup AS usergroup USING (usergroupid)\n\t\tORDER BY ranks.usergroupid DESC, minposts DESC\n\t");
$rankarray = array();
while ($rank = $vbulletin->db->fetch_array($ranks)) {
$rankarray[] = $rank;
}
build_datastore('ranks', serialize($rankarray), 1);
return $rankarray;
}
示例6: build_language_datastore
/**
* Builds the languages datastore item
*
* @return array The data inserted into datastore
*/
function build_language_datastore()
{
$languagecache = array();
$languages = vB::getDbAssertor()->assertQuery('language', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_Db_Query::COLUMNS_KEY => array('languageid', 'title', 'userselect', 'charset', 'options')), 'title');
$bf_misc_languageoptions = vB::getDatastore()->getValue('bf_misc_languageoptions');
foreach ($languages as $language) {
$language['direction'] = $language['options'] & $bf_misc_languageoptions['direction'] ? 'ltr' : 'rtl';
$languagecache["{$language['languageid']}"] = $language;
}
build_datastore('languagecache', serialize($languagecache), 1);
return $languagecache;
}
示例7: build_bookmarksite_datastore
/**
* Caches social bookmark site data to the datastore
*/
function build_bookmarksite_datastore()
{
global $vbulletin;
$vbulletin->bookmarksitecache = array();
$bookmarksitelist = $vbulletin->db->query_read("\n\t\tSELECT * \n\t\tFROM " . TABLE_PREFIX . "bookmarksite AS bookmarksite\n\t\tWHERE active = 1\n\t\tORDER BY displayorder ASC, bookmarksiteid ASC\n\t");
if ($bookmarksitelist) {
while ($bookmarksite = $vbulletin->db->fetch_array($bookmarksitelist)) {
$vbulletin->bookmarksitecache["{$bookmarksite['bookmarksiteid']}"] = $bookmarksite;
}
}
// store the cache array into the database
build_datastore('bookmarksitecache', serialize($vbulletin->bookmarksitecache), 1);
}
示例8: build_attachment_permissions
function build_attachment_permissions()
{
$data = array();
$types = vB::getDbAssertor()->assertQuery('vBForum:fetchAllAttachPerms');
foreach ($types as $type) {
if (empty($data["{$type['extension']}"])) {
$contenttypes = unserialize($type['contenttypes']);
$data["{$type['extension']}"] = array('size' => $type['default_size'], 'width' => $type['default_width'], 'height' => $type['default_height'], 'contenttypes' => $contenttypes);
}
if (!empty($type['usergroupid'])) {
$data["{$type['extension']}"]['custom']["{$type['usergroupid']}"] = array('size' => $type['custom_size'], 'width' => $type['custom_width'], 'height' => $type['custom_height'], 'permissions' => $type['custom_permissions']);
}
}
build_datastore('attachmentcache', serialize($data), true);
}
示例9: build_attachment_permissions
function build_attachment_permissions()
{
global $vbulletin;
$data = array();
$types = $vbulletin->db->query_read("\n\t\tSELECT atype.extension, atype.thumbnail, atype.newwindow, aperm.usergroupid,\n\t\t\tatype.height AS default_height, atype.width AS default_width, atype.size AS default_size,\n\t\t\taperm.height AS custom_height, aperm.width AS custom_width, aperm.size AS custom_size,\n\t\t\taperm.attachmentpermissions AS custom_permissions\n\t\tFROM " . TABLE_PREFIX . "attachmenttype AS atype\n\t\tLEFT JOIN " . TABLE_PREFIX . "attachmentpermission AS aperm USING (extension)\n\t\tWHERE enabled = 1\n\t\tORDER BY extension\n\t");
while ($type = $vbulletin->db->fetch_array($types)) {
if (empty($data["{$type['extension']}"])) {
$data["{$type['extension']}"] = array('size' => $type['default_size'], 'width' => $type['default_width'], 'height' => $type['default_height'], 'thumbnail' => $type['thumbnail'], 'newwindow' => $type['newwindow']);
}
if (!empty($type['usergroupid'])) {
$data["{$type['extension']}"]['custom']["{$type['usergroupid']}"] = array('size' => $type['custom_size'], 'width' => $type['custom_width'], 'height' => $type['custom_height'], 'permissions' => $type['custom_permissions']);
}
}
build_datastore('attachmentcache', serialize($data), 1);
}
示例10: build_bookmarksite_datastore
/**
* Caches social bookmark site data to the datastore
*/
function build_bookmarksite_datastore()
{
global $vbulletin;
$assertor = vB::getDbAssertor();
$vbulletin->bookmarksitecache = array();
$bookmarksitelist = $assertor->assertQuery('vBForum:bookmarksite', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'active' => 1), array('field' => array('displayorder', 'bookmarksiteid'), 'direction' => array(vB_dB_Query::SORT_ASC, vB_dB_Query::SORT_ASC)));
//if ($bookmarksitelist)
if ($bookmarksitelist and $bookmarksitelist->valid()) {
//while ($bookmarksite = $vbulletin->db->fetch_array($bookmarksitelist))
foreach ($bookmarksitelist as $bookmarksite) {
$vbulletin->bookmarksitecache["{$bookmarksite['bookmarksiteid']}"] = $bookmarksite;
}
}
// store the cache array into the database
build_datastore('bookmarksitecache', serialize($vbulletin->bookmarksitecache), 1);
}
示例11: build_acpstats_datastore
/**
* Stores a cache of various data for ACP Home Quick Stats into the datastore.
*/
function build_acpstats_datastore()
{
global $vbulletin, $starttime, $mysqlversion;
$data = $vbulletin->db->query_first("SELECT SUM(filesize) AS size FROM " . TABLE_PREFIX . "filedata");
$vbulletin->acpstats['attachsize'] = $data['size'];
$data = $vbulletin->db->query_first("SELECT SUM(filesize) AS size FROM " . TABLE_PREFIX . "customavatar");
$vbulletin->acpstats['avatarsize'] = $data['size'];
$data = $vbulletin->db->query_first("SELECT SUM(filesize) AS size FROM " . TABLE_PREFIX . "customprofilepic");
$vbulletin->acpstats['profilepicsize'] = $data['size'];
$data = $vbulletin->db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user WHERE joindate >= $starttime");
$vbulletin->acpstats['newusers'] = $data['count'];
$data = $vbulletin->db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "user WHERE lastactivity >= $starttime");
$vbulletin->acpstats['userstoday'] = $data['count'];
$data = $vbulletin->db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post WHERE dateline >= $starttime");
$vbulletin->acpstats['newposts'] = $data['count'];
$vbulletin->acpstats['indexsize'] = 0;
$vbulletin->acpstats['datasize'] = 0;
if ($mysqlversion['version'] >= '3.23')
{
$vbulletin->db->hide_errors();
$tables = $vbulletin->db->query_write("SHOW TABLE STATUS");
$errno = $vbulletin->db->errno;
$vbulletin->db->show_errors();
if (!$errno)
{
while ($table = $vbulletin->db->fetch_array($tables))
{
$vbulletin->acpstats['datasize'] += $table['Data_length'];
$vbulletin->acpstats['indexsize'] += $table['Index_length'];
}
}
}
if (!$vbulletin->acpstats['indexsize'])
{
$vbulletin->acpstats['indexsize'] = -1;
}
if (!$vbulletin->acpstats['datasize'])
{
$vbulletin->acpstats['datasize'] = -1;
}
$vbulletin->acpstats['lastupdate'] = TIMENOW;
build_datastore('acpstats', serialize($vbulletin->acpstats), 1);
}
示例12: build_notice_datastore
/**
*/
function build_notice_datastore()
{
global $vbulletin;
$notice_cache = array();
$notices_result = $vbulletin->db->query_read("\n\t\tSELECT noticeid, persistent\n\t\tFROM " . TABLE_PREFIX . "notice\n\t\tWHERE active = 1\n\t\tORDER BY displayorder, title\n\t");
while ($notice = $vbulletin->db->fetch_array($notices_result)) {
$notice_cache["{$notice['noticeid']}"] = array('persistent' => $notice['persistent']);
}
$vbulletin->db->free_result($notices_result);
$criteria_result = $vbulletin->db->query_read("\n\t\tSELECT noticecriteria.*\n\t\tFROM " . TABLE_PREFIX . "noticecriteria AS noticecriteria\n\t\tINNER JOIN " . TABLE_PREFIX . "notice AS notice USING(noticeid)\n\t\tWHERE notice.active = 1\n\t");
while ($criteria = $vbulletin->db->fetch_array($criteria_result)) {
$notice_cache["{$criteria['noticeid']}"]["{$criteria['criteriaid']}"] = array();
foreach (array('condition1', 'condition2', 'condition3') as $condition) {
$notice_cache["{$criteria['noticeid']}"]["{$criteria['criteriaid']}"][] = $criteria["{$condition}"];
}
}
$vbulletin->db->free_result($criteria_result);
build_datastore('noticecache', serialize($notice_cache), 1);
}
示例13: build_profilefield_cache
function build_profilefield_cache()
{
global $vbulletin;
$fields = $vbulletin->db->query_read("\n\t\tSELECT profilefieldid, hidden, required, editable, form\n\t\tFROM " . TABLE_PREFIX . "profilefield AS profilefield\n\t\tWHERE hidden = 1\n\t\t\tOR (required = 3 AND editable IN (1,2) AND form = 0)\n\t");
$hiddenfields = '';
$requiredfields = array();
while ($field = $vbulletin->db->fetch_array($fields)) {
if ($field['hidden'] == 1) {
$hiddenfields .= ", '' AS field{$field['profilefieldid']}";
}
if ($field['form'] == 0 and $field['required'] == 3 and ($field['editable'] == 1 or $field['editable'] == 2)) {
$requiredfields['field' . $field['profilefieldid']] = $field['profilefieldid'];
}
}
$item = array('hidden' => $hiddenfields, 'required' => $requiredfields);
//Add cached value to prevent running the fetchCustomProfileFields query- see VBV-10767
$item['all'] = vB::getDbAssertor()->getRows('vBForum:fetchCustomProfileFields', array('hidden' => array(0, 1)));
build_datastore('profilefield', serialize($item), 1);
}
示例14: build_acpstats_datastore
/**
* Stores a cache of various data for ACP Home Quick Stats into the datastore.
*/
function build_acpstats_datastore()
{
global $vbulletin;
$assertor = vB::getDbAssertor();
$starttime = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$mysqlversion = $assertor->getRow('mysqlVersion');
$data = $assertor->getRow('vBForum:getFiledataFilesizeSum');
$vbulletin->acpstats['attachsize'] = $data['size'];
$data = $assertor->getRow('getCustomAvatarFilesizeSum');
$vbulletin->acpstats['avatarsize'] = $data['size'];
$data = $assertor->getRow('vBForum:getCustomProfilePicFilesizeSum');
$vbulletin->acpstats['profilepicsize'] = $data['size'];
$data = $assertor->getRow('user', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_COUNT, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'joindate', 'value' => $starttime, vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_GTE))));
$vbulletin->acpstats['newusers'] = $data['count'];
$data = $assertor->getRow('user', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_COUNT, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'lastactivity', 'value' => $starttime, vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_GTE))));
$vbulletin->acpstats['userstoday'] = $data['count'];
$data = $assertor->getRow('vBForum:node', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_COUNT, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'created', 'value' => $starttime, vB_dB_Query::OPERATOR_KEY => vB_dB_Query::OPERATOR_GTE))));
$vbulletin->acpstats['newposts'] = $data['count'];
$vbulletin->acpstats['indexsize'] = 0;
$vbulletin->acpstats['datasize'] = 0;
try {
$tables = $assertor->getRows('getTableStatus', array());
} catch (Exception $ex) {
$tables = array();
}
if ($tables and !isset($table['errors'])) {
foreach ($tables as $table) {
$vbulletin->acpstats['datasize'] += $table['Data_length'];
$vbulletin->acpstats['indexsize'] += $table['Index_length'];
}
}
if (!$vbulletin->acpstats['indexsize']) {
$vbulletin->acpstats['indexsize'] = -1;
}
if (!$vbulletin->acpstats['datasize']) {
$vbulletin->acpstats['datasize'] = -1;
}
$vbulletin->acpstats['lastupdate'] = vB::getRequest()->getTimeNow();
build_datastore('acpstats', serialize($vbulletin->acpstats), 1);
}
示例15: build_notice_datastore
function build_notice_datastore()
{
global $vbulletin;
$notice_cache = array();
$notices_result = $vbulletin->db->query_read("
SELECT noticeid, persistent, dismissible
FROM " . TABLE_PREFIX . "notice
WHERE active = 1
ORDER BY displayorder, title
");
while ($notice = $vbulletin->db->fetch_array($notices_result))
{
$notice_cache["$notice[noticeid]"] = array('persistent' => $notice['persistent'], 'dismissible' => $notice['dismissible']);
}
$vbulletin->db->free_result($notices_result);
$criteria_result = $vbulletin->db->query_read("
SELECT noticecriteria.*
FROM " . TABLE_PREFIX . "noticecriteria AS noticecriteria
INNER JOIN " . TABLE_PREFIX . "notice AS notice USING(noticeid)
WHERE notice.active = 1
");
while ($criteria = $vbulletin->db->fetch_array($criteria_result))
{
$notice_cache["$criteria[noticeid]"]["$criteria[criteriaid]"] = array();
foreach (array('condition1', 'condition2', 'condition3') AS $condition)
{
$notice_cache["$criteria[noticeid]"]["$criteria[criteriaid]"][] = $criteria["$condition"];
}
}
$vbulletin->db->free_result($criteria_result);
build_datastore('noticecache', serialize($notice_cache), 1);
}