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


PHP Util::cacheGet方法代码示例

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


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

示例1: isAmazonRds

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

示例2: 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 = 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 Table($new_name, $new_db);
     if ($this->getFullName() === $new_table->getFullName()) {
         return true;
     }
     if (!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 ' . Util::backquote($this->getDbName()) . '.' . 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:ryanfmurphy,项目名称:phpmyadmin,代码行数:69,代码来源:Table.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');
     if (Util::cacheExists('binary_logs')) {
         $binary_logs = Util::cacheGet('binary_logs');
     } else {
         $binary_logs = $GLOBALS['dbi']->fetchResult('SHOW MASTER LOGS', 'Log_name', null, null, DatabaseInterface::QUERY_STORE);
         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) {
         $tabs['rights']['icon'] = 's_rights.png';
         $tabs['rights']['link'] = 'server_privileges.php';
         $tabs['rights']['text'] = __('User accounts');
         $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) {
         $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');
     $tabs['engine']['icon'] = 'b_engine.png';
     $tabs['engine']['link'] = 'server_engines.php';
     $tabs['engine']['text'] = __('Engines');
     $tabs['plugins']['icon'] = 'b_plugin.png';
     $tabs['plugins']['link'] = 'server_plugins.php';
     $tabs['plugins']['text'] = __('Plugins');
     return $tabs;
 }
开发者ID:phpmyadmin,项目名称:phpmyadmin,代码行数:67,代码来源:Menu.php

示例4: getMySQLVersion

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

示例5: 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 = 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:itgsod-philip-skalander,项目名称:phpmyadmin,代码行数:26,代码来源:StorageEngine.php


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