Updated docs and comments
This commit is contained in:
parent
783da73fa5
commit
a5ac18ec27
11
Dockerfile
11
Dockerfile
|
@ -37,7 +37,6 @@ RUN docker-php-ext-install sockets
|
|||
|
||||
RUN \
|
||||
# Redis Extension
|
||||
|
||||
wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \
|
||||
tar -xf $PHP_REDIS_VERSION.tar.gz && \
|
||||
cd phpredis-$PHP_REDIS_VERSION && \
|
||||
|
@ -45,9 +44,7 @@ RUN \
|
|||
./configure && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
|
||||
## Swoole Extension
|
||||
|
||||
git clone https://github.com/swoole/swoole-src.git && \
|
||||
cd swoole-src && \
|
||||
git checkout v$PHP_SWOOLE_VERSION && \
|
||||
|
@ -55,16 +52,13 @@ RUN \
|
|||
./configure --enable-sockets --enable-http2 && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
|
||||
## php reader extension
|
||||
|
||||
## Maxminddb extension
|
||||
git clone https://github.com/maxmind/MaxMind-DB-Reader-php.git && \
|
||||
cd MaxMind-DB-Reader-php/ext && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
cd ..
|
||||
|
||||
cd ../..
|
||||
|
||||
FROM php:7.4-cli-alpine as final
|
||||
|
||||
|
@ -125,7 +119,6 @@ RUN \
|
|||
docker-cli \
|
||||
libmaxminddb \
|
||||
libmaxminddb-dev \
|
||||
|
||||
&& pecl install imagick yaml \
|
||||
&& docker-php-ext-enable imagick yaml \
|
||||
&& docker-php-ext-install sockets opcache pdo_mysql \
|
||||
|
|
|
@ -604,7 +604,7 @@ App::get('/v1/account/sessions')
|
|||
/** @var Utopia\Response $response */
|
||||
/** @var Appwrite\Database\Document $user */
|
||||
/** @var Utopia\Locale\Locale $locale */
|
||||
/** @var GeoIp2\Database\Reader $geodb */
|
||||
/** @var MaxMind\Db\Reader $geodb */
|
||||
|
||||
$tokens = $user->getAttribute('tokens', []);
|
||||
$sessions = [];
|
||||
|
@ -641,11 +641,11 @@ App::get('/v1/account/sessions')
|
|||
try {
|
||||
$record = $geodb->get($token->getAttribute('ip', ''));
|
||||
|
||||
if(isset($record)){
|
||||
if (isset($record)){
|
||||
$sessions[$index]['geo']['isoCode'] = \strtolower($record['country']['iso_code']);
|
||||
$sessions[$index]['geo']['country'] = (isset($countries[$record['country']['iso_code']])) ? $countries[$record['country']['iso_code']] : $locale->getText('locale.country.unknown');
|
||||
}
|
||||
else{
|
||||
}
|
||||
else {
|
||||
$sessions[$index]['geo']['isoCode'] = '--';
|
||||
$sessions[$index]['geo']['country'] = $locale->getText('locale.country.unknown');
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ App::get('/v1/account/logs')
|
|||
/** @var Appwrite\Database\Document $project */
|
||||
/** @var Appwrite\Database\Document $user */
|
||||
/** @var Utopia\Locale\Locale $locale */
|
||||
/** @var GeoIp2\Database\Reader $geodb */
|
||||
/** @var MaxMind\Db\Reader $geodb */
|
||||
|
||||
$adapter = new AuditAdapter($register->get('db'));
|
||||
$adapter->setNamespace('app_'.$project->getId());
|
||||
|
|
|
@ -15,7 +15,7 @@ App::get('/v1/locale')
|
|||
/** @var Utopia\Request $request */
|
||||
/** @var Utopia\Response $response */
|
||||
/** @var Utopia\Locale\Locale $locale */
|
||||
/** @var GeoIp2\Database\Reader $geodb */
|
||||
/** @var MaxMind\Db\Reader $geodb */
|
||||
|
||||
$eu = Config::getParam('locale-eu');
|
||||
$currencies = Config::getParam('locale-currencies');
|
||||
|
@ -31,9 +31,12 @@ App::get('/v1/locale')
|
|||
|
||||
try {
|
||||
$record = $geodb->get($ip);
|
||||
|
||||
var_dump('record');
|
||||
var_dump($record);
|
||||
|
||||
$output['countryCode'] = $record['country']['iso_code'];
|
||||
$output['country'] = (isset($countries[$record['country']['iso_code']])) ? $countries[$record['country']['iso_code']] : $locale->getText('locale.country.unknown');
|
||||
//$output['countryTimeZone'] = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $record->country->isoCode);
|
||||
$output['continent'] = (isset($continents[$record['continent']['code']])) ? $continents[$record['continent']['code']] : $locale->getText('locale.country.unknown');
|
||||
$output['continentCode'] = $record['continent']['code'];
|
||||
$output['eu'] = (\in_array($record['country']['iso_code'], $eu)) ? true : false;
|
||||
|
|
|
@ -231,7 +231,7 @@ App::get('/v1/users/:userId/sessions')
|
|||
/** @var Utopia\Response $response */
|
||||
/** @var Appwrite\Database\Database $projectDB */
|
||||
/** @var Utopia\Locale\Locale $locale */
|
||||
/** @var GeoIp2\Database\Reader $geodb */
|
||||
/** @var MaxMind\Db\Reader $geodb */
|
||||
|
||||
$user = $projectDB->getDocument($userId);
|
||||
|
||||
|
@ -272,11 +272,10 @@ App::get('/v1/users/:userId/sessions')
|
|||
try {
|
||||
$record = $geodb->get($token->getAttribute('ip', ''));
|
||||
|
||||
if(isset($record)){
|
||||
if (isset($record)) {
|
||||
$sessions[$index]['geo']['isoCode'] = \strtolower($record['country']['iso_code']);
|
||||
$sessions[$index]['geo']['country'] = (isset($countries[$record['country']['iso_code']])) ? $countries[$record['country']['iso_code']] : $locale->getText('locale.country.unknown');
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$sessions[$index]['geo']['isoCode'] = '--';
|
||||
$sessions[$index]['geo']['country'] = $locale->getText('locale.country.unknown');
|
||||
}
|
||||
|
@ -307,7 +306,7 @@ App::get('/v1/users/:userId/logs')
|
|||
/** @var Appwrite\Database\Document $project */
|
||||
/** @var Appwrite\Database\Database $projectDB */
|
||||
/** @var Utopia\Locale\Locale $locale */
|
||||
/** @var GeoIp2\Database\Reader $geodb */
|
||||
/** @var MaxMind\Db\Reader $geodb */
|
||||
|
||||
$user = $projectDB->getDocument($userId);
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ class PDO extends PDONative
|
|||
public function reconnect()
|
||||
{
|
||||
$this->pdo = new PDONative($this->dsn, $this->username, $this->passwd, $this->options);
|
||||
|
||||
echo '[PDO] MySQL connection restarted'.PHP_EOL;
|
||||
|
||||
// Connection settings
|
||||
$this->pdo->setAttribute(PDONative::ATTR_DEFAULT_FETCH_MODE, PDONative::FETCH_ASSOC); // Return arrays
|
||||
|
|
Loading…
Reference in a new issue