本文整理汇总了PHP中synccache::buildCache方法的典型用法代码示例。如果您正苦于以下问题:PHP synccache::buildCache方法的具体用法?PHP synccache::buildCache怎么用?PHP synccache::buildCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类synccache
的用法示例。
在下文中一共展示了synccache::buildCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSettings
function getSettings()
{
if (!is_array($this->config) || empty($this->config)) {
if ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) {
$included = (include_once MODX_BASE_PATH . 'assets/cache/siteCache.idx.php');
}
if (!$included || !is_array($this->config) || empty($this->config)) {
include_once MODX_BASE_PATH . "/manager/processors/cache_sync.class.processor.php";
$cache = new synccache();
$cache->setCachepath(MODX_BASE_PATH . "/assets/cache/");
$cache->setReport(false);
$rebuilt = $cache->buildCache($this);
$included = false;
if ($rebuilt && ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'))) {
$included = (include MODX_BASE_PATH . 'assets/cache/siteCache.idx.php');
}
if (!$included) {
$result = $this->db->query('SELECT setting_name, setting_value FROM ' . $this->getFullTableName('system_settings'));
while ($row = $this->db->getRow($result, 'both')) {
$this->config[$row[0]] = $row[1];
}
}
}
// added for backwards compatibility - garry FS#104
$this->config['etomite_charset'] =& $this->config['modx_charset'];
// store base_url and base_path inside config array
$this->config['base_url'] = MODX_BASE_URL;
$this->config['base_path'] = MODX_BASE_PATH;
$this->config['site_url'] = MODX_SITE_URL;
// load user setting if user is logged in
$usrSettings = array();
if ($id = $this->getLoginUserID()) {
$usrType = $this->getLoginUserType();
if (isset($usrType) && $usrType == 'manager') {
$usrType = 'mgr';
}
if ($usrType == 'mgr' && $this->isBackend()) {
// invoke the OnBeforeManagerPageInit event, only if in backend
$this->invokeEvent("OnBeforeManagerPageInit");
}
if (isset($_SESSION[$usrType . 'UsrConfigSet'])) {
$usrSettings =& $_SESSION[$usrType . 'UsrConfigSet'];
} else {
if ($usrType == 'web') {
$query = $this->getFullTableName('web_user_settings') . ' WHERE webuser=\'' . $id . '\'';
} else {
$query = $this->getFullTableName('user_settings') . ' WHERE user=\'' . $id . '\'';
}
$result = $this->db->query('SELECT setting_name, setting_value FROM ' . $query);
while ($row = $this->db->getRow($result, 'both')) {
$usrSettings[$row[0]] = $row[1];
}
if (isset($usrType)) {
$_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
}
// store user settings in session
}
}
if ($this->isFrontend() && ($mgrid = $this->getLoginUserID('mgr'))) {
$musrSettings = array();
if (isset($_SESSION['mgrUsrConfigSet'])) {
$musrSettings =& $_SESSION['mgrUsrConfigSet'];
} else {
$query = $this->getFullTableName('user_settings') . ' WHERE user=\'' . $mgrid . '\'';
if ($result = $this->db->query('SELECT setting_name, setting_value FROM ' . $query)) {
while ($row = $this->db->getRow($result, 'both')) {
$usrSettings[$row[0]] = $row[1];
}
$_SESSION['mgrUsrConfigSet'] = $musrSettings;
// store user settings in session
}
}
if (!empty($musrSettings)) {
$usrSettings = array_merge($musrSettings, $usrSettings);
}
}
$this->config = array_merge($this->config, $usrSettings);
}
}
示例2: getSettings
/**
* Get MODX settings including, but not limited to, the system_settings table
*/
function getSettings()
{
$tbl_system_settings = $this->getFullTableName('system_settings');
$tbl_web_user_settings = $this->getFullTableName('web_user_settings');
$tbl_user_settings = $this->getFullTableName('user_settings');
if (!is_array($this->config) || empty($this->config)) {
if ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) {
$included = (include_once MODX_BASE_PATH . 'assets/cache/siteCache.idx.php');
}
if (!$included || !is_array($this->config) || empty($this->config)) {
include_once MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php';
$cache = new synccache();
$cache->setCachepath(MODX_BASE_PATH . "assets/cache/");
$cache->setReport(false);
$rebuilt = $cache->buildCache($this);
$included = false;
if ($rebuilt && ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'))) {
$included = (include MODX_BASE_PATH . 'assets/cache/siteCache.idx.php');
}
if (!$included) {
$result = $this->db->select('setting_name, setting_value', $tbl_system_settings);
while ($row = $this->db->getRow($result)) {
$this->config[$row['setting_name']] = $row['setting_value'];
}
}
}
// added for backwards compatibility - garry FS#104
$this->config['etomite_charset'] =& $this->config['modx_charset'];
// store base_url and base_path inside config array
$this->config['base_url'] = MODX_BASE_URL;
$this->config['base_path'] = MODX_BASE_PATH;
$this->config['site_url'] = MODX_SITE_URL;
$this->config['valid_hostnames'] = MODX_SITE_HOSTNAMES;
$this->config['site_manager_url'] = MODX_MANAGER_URL;
$this->config['site_manager_path'] = MODX_MANAGER_PATH;
// load user setting if user is logged in
$usrSettings = array();
if ($id = $this->getLoginUserID()) {
$usrType = $this->getLoginUserType();
if (isset($usrType) && $usrType == 'manager') {
$usrType = 'mgr';
}
if ($usrType == 'mgr' && $this->isBackend()) {
// invoke the OnBeforeManagerPageInit event, only if in backend
$this->invokeEvent("OnBeforeManagerPageInit");
}
if (isset($_SESSION[$usrType . 'UsrConfigSet'])) {
$usrSettings =& $_SESSION[$usrType . 'UsrConfigSet'];
} else {
if ($usrType == 'web') {
$from = $tbl_web_user_settings;
$where = "webuser='{$id}'";
} else {
$from = $tbl_user_settings;
$where = "user='{$id}'";
}
$result = $this->db->select('setting_name, setting_value', $from, $where);
while ($row = $this->db->getRow($result)) {
$usrSettings[$row['setting_name']] = $row['setting_value'];
}
if (isset($usrType)) {
$_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
}
// store user settings in session
}
}
if ($this->isFrontend() && ($mgrid = $this->getLoginUserID('mgr'))) {
$musrSettings = array();
if (isset($_SESSION['mgrUsrConfigSet'])) {
$musrSettings =& $_SESSION['mgrUsrConfigSet'];
} else {
if ($result = $this->db->select('setting_name, setting_value', $tbl_user_settings, "user='{$mgrid}'")) {
while ($row = $this->db->getRow($result)) {
$musrSettings[$row['setting_name']] = $row['setting_value'];
}
$_SESSION['mgrUsrConfigSet'] = $musrSettings;
// store user settings in session
}
}
if (!empty($musrSettings)) {
$usrSettings = array_merge($musrSettings, $usrSettings);
}
}
$this->error_reporting = $this->config['error_reporting'];
$this->config = array_merge($this->config, $usrSettings);
$this->config['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $this->config['filemanager_path']);
$this->config['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $this->config['rb_base_dir']);
}
}
示例3: getSiteCache
function getSiteCache()
{
$cpath = MODX_BASE_PATH . 'assets/cache/siteCache.idx.php';
if (is_file($cpath)) {
$included = (include_once $cpath);
}
if (!isset($included) || !$included) {
include_once MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php';
$cache = new synccache();
$cache->setCachepath(MODX_BASE_PATH . 'assets/cache/');
$cache->setReport(false);
$rebuilt = $cache->buildCache($this);
if ($rebuilt && is_file($cpath)) {
include_once $cpath;
}
}
}