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


PHP PMA_Util::cacheSet方法代码示例

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


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

示例1: testClearUserCache

 /**
  * Test clearing user cache
  *
  * @return void
  */
 public function testClearUserCache()
 {
     $GLOBALS['server'] = 'server';
     PMA_Util::cacheSet('is_superuser', 'yes', true);
     $this->assertEquals('yes', $_SESSION['cache']['server_server']['is_superuser']);
     PMA_Util::clearUserCache();
     $this->assertArrayNotHasKey('is_superuser', $_SESSION['cache']['server_server']);
 }
开发者ID:kfjihailong,项目名称:phpMyAdmin,代码行数:13,代码来源:PMA_cache_test.php

示例2: testRename

 /**
  * Test for rename
  *
  * @return void
  */
 public function testRename()
 {
     $table = 'PMA_BookMark';
     $db = 'PMA';
     PMA_Util::cacheSet('lower_case_table_names', false);
     $table = new PMA_Table($table, $db);
     //rename to same name
     $table_new = 'PMA_BookMark';
     $result = $table->rename($table_new);
     $this->assertEquals(true, $result);
     //isValidName
     //space in table name
     $table_new = 'PMA_BookMark ';
     $result = $table->rename($table_new);
     $this->assertEquals(false, $result);
     //empty name
     $table_new = '';
     $result = $table->rename($table_new);
     $this->assertEquals(false, $result);
     //dot in table name
     $table_new = 'PMA_.BookMark';
     $result = $table->rename($table_new);
     $this->assertEquals(false, $result);
     $table_new = 'PMA_BookMark_new';
     $db_new = 'PMA_new';
     $result = $table->rename($table_new, $db_new);
     $this->assertEquals(true, $result);
     //message
     $this->assertEquals("Table PMA_BookMark has been renamed to PMA_BookMark_new.", $table->getLastMessage());
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:35,代码来源:PMA_Table_test.php

示例3: _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

示例4: unset

        $mysql_charsets_available['utf8'] = $mysql_charsets_available['utf8_general_ci'];
        unset($mysql_collations['utf8_general_ci'], $mysql_default_collations['utf8_general_ci'], $mysql_charsets_available['utf8_general_ci']);
    }
    sort($mysql_collations_flat, SORT_STRING);
    foreach ($mysql_collations as $key => $value) {
        sort($mysql_collations[$key], SORT_STRING);
        reset($mysql_collations[$key]);
    }
    unset($key, $value);
    PMA_Util::cacheSet('mysql_charsets', $GLOBALS['mysql_charsets'], true);
    PMA_Util::cacheSet('mysql_charsets_descriptions', $GLOBALS['mysql_charsets_descriptions'], true);
    PMA_Util::cacheSet('mysql_charsets_available', $GLOBALS['mysql_charsets_available'], true);
    PMA_Util::cacheSet('mysql_collations', $GLOBALS['mysql_collations'], true);
    PMA_Util::cacheSet('mysql_default_collations', $GLOBALS['mysql_default_collations'], true);
    PMA_Util::cacheSet('mysql_collations_flat', $GLOBALS['mysql_collations_flat'], true);
    PMA_Util::cacheSet('mysql_collations_available', $GLOBALS['mysql_collations_available'], true);
} else {
    $GLOBALS['mysql_charsets'] = PMA_Util::cacheGet('mysql_charsets', true);
    $GLOBALS['mysql_charsets_descriptions'] = PMA_Util::cacheGet('mysql_charsets_descriptions', true);
    $GLOBALS['mysql_charsets_available'] = PMA_Util::cacheGet('mysql_charsets_available', true);
    $GLOBALS['mysql_collations'] = PMA_Util::cacheGet('mysql_collations', true);
    $GLOBALS['mysql_default_collations'] = PMA_Util::cacheGet('mysql_default_collations', true);
    $GLOBALS['mysql_collations_flat'] = PMA_Util::cacheGet('mysql_collations_flat', true);
    $GLOBALS['mysql_collations_available'] = PMA_Util::cacheGet('mysql_collations_available', true);
}
define('PMA_CSDROPDOWN_COLLATION', 0);
define('PMA_CSDROPDOWN_CHARSET', 1);
/**
 * shared functions for mysql charsets
 */
require_once './libraries/mysql_charsets.lib.php';
开发者ID:AtomPy,项目名称:AtomPySite,代码行数:31,代码来源:mysql_charsets.inc.php

示例5: 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

示例6: PMA_analyseShowGrant


//.........这里部分代码省略.........
 * 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
        }
        // end if
    }
    // end while
    $GLOBALS['dbi']->freeResult($rs_usr);
    // must also cacheUnset() them in
    // libraries/plugins/auth/AuthenticationCookie.class.php
    PMA_Util::cacheSet('is_create_db_priv', $GLOBALS['is_create_db_priv']);
    PMA_Util::cacheSet('is_reload_priv', $GLOBALS['is_reload_priv']);
    PMA_Util::cacheSet('db_to_create', $GLOBALS['db_to_create']);
    PMA_Util::cacheSet('dbs_where_create_table_allowed', $GLOBALS['dbs_where_create_table_allowed']);
    PMA_Util::cacheSet('dbs_to_test', $GLOBALS['dbs_to_test']);
}
开发者ID:nervo,项目名称:phpmyadmin,代码行数:101,代码来源:check_user_privileges.lib.php

示例7: 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


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