Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
viames committed Jan 26, 2018
1 parent 507e0bd commit e5a79b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
21 changes: 0 additions & 21 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@
*/
class Application {

/**
* Framework version.
* @var string
* @deprecated
*/
const VERSION = '1.0';

/**
* Framework build.
* @var string
* @deprecated
*/
const BUILD = '1557';

/**
* Framework date of last change.
* @var string
* @deprecated
*/
const DATE = '2016-11-30 09:33:01Z';

/**
* Singleton property.
* @var Application|NULL
Expand Down
24 changes: 17 additions & 7 deletions src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ private function openConnection($persistent=FALSE) {
$this->handler = new \PDO($dsn, DB_USER, DB_PASS, $options);

if (is_a($this->handler, 'PDO')) {
$logger = Logger::getInstance();
$logger->addEvent('Database is' . ($persistent ? ' persistently' : '') . ' connected');
$this->handler->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
} else {
throw new \PDOException('Db handler is not valid, connection failed');
Expand Down Expand Up @@ -776,12 +774,24 @@ public function getMysqlVersion() {
*/
public function setUtf8unicode() {

$this->exec('SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci');
$this->openConnection();

try {

$this->handler->exec('SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci');

$this->exec('SET character_set_client = "utf8mb4", character_set_connection = "utf8mb4",' .
' character_set_database = "utf8mb4", character_set_results = "utf8mb4",' .
' character_set_server = "utf8mb4", collation_connection = "utf8mb4_unicode_ci",' .
' collation_database = "utf8mb4_unicode_ci", collation_server = "utf8mb4_unicode_ci"');
$this->handler->exec(
'SET character_set_client = "utf8mb4", character_set_connection = "utf8mb4",' .
' character_set_database = "utf8mb4", character_set_results = "utf8mb4",' .
' character_set_server = "utf8mb4", collation_connection = "utf8mb4_unicode_ci",' .
' collation_database = "utf8mb4_unicode_ci", collation_server = "utf8mb4_unicode_ci"');

} catch (\Exception $e) {

// cannot log right now

}


}

Expand Down
4 changes: 2 additions & 2 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ final private function startChrono() {

$this->timeStart = $this->lastChrono = $this->getMicrotime();

$this->addEvent('Starting Pair framework ' . Application::VERSION . ', base timezone is ' . BASE_TIMEZONE);
$this->addEvent('Starting Pair framework with base timezone ' . BASE_TIMEZONE);

}

Expand Down Expand Up @@ -321,7 +321,7 @@ final public function getEventList() {

// warnings
if ($warningCount) {
$ret.= '<a href="' . $route->getUrl() . '#logFirstWarning" class="item warning"><span class="icon fa fa-warning"></span><span class="emph">' . $warningCount . '</span> ' . ($warningCount>1 ? 'warnings' : 'warning') . '</a>';
$ret.= '<a href="' . $route->getUrl() . '#logFirstWarning" class="item warning"><span class="icon fa fa-exclamation-triangle"></span><span class="emph">' . $warningCount . '</span> ' . ($warningCount>1 ? 'warnings' : 'warning') . '</a>';
}

// errors
Expand Down

0 comments on commit e5a79b2

Please sign in to comment.