mirror of
https://github.com/friendica/friendica
synced 2024-11-17 20:23:40 +00:00
Fix Database $_SERVER usage and remove old .travis files
This commit is contained in:
parent
0b98d67b80
commit
16591077ac
7 changed files with 10 additions and 54 deletions
21
.github/workflows/php.yml
vendored
21
.github/workflows/php.yml
vendored
|
@ -5,20 +5,14 @@ jobs:
|
|||
friendica:
|
||||
name: Friendica (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
MYSQL_HOST: localhost
|
||||
MYSQL_PORT: 3306
|
||||
MYSQL_DATABASE: test
|
||||
MYSQL_PASSWORD: ""
|
||||
MYSQL_USERNAME: travis
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
||||
MYSQL_DATABASE: test
|
||||
MYSQL_PASSWORD: ""
|
||||
MYSQL_USERNAME: travis
|
||||
MYSQL_PASSWORD: test
|
||||
MYSQL_USER: test
|
||||
ports:
|
||||
- 3306/tcp
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
|
@ -83,8 +77,7 @@ jobs:
|
|||
env:
|
||||
PORT: ${{ job.services.mariadb.ports[3306] }}
|
||||
run: |
|
||||
mysql -h"127.0.0.1" -P"$PORT" -uroot -e 'CREATE DATABASE IF NOT EXISTS test;'
|
||||
mysql -h"127.0.0.1" -P"$PORT" -uroot test < database.sql
|
||||
mysql -h"127.0.0.1" -P"$PORT" -utest -ptest test < database.sql
|
||||
|
||||
- name: Test with Parallel-lint
|
||||
run: vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ .
|
||||
|
@ -92,11 +85,11 @@ jobs:
|
|||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
|
||||
env:
|
||||
MYSQL_HOST: localhost
|
||||
MYSQL_PORT: 3306
|
||||
MYSQL_HOST: 127.0.0.1
|
||||
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
|
||||
MYSQL_DATABASE: test
|
||||
MYSQL_PASSWORD: ""
|
||||
MYSQL_USERNAME: root
|
||||
MYSQL_PASSWORD: test
|
||||
MYSQL_USER: test
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
|
|
31
.travis.yml
31
.travis.yml
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
language: php
|
||||
## Friendica officially supports PHP version >= 7.1
|
||||
php:
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- redis
|
||||
- memcached
|
||||
env:
|
||||
- MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_USERNAME=travis MYSQL_PASSWORD="" MYSQL_DATABASE=test
|
||||
|
||||
install:
|
||||
- composer install
|
||||
before_script:
|
||||
- cp config/local-sample.config.php config/local.config.php
|
||||
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
||||
- mysql -utravis test < database.sql
|
||||
- pecl channel-update pecl.php.net
|
||||
- pecl config-set preferred_state beta
|
||||
- phpenv config-add .travis/redis.ini
|
||||
- phpenv config-add .travis/memcached.ini
|
||||
|
||||
script:
|
||||
- vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ .
|
||||
- vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
|
||||
|
||||
after_success: bash <(curl -s https://codecov.io/bash)
|
|
@ -1,4 +0,0 @@
|
|||
extension="apcu.so"
|
||||
|
||||
apc.enabled = 1
|
||||
apc.enable_cli = 1
|
|
@ -1 +0,0 @@
|
|||
extension="memcached.so"
|
|
@ -1 +0,0 @@
|
|||
extension="redis.so"
|
|
@ -59,7 +59,7 @@ class Database
|
|||
/** @var PDO|mysqli */
|
||||
protected $connection;
|
||||
protected $driver;
|
||||
private $emulate_prepares = false;
|
||||
protected $emulate_prepares = false;
|
||||
private $error = false;
|
||||
private $errorno = 0;
|
||||
private $affected_rows = 0;
|
||||
|
@ -88,7 +88,7 @@ class Database
|
|||
{
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty($server['MYSQL_HOST'])
|
||||
&& (!empty($server['MYSQL_USERNAME'] || !empty($server['MYSQL_USER'])))
|
||||
&& (!empty($server['MYSQL_USERNAME']) || !empty($server['MYSQL_USER']))
|
||||
&& $server['MYSQL_PASSWORD'] !== false
|
||||
&& !empty($server['MYSQL_DATABASE']))
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ class StaticDatabase extends Database
|
|||
{
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty($server['MYSQL_HOST'])
|
||||
&& (!empty($server['MYSQL_USERNAME'] || !empty($server['MYSQL_USER'])))
|
||||
&& (!empty($server['MYSQL_USERNAME']) || !empty($server['MYSQL_USER']))
|
||||
&& $server['MYSQL_PASSWORD'] !== false
|
||||
&& !empty($server['MYSQL_DATABASE']))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue