当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_Util::cacheExists方法代码示例

本文整理汇总了PHP中PMA_Util::cacheExists方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::cacheExists方法的具体用法?PHP PMA_Util::cacheExists怎么用?PHP PMA_Util::cacheExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PMA_Util的用法示例。


在下文中一共展示了PMA_Util::cacheExists方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCacheExists

 /**
  * Test if cached data is available after set
  *
  * @return void
  */
 public function testCacheExists()
 {
     $GLOBALS['server'] = 'server';
     PMA_Util::cacheSet('test_data', 5, true);
     PMA_Util::cacheSet('test_data_2', 5, true);
     $this->assertTrue(PMA_Util::cacheExists('test_data', true));
     $this->assertTrue(PMA_Util::cacheExists('test_data_2', 'server'));
     $this->assertFalse(PMA_Util::cacheExists('fake_data_2', true));
 }
开发者ID:kfjihailong,项目名称:phpMyAdmin,代码行数:14,代码来源:PMA_cache_test.php

示例2: _getServerTabs

 /**
  * Returns the server tabs as an array
  *
  * @return array Data for generating server tabs
  */
 private function _getServerTabs()
 {
     $is_superuser = $GLOBALS['dbi']->isSuperuser();
     $isCreateOrGrantUser = $GLOBALS['dbi']->isUserType('grant') || $GLOBALS['dbi']->isUserType('create');
     $binary_logs = null;
     $notDrizzle = !defined('PMA_DRIZZLE') || defined('PMA_DRIZZLE') && !PMA_DRIZZLE;
     if ($notDrizzle) {
         if (PMA_Util::cacheExists('binary_logs')) {
             $binary_logs = PMA_Util::cacheGet('binary_logs');
         } else {
             $binary_logs = $GLOBALS['dbi']->fetchResult('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DatabaseInterface::QUERY_STORE);
             PMA_Util::cacheSet('binary_logs', $binary_logs);
         }
     }
     $tabs = array();
     $tabs['databases']['icon'] = 's_db.png';
     $tabs['databases']['link'] = 'server_databases.php';
     $tabs['databases']['text'] = __('Databases');
     $tabs['sql']['icon'] = 'b_sql.png';
     $tabs['sql']['link'] = 'server_sql.php';
     $tabs['sql']['text'] = __('SQL');
     $tabs['status']['icon'] = 's_status.png';
     $tabs['status']['link'] = 'server_status.php';
     $tabs['status']['text'] = __('Status');
     $tabs['status']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']), array('server_status.php', 'server_status_advisor.php', 'server_status_monitor.php', 'server_status_queries.php', 'server_status_variables.php', 'server_status_processes.php'));
     if (($is_superuser || $isCreateOrGrantUser) && !PMA_DRIZZLE) {
         $tabs['rights']['icon'] = 's_rights.png';
         $tabs['rights']['link'] = 'server_privileges.php';
         $tabs['rights']['text'] = __('Users');
         $tabs['rights']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']), array('server_privileges.php', 'server_user_groups.php'));
         $tabs['rights']['args']['viewing_mode'] = 'server';
     }
     $tabs['export']['icon'] = 'b_export.png';
     $tabs['export']['link'] = 'server_export.php';
     $tabs['export']['text'] = __('Export');
     $tabs['import']['icon'] = 'b_import.png';
     $tabs['import']['link'] = 'server_import.php';
     $tabs['import']['text'] = __('Import');
     $tabs['settings']['icon'] = 'b_tblops.png';
     $tabs['settings']['link'] = 'prefs_manage.php';
     $tabs['settings']['text'] = __('Settings');
     $tabs['settings']['active'] = in_array(basename($GLOBALS['PMA_PHP_SELF']), array('prefs_forms.php', 'prefs_manage.php'));
     if (!empty($binary_logs)) {
         $tabs['binlog']['icon'] = 's_tbl.png';
         $tabs['binlog']['link'] = 'server_binlog.php';
         $tabs['binlog']['text'] = __('Binary log');
     }
     if ($is_superuser && !PMA_DRIZZLE) {
         $tabs['replication']['icon'] = 's_replication.png';
         $tabs['replication']['link'] = 'server_replication.php';
         $tabs['replication']['text'] = __('Replication');
     }
     $tabs['vars']['icon'] = 's_vars.png';
     $tabs['vars']['link'] = 'server_variables.php';
     $tabs['vars']['text'] = __('Variables');
     $tabs['charset']['icon'] = 's_asci.png';
     $tabs['charset']['link'] = 'server_collations.php';
     $tabs['charset']['text'] = __('Charsets');
     if (defined('PMA_DRIZZLE') && PMA_DRIZZLE) {
         $tabs['plugins']['icon'] = 'b_engine.png';
         $tabs['plugins']['link'] = 'server_plugins.php';
         $tabs['plugins']['text'] = __('Plugins');
     } else {
         $tabs['engine']['icon'] = 'b_engine.png';
         $tabs['engine']['link'] = 'server_engines.php';
         $tabs['engine']['text'] = __('Engines');
     }
     return $tabs;
 }
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:74,代码来源:Menu.class.php

示例3: array

<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * MySQL charsets listings
 *
 * @package PhpMyAdmin
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 *
 */
if (!PMA_Util::cacheExists('mysql_charsets', true)) {
    global $mysql_charsets, $mysql_charsets_descriptions, $mysql_charsets_available, $mysql_collations, $mysql_collations_available, $mysql_default_collations, $mysql_collations_flat;
    $sql = PMA_DRIZZLE ? 'SELECT * FROM data_dictionary.CHARACTER_SETS' : 'SELECT * FROM information_schema.CHARACTER_SETS';
    $res = $GLOBALS['dbi']->query($sql);
    $mysql_charsets = array();
    while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
        $mysql_charsets[] = $row['CHARACTER_SET_NAME'];
        // never used
        //$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen'];
        $mysql_charsets_descriptions[$row['CHARACTER_SET_NAME']] = $row['DESCRIPTION'];
    }
    $GLOBALS['dbi']->freeResult($res);
    sort($mysql_charsets, SORT_STRING);
    $mysql_collations = array_flip($mysql_charsets);
    $mysql_default_collations = $mysql_collations_flat = $mysql_charsets_available = $mysql_collations_available = array();
    $sql = PMA_DRIZZLE ? 'SELECT * FROM data_dictionary.COLLATIONS' : 'SELECT * FROM information_schema.COLLATIONS';
    $res = $GLOBALS['dbi']->query($sql);
开发者ID:AtomPy,项目名称:AtomPySite,代码行数:31,代码来源:mysql_charsets.inc.php

示例4: isSuperuser

 /**
  * returns true (int > 0) if current user is superuser
  * otherwise 0
  *
  * @return bool Whether use is a superuser
  */
 public function isSuperuser()
 {
     if (PMA_Util::cacheExists('is_superuser', true)) {
         return PMA_Util::cacheGet('is_superuser', true);
     }
     // when connection failed we don't have a $userlink
     if (isset($GLOBALS['userlink'])) {
         if (PMA_DRIZZLE) {
             // Drizzle has no authorization by default, so when no plugin is
             // enabled everyone is a superuser
             // Known authorization libraries: regex_policy, simple_user_policy
             // Plugins limit object visibility (dbs, tables, processes), we can
             // safely assume we always deal with superuser
             $result = true;
         } else {
             // check access to mysql.user table
             $result = (bool) $GLOBALS['dbi']->tryQuery('SELECT COUNT(*) FROM mysql.user', $GLOBALS['userlink'], self::QUERY_STORE);
         }
         PMA_Util::cacheSet('is_superuser', $result, true);
     } else {
         PMA_Util::cacheSet('is_superuser', false, true);
     }
     return PMA_Util::cacheGet('is_superuser', true);
 }
开发者ID:lcylp,项目名称:wamp,代码行数:30,代码来源:DatabaseInterface.class.php

示例5: PMA_analyseShowGrant

/**
 * sets privilege information extracted from SHOW GRANTS result
 *
 * Detection for some CREATE privilege.
 *
 * Since MySQL 4.1.2, we can easily detect current user's grants using $userlink
 * (no control user needed) and we don't have to try any other method for
 * detection
 *
 * @todo fix to get really all privileges, not only explicitly defined for this user
 * from MySQL manual: (http://dev.mysql.com/doc/refman/5.0/en/show-grants.html)
 * SHOW GRANTS displays only the privileges granted explicitly to the named
 * account. Other privileges might be available to the account, but they are not
 * displayed. For example, if an anonymous account exists, the named account
 * might be able to use its privileges, but SHOW GRANTS will not display them.
 *
 * @return void
 */
function PMA_analyseShowGrant()
{
    if (PMA_Util::cacheExists('is_create_db_priv')) {
        $GLOBALS['is_create_db_priv'] = PMA_Util::cacheGet('is_create_db_priv');
        $GLOBALS['is_reload_priv'] = PMA_Util::cacheGet('is_reload_priv');
        $GLOBALS['db_to_create'] = PMA_Util::cacheGet('db_to_create');
        $GLOBALS['dbs_where_create_table_allowed'] = PMA_Util::cacheGet('dbs_where_create_table_allowed');
        $GLOBALS['dbs_to_test'] = PMA_Util::cacheGet('dbs_to_test');
        return;
    }
    // defaults
    $GLOBALS['is_create_db_priv'] = false;
    $GLOBALS['is_reload_priv'] = false;
    $GLOBALS['db_to_create'] = '';
    $GLOBALS['dbs_where_create_table_allowed'] = array();
    $GLOBALS['dbs_to_test'] = $GLOBALS['dbi']->getSystemSchemas();
    $rs_usr = $GLOBALS['dbi']->tryQuery('SHOW GRANTS');
    if (!$rs_usr) {
        return;
    }
    $re0 = '(^|(\\\\\\\\)+|[^\\\\])';
    // non-escaped wildcards
    $re1 = '(^|[^\\\\])(\\\\)+';
    // escaped wildcards
    while ($row = $GLOBALS['dbi']->fetchRow($rs_usr)) {
        // extract db from GRANT ... ON *.* or GRANT ... ON db.*
        $db_name_offset = mb_strpos($row[0], ' ON ') + 4;
        $show_grants_dbname = mb_substr($row[0], $db_name_offset, mb_strpos($row[0], '.', $db_name_offset) - $db_name_offset);
        $show_grants_dbname = PMA_Util::unQuote($show_grants_dbname, '`');
        $show_grants_str = mb_substr($row[0], 6, mb_strpos($row[0], ' ON ') - 6);
        if ($show_grants_dbname == '*') {
            if ($show_grants_str != 'USAGE') {
                $GLOBALS['dbs_to_test'] = false;
            }
        } elseif ($GLOBALS['dbs_to_test'] !== false) {
            $GLOBALS['dbs_to_test'][] = $show_grants_dbname;
        }
        if ($show_grants_str == 'RELOAD') {
            $GLOBALS['is_reload_priv'] = true;
        }
        /**
         * @todo if we find CREATE VIEW but not CREATE, do not offer
         * the create database dialog box
         */
        if ($show_grants_str == 'ALL' || $show_grants_str == 'ALL PRIVILEGES' || $show_grants_str == 'CREATE' || strpos($show_grants_str, 'CREATE,') !== false) {
            if ($show_grants_dbname == '*') {
                // a global CREATE privilege
                $GLOBALS['is_create_db_priv'] = true;
                $GLOBALS['is_reload_priv'] = true;
                $GLOBALS['db_to_create'] = '';
                $GLOBALS['dbs_where_create_table_allowed'][] = '*';
                // @todo we should not break here, cause GRANT ALL *.*
                // could be revoked by a later rule like GRANT SELECT ON db.*
                break;
            } else {
                // this array may contain wildcards
                $GLOBALS['dbs_where_create_table_allowed'][] = $show_grants_dbname;
                $dbname_to_test = PMA_Util::backquote($show_grants_dbname);
                if ($GLOBALS['is_create_db_priv']) {
                    // no need for any more tests if we already know this
                    continue;
                }
                // does this db exist?
                if (preg_match('/' . $re0 . '%|_/', $show_grants_dbname) && !preg_match('/\\\\%|\\\\_/', $show_grants_dbname) || !$GLOBALS['dbi']->tryQuery('USE ' . preg_replace('/' . $re1 . '(%|_)/', '\\1\\3', $dbname_to_test)) && mb_substr($GLOBALS['dbi']->getError(), 1, 4) != 1044) {
                    /**
                     * Do not handle the underscore wildcard
                     * (this case must be rare anyway)
                     */
                    $GLOBALS['db_to_create'] = preg_replace('/' . $re0 . '%/', '\\1', $show_grants_dbname);
                    $GLOBALS['db_to_create'] = preg_replace('/' . $re1 . '(%|_)/', '\\1\\3', $GLOBALS['db_to_create']);
                    $GLOBALS['is_create_db_priv'] = true;
                    /**
                     * @todo collect $GLOBALS['db_to_create'] into an array,
                     * to display a drop-down in the "Create database" dialog
                     */
                    // we don't break, we want all possible databases
                    //break;
                }
                // end if
            }
            // end elseif
        }
//.........这里部分代码省略.........
开发者ID:nervo,项目名称:phpmyadmin,代码行数:101,代码来源:check_user_privileges.lib.php

示例6: isAmazonRds

 /**
  * Checks if this database server is running on Amazon RDS.
  *
  * @return boolean
  */
 public function isAmazonRds()
 {
     if (PMA_Util::cacheExists('is_amazon_rds')) {
         return PMA_Util::cacheGet('is_amazon_rds');
     }
     $sql = 'SELECT @@basedir';
     $result = $this->fetchResult($sql);
     $rds = $result[0] == '/rdsdbbin/mysql/';
     PMA_Util::cacheSet('is_amazon_rds', $rds);
     return $rds;
 }
开发者ID:FuhrerMalkovich,项目名称:Blogpost,代码行数:16,代码来源:DatabaseInterface.class.php

示例7: array

<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * MySQL charsets listings
 *
 * @package PhpMyAdmin
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 *
 */
if (!PMA_Util::cacheExists('mysql_charsets', null)) {
    global $mysql_charsets, $mysql_charsets_descriptions, $mysql_charsets_available, $mysql_collations, $mysql_collations_available, $mysql_default_collations, $mysql_collations_flat;
    $sql = PMA_DRIZZLE ? 'SELECT * FROM data_dictionary.CHARACTER_SETS' : 'SELECT * FROM information_schema.CHARACTER_SETS';
    $res = $GLOBALS['dbi']->query($sql);
    $mysql_charsets = array();
    while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
        $mysql_charsets[] = $row['CHARACTER_SET_NAME'];
        // never used
        //$mysql_charsets_maxlen[$row['Charset']] = $row['Maxlen'];
        $mysql_charsets_descriptions[$row['CHARACTER_SET_NAME']] = $row['DESCRIPTION'];
    }
    $GLOBALS['dbi']->freeResult($res);
    sort($mysql_charsets, SORT_STRING);
    $mysql_collations = array_flip($mysql_charsets);
    $mysql_default_collations = $mysql_collations_flat = $mysql_charsets_available = $mysql_collations_available = array();
    $sql = PMA_DRIZZLE ? 'SELECT * FROM data_dictionary.COLLATIONS' : 'SELECT * FROM information_schema.COLLATIONS';
    $res = $GLOBALS['dbi']->query($sql);
开发者ID:minggLu,项目名称:openemr,代码行数:31,代码来源:mysql_charsets.inc.php


注:本文中的PMA_Util::cacheExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。