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


PHP PMA_Util::cacheGet方法代码示例

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


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

示例1: testCacheGet

 /**
  * Test if PMA_Util::cacheGet does not return data for non existing cache entries
  *
  * @return void
  */
 public function testCacheGet()
 {
     $GLOBALS['server'] = 'server';
     PMA_Util::cacheSet('test_data', 5, true);
     PMA_Util::cacheSet('test_data_2', 5, true);
     $this->assertNotNull(PMA_Util::cacheGet('test_data', true));
     $this->assertNotNull(PMA_Util::cacheGet('test_data_2', 'server'));
     $this->assertNull(PMA_Util::cacheGet('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: 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

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

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

示例7: rename

 /**
  * renames table
  *
  * @param string $new_name new table name
  * @param string $new_db   new database name
  *
  * @return bool success
  */
 function rename($new_name, $new_db = null)
 {
     $lowerCaseTableNames = PMA_Util::cacheGet('lower_case_table_names', function () {
         return $GLOBALS['dbi']->fetchValue("SELECT @@lower_case_table_names");
     });
     if ($lowerCaseTableNames) {
         $new_name = strtolower($new_name);
     }
     if (null !== $new_db && $new_db !== $this->getDbName()) {
         // Ensure the target is valid
         if (!$GLOBALS['pma']->databases->exists($new_db)) {
             $this->errors[] = __('Invalid database:') . ' ' . $new_db;
             return false;
         }
     } else {
         $new_db = $this->getDbName();
     }
     $new_table = new PMA_Table($new_name, $new_db);
     if ($this->getFullName() === $new_table->getFullName()) {
         return true;
     }
     if (!PMA_Table::isValidName($new_name)) {
         $this->errors[] = __('Invalid table name:') . ' ' . $new_table->getFullName();
         return false;
     }
     // If the table is moved to a different database drop its triggers first
     $triggers = $this->_dbi->getTriggers($this->getDbName(), $this->getName(), '');
     $handle_triggers = $this->getDbName() != $new_db && $triggers;
     if ($handle_triggers) {
         foreach ($triggers as $trigger) {
             $sql = 'DROP TRIGGER IF EXISTS ' . PMA_Util::backquote($this->getDbName()) . '.' . PMA_Util::backquote($trigger['name']) . ';';
             $this->_dbi->query($sql);
         }
     }
     /*
      * tested also for a view, in MySQL 5.0.92, 5.1.55 and 5.5.13
      */
     $GLOBALS['sql_query'] = '
         RENAME TABLE ' . $this->getFullName(true) . '
               TO ' . $new_table->getFullName(true) . ';';
     // I don't think a specific error message for views is necessary
     if (!$this->_dbi->query($GLOBALS['sql_query'])) {
         // Restore triggers in the old database
         if ($handle_triggers) {
             $this->_dbi->selectDb($this->getDbName());
             foreach ($triggers as $trigger) {
                 $this->_dbi->query($trigger['create']);
             }
         }
         $this->errors[] = sprintf(__('Failed to rename table %1$s to %2$s!'), $this->getFullName(), $new_table->getFullName());
         return false;
     }
     $old_name = $this->getName();
     $old_db = $this->getDbName();
     $this->_name = $new_name;
     $this->_db_name = $new_db;
     // Renable table in configuration storage
     PMA_REL_renameTable($old_db, $new_db, $old_name, $new_name);
     $this->messages[] = sprintf(__('Table %1$s has been renamed to %2$s.'), htmlspecialchars($old_name), htmlspecialchars($new_name));
     return true;
 }
开发者ID:TheBlackBloodyUnicorn,项目名称:pico_wanderblog,代码行数:69,代码来源:Table.class.php

示例8: getMySQLVersion

 /**
  * Returns the MySQL version
  *
  * @return string MySQL version
  */
 protected function getMySQLVersion()
 {
     return PMA_Util::cacheGet('PMA_MYSQL_STR_VERSION');
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:9,代码来源:VersionInformation.php

示例9: getStorageEngines

 /**
  * Returns array of storage engines
  *
  * @static
  * @staticvar array $storage_engines storage engines
  * @access public
  * @return string[] array of storage engines
  */
 public static function getStorageEngines()
 {
     static $storage_engines = null;
     if (null == $storage_engines) {
         if (PMA_DRIZZLE) {
             $sql = "SELECT\n                        p.plugin_name            AS Engine,\n                        (CASE\n                            WHEN p.plugin_name = @@storage_engine THEN 'DEFAULT'\n                            WHEN p.is_active THEN 'YES'\n                            ELSE 'DISABLED' END) AS Support,\n                        m.module_description     AS Comment\n                    FROM data_dictionary.plugins p\n                        JOIN data_dictionary.modules m USING (module_name)\n                    WHERE p.plugin_type = 'StorageEngine'\n                        AND p.plugin_name NOT IN ('FunctionEngine', 'schema')";
             $storage_engines = $GLOBALS['dbi']->fetchResult($sql, 'Engine');
         } else {
             $storage_engines = $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
             if (PMA_MYSQL_INT_VERSION >= 50708) {
                 $disabled = PMA_Util::cacheGet('disabled_storage_engines', function () {
                     return $GLOBALS['dbi']->fetchValue('SELECT @@disabled_storage_engines');
                 });
                 foreach (explode(",", $disabled) as $engine) {
                     if (isset($storage_engines[$engine])) {
                         $storage_engines[$engine]['Support'] = 'DISABLED';
                     }
                 }
             }
         }
     }
     return $storage_engines;
 }
开发者ID:arshad2101,项目名称:phpmyadmin,代码行数:31,代码来源:StorageEngine.class.php

示例10: getStorageEngines

 /**
  * Returns array of storage engines
  *
  * @static
  * @staticvar array $storage_engines storage engines
  * @access public
  * @return string[] array of storage engines
  */
 public static function getStorageEngines()
 {
     static $storage_engines = null;
     if (null == $storage_engines) {
         $storage_engines = $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
         if (PMA_MYSQL_INT_VERSION >= 50708) {
             $disabled = PMA_Util::cacheGet('disabled_storage_engines', function () {
                 return $GLOBALS['dbi']->fetchValue('SELECT @@disabled_storage_engines');
             });
             foreach (explode(",", $disabled) as $engine) {
                 if (isset($storage_engines[$engine])) {
                     $storage_engines[$engine]['Support'] = 'DISABLED';
                 }
             }
         }
     }
     return $storage_engines;
 }
开发者ID:nervo,项目名称:phpmyadmin,代码行数:26,代码来源:StorageEngine.class.php

示例11: evaluateVersionCondition

 /**
  * Checks whether PHP or MySQL version meets supplied version condition
  *
  * @param string $type      PHP or MySQL
  * @param string $condition version condition
  *
  * @return boolean whether the condition is met
  */
 public static function evaluateVersionCondition($type, $condition)
 {
     $operator = null;
     $operators = array("<=", ">=", "!=", "<>", "<", ">", "=");
     // preserve order
     foreach ($operators as $oneOperator) {
         if (strpos($condition, $oneOperator) === 0) {
             $operator = $oneOperator;
             $version = substr($condition, strlen($oneOperator));
             break;
         }
     }
     $myVersion = null;
     if ($type == 'PHP') {
         $myVersion = PHP_VERSION;
     } elseif ($type == 'MySQL') {
         $myVersion = PMA_Util::cacheGet('PMA_MYSQL_STR_VERSION', true);
     }
     if ($myVersion != null && $operator != null) {
         return version_compare($myVersion, $version, $operator);
     }
     return false;
 }
开发者ID:yxwzaxns,项目名称:sakura,代码行数:31,代码来源:Util.class.php


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