當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_DAO::requireValidDBName方法代碼示例

本文整理匯總了PHP中CRM_Core_DAO::requireValidDBName方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_DAO::requireValidDBName方法的具體用法?PHP CRM_Core_DAO::requireValidDBName怎麽用?PHP CRM_Core_DAO::requireValidDBName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_DAO的用法示例。


在下文中一共展示了CRM_Core_DAO::requireValidDBName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testRequireValidDBName

 /**
  * requireValidDBName() method (to check valid database name)
  */
 public function testRequireValidDBName()
 {
     $databases = array('testdb' => TRUE, 'test_db' => TRUE, 'TEST_db' => TRUE, '123testdb' => TRUE, 'test12db34' => TRUE, 'test_12_db34' => TRUE, 'test-db' => FALSE, 'test;db' => FALSE, 'test*&db' => FALSE, 'testdb;Delete test' => FALSE, '123456' => FALSE, 'test#$%^&*' => FALSE);
     $testDetails = array();
     foreach ($databases as $database => $val) {
         $this->assertEquals(CRM_Core_DAO::requireValidDBName($database), $val);
     }
 }
開發者ID:saurabhbatra96,項目名稱:civicrm-core,代碼行數:11,代碼來源:DAOTest.php

示例2: checkdatabase

 /**
  * Just check that the database configuration is okay.
  * @param $databaseConfig
  * @param $dbName
  */
 public function checkdatabase($databaseConfig, $dbName)
 {
     if ($this->requireFunction('mysqli_connect', array(ts("PHP Configuration"), ts("MySQL support"), ts("MySQL support not included in PHP.")))) {
         $this->requireMySQLServer($databaseConfig['server'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Does the server exist?"), ts("Can't find the a MySQL server on '%1'.", array(1 => $databaseConfig['server'])), $databaseConfig['server']));
         if ($this->requireMysqlConnection($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Are the access credentials correct?"), ts("That username/password doesn't work")))) {
             @$this->requireMySQLVersion("5.1", array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("MySQL version at least %1", array(1 => '5.1')), ts("MySQL version %1 or higher is required, you are running MySQL %2.", array(1 => '5.1', 2 => mysqli_get_server_info($this->conn))), ts("MySQL %1", array(1 => mysqli_get_server_info($this->conn)))));
             $this->requireMySQLAutoIncrementIncrementOne($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Is auto_increment_increment set to 1"), ts("An auto_increment_increment value greater than 1 is not currently supported. Please see issue CRM-7923 for further details and potential workaround.")));
             $testDetails = array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Is the provided database name valid?"), ts("The database name provided is not valid. Please use only 0-9, a-z, A-Z and _ as characters in the name."));
             if (!CRM_Core_DAO::requireValidDBName($databaseConfig['database'])) {
                 $this->error($testDetails);
                 return FALSE;
             } else {
                 $this->testing($testDetails);
             }
             $this->requireMySQLThreadStack($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], self::MINIMUM_THREAD_STACK, array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Does MySQL thread_stack meet minimum (%1k)", array(1 => self::MINIMUM_THREAD_STACK)), ""));
         }
         $onlyRequire = $dbName == 'Drupal' || $dbName == 'Backdrop' ? TRUE : FALSE;
         $this->requireDatabaseOrCreatePermissions($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Can I access/create the database?"), ts("I can't create new databases and the database '%1' doesn't exist.", array(1 => $databaseConfig['database']))), $onlyRequire);
         if ($dbName != 'Drupal' && $dbName != 'Backdrop') {
             $this->requireMySQLInnoDB($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts("Can I access/create InnoDB tables in the database?"), ts("Unable to create InnoDB tables. MySQL InnoDB support is required for CiviCRM but is either not available or not enabled in this MySQL database server.")));
             $this->requireMySQLTempTables($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts('Can I create temporary tables in the database?'), ts('Unable to create temporary tables. This MySQL user is missing the CREATE TEMPORARY TABLES privilege.')));
             $this->requireMySQLLockTables($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts('Can I create lock tables in the database?'), ts('Unable to lock tables. This MySQL user is missing the LOCK TABLES privilege.')));
             $this->requireMySQLTrigger($databaseConfig['server'], $databaseConfig['username'], $databaseConfig['password'], $databaseConfig['database'], array(ts("MySQL %1 Configuration", array(1 => $dbName)), ts('Can I create triggers in the database?'), ts('Unable to create triggers. This MySQL user is missing the CREATE TRIGGERS  privilege.')));
         }
     }
 }
開發者ID:kcristiano,項目名稱:civicrm-core,代碼行數:31,代碼來源:index.php


注:本文中的CRM_Core_DAO::requireValidDBName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。