本文整理汇总了PHP中Zend_Db_Adapter_Abstract::getServerVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Adapter_Abstract::getServerVersion方法的具体用法?PHP Zend_Db_Adapter_Abstract::getServerVersion怎么用?PHP Zend_Db_Adapter_Abstract::getServerVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Adapter_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Adapter_Abstract::getServerVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentSchemaVersion
public function getCurrentSchemaVersion()
{
if (empty($this->_module)) {
throw new FFR_Exception('Module was empty. A module must be set.');
}
$cache = Zend_Controller_Action_HelperBroker::getStaticHelper('Cache')->getManager()->getCache('database');
if (!($version = $cache->load($this->_module . 'Version'))) {
// Ensure we have valid connection to the database
if (!$this->_db->isConnected()) {
$this->_db->getServerVersion();
}
$sql = 'SELECT schema_version FROM ' . $this->_schemaVersionTable . ' WHERE schema_module = "' . $this->_module . '"';
$version = null;
try {
$version = $this->_db->fetchOne($sql);
} catch (Zend_Db_Exception $e) {
// exception means that the schema version table doesn't exist, so create it
$createSql = "CREATE TABLE {$this->_schemaVersionTable} (\n schema_id INT NOT NULL AUTO_INCREMENT,\n schema_version INT NOT NULL,\n schema_module VARCHAR(50),\n PRIMARY KEY (schema_id)\n )";
$this->_db->query($createSql);
}
// There isn't a version record so lets make one
if ($version === null || $version === false) {
$insertSql = "INSERT {$this->_schemaVersionTable} SET schema_version = 0," . ' schema_module = "' . $this->_module . '"';
$this->_db->query($insertSql);
$version = $this->_db->fetchOne($sql);
}
$cache->save($version, $this->_module . 'Version', array('schemaVersion'));
}
return $version;
}
示例2: getCurrentSchemaVersion
function getCurrentSchemaVersion()
{
// Ensure we have valid connection to the database
if (!$this->_db->isConnected()) {
$this->_db->getServerVersion();
}
$schemaVersionTableName = $this->getPrefixedSchemaVersionTableName();
$sql = "SELECT version FROM " . $schemaVersionTableName;
try {
$version = $this->_db->fetchOne($sql);
} catch (Exception $e) {
// exception means that the schema version table doesn't exist, so create it
$createSql = "CREATE TABLE {$schemaVersionTableName} ( \n version bigint NOT NULL,\n PRIMARY KEY (version)\n )";
$this->_db->query($createSql);
$insertSql = "INSERT INTO {$schemaVersionTableName} (version) VALUES (0)";
$this->_db->query($insertSql);
$version = $this->_db->fetchOne($sql);
}
return $version;
}
示例3: getServerVersion
/**
* Retrieve server version in PHP style
*
* @return string
*/
public function getServerVersion()
{
return $this->_adapter->getServerVersion();
}
示例4: getRequirementErrors
public function getRequirementErrors(Zend_Db_Adapter_Abstract $db = null)
{
$errors = array();
$phpVersion = phpversion();
if (version_compare($phpVersion, '5.2.11', '<')) {
$errors['phpVersion'] = new XenForo_Phrase('php_version_x_does_not_meet_requirements', array('version' => $phpVersion));
}
$safeModeIni = @ini_get('safe_mode');
if (is_bool($safeModeIni) || intval($safeModeIni)) {
$isSafeMode = (bool) $safeModeIni;
} else {
$isSafeMode = in_array(strtolower($safeModeIni), array('on', 'yes', 'true'));
}
if ($isSafeMode) {
$errors['safe_mode'] = new XenForo_Phrase('php_must_not_be_in_safe_mode');
}
if (!function_exists('mysqli_connect')) {
$errors['mysqlPhp'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'MySQLi'));
}
if (!function_exists('gd_info')) {
$errors['gd'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'GD'));
} else {
if (!function_exists('imagecreatefromjpeg')) {
$errors['gdJpeg'] = new XenForo_Phrase('gd_jpeg_support_missing');
}
}
if (!function_exists('iconv')) {
$errors['iconv'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'Iconv'));
}
if (!function_exists('ctype_alnum')) {
$errors['ctype'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'Ctype'));
}
if (!function_exists('preg_replace')) {
$errors['pcre'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'PCRE'));
} else {
try {
preg_match('/./u', 'x');
} catch (Exception $e) {
$errors['pcre'] = new XenForo_Phrase('pcre_unicode_support_missing');
}
}
if (!function_exists('spl_autoload_register')) {
$errors['spl'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'SPL'));
}
if (!function_exists('json_encode')) {
$errors['json'] = new XenForo_Phrase('required_php_extension_x_not_found', array('extension' => 'JSON'));
}
if (!class_exists('DOMDocument') || !class_exists('SimpleXMLElement')) {
$errors['xml'] = new XenForo_Phrase('required_php_xml_extensions_not_found');
}
if ($db) {
$mySqlVersion = $db->getServerVersion();
if ($mySqlVersion && intval($mySqlVersion) < 5) {
$errors['mysqlVersion'] = new XenForo_Phrase('mysql_version_x_does_not_meet_requirements', array('version' => $mySqlVersion));
}
}
$dataDir = XenForo_Helper_File::getExternalDataPath();
if (!is_dir($dataDir) || !is_writable($dataDir)) {
$errors['dataDir'] = new XenForo_Phrase('directory_x_must_be_writable', array('directory' => $dataDir));
} else {
foreach (scandir($dataDir) as $file) {
if ($file[0] == '.') {
continue;
}
$fullPath = "{$dataDir}/{$file}";
if (is_dir($fullPath) && !is_writable($fullPath)) {
$errors['dataDir'] = new XenForo_Phrase('all_directories_under_x_must_be_writable', array('directory' => $dataDir));
}
}
}
$internalDataDir = XenForo_Helper_File::getInternalDataPath();
if (!is_dir($internalDataDir) || !is_writable($internalDataDir)) {
$errors['internalDataDir'] = new XenForo_Phrase('directory_x_must_be_writable', array('directory' => $internalDataDir));
} else {
foreach (scandir($internalDataDir) as $file) {
if ($file[0] == '.') {
continue;
}
$fullPath = "{$internalDataDir}/{$file}";
if (is_dir($fullPath) && !is_writable($fullPath)) {
$errors['internalDataDir'] = new XenForo_Phrase('all_directories_under_x_must_be_writable', array('directory' => $internalDataDir));
}
}
}
return $errors;
}