Skip to content

Commit 52af9bd

Browse files
authored
Merge pull request #2 from ezSQL/master
Update ezSQL for new fixes
2 parents e73a3de + bcd5b92 commit 52af9bd

File tree

4 files changed

+30
-32
lines changed

4 files changed

+30
-32
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ env:
1313
services:
1414
- mysql
1515
- postgresql
16-
16+
1717
# Commands to be run before your environment runs.
1818
before_script:
19-
- composer self-update
20-
- composer require php-coveralls/php-coveralls
21-
- composer require phpstan/phpstan
19+
- composer self-update
20+
- composer require phpstan/phpstan "0.11.3"
2221
- mysql -e 'CREATE DATABASE IF NOT EXISTS ez_test;'
2322
- mysql -e "CREATE USER ez_test@localhost IDENTIFIED BY 'ezTest'; GRANT ALL ON ez_test.* TO ez_test@localhost; FLUSH PRIVILEGES;"
2423
- psql -c 'CREATE DATABASE ez_test;' -U postgres
@@ -31,7 +30,7 @@ after_success:
3130
- travis_retry php vendor/bin/php-coveralls
3231

3332
# Commands you want to run that will verify your build.
34-
script:
33+
script:
3534
- vendor/bin/phpunit --coverage-clover=coverage.xml
3635
- vendor/bin/phpstan analyse lib tests --level=1
3736

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![codecov](https://codecov.io/gh/ezSQL/ezSQL/branch/master/graph/badge.svg)](https://codecov.io/gh/ezSQL/ezSQL)
66
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/aad1f6aaaaa14f60933e75615da900b8)](https://www.codacy.com/app/techno-express/ezsql?utm_source=github.com&utm_medium=referral&utm_content=ezSQL/ezsql&utm_campaign=Badge_Grade)
77
[![Maintainability](https://api.codeclimate.com/v1/badges/6f6107f25e9de7bf4272/maintainability)](https://codeclimate.com/github/ezSQL/ezsql/maintainability)
8+
[![Total Downloads](https://poser.pugx.org/jv2222/ezsql/downloads)](https://packagist.org/packages/jv2222/ezsql)
89

910
***A class to make it very easy to deal with database connections.***
1011

appveyor.yml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ clone_folder: c:\projects\php-project-workspace
66
## Build matrix for lowest and highest possible targets
77
environment:
88
matrix:
9-
- php_ver_target: 7.3
9+
- php_ver_target: 7.3.11
1010
MYSQL_DATABASE: ez_test
1111
MYSQL_HOST: localhost
1212
MYSQL_USER: root
@@ -20,39 +20,41 @@ services:
2020

2121
## Set up environment variables
2222
init:
23-
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\Program Files\PostgreSQL\9.4\bin\;%PATH%
2423
- SET COMPOSER_NO_INTERACTION=1
2524
- SET PHP=1 # This var is connected to PHP install cache
2625
- SET ANSICON=121x90 (121x90)
2726

2827
## Install PHP and composer, and run the appropriate composer command Get the MSSQL DLL's and XDEBUG
2928
install:
30-
- IF EXIST c:\tools\php (SET PHP=0)
31-
- ps: >-
32-
appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
33-
- appveyor-retry cinst -y sqlite
34-
- cd c:\tools\php
29+
# Enable Windows Update service, needed to install vcredist2015 (dependency of php)
30+
- IF EXIST c:\tools\php73 (SET PHP=0)
31+
- ps: Set-Service wuauserv -StartupType Manual
32+
- choco config set cacheLocation %LOCALAPPDATA%\Temp\Chocolatey
33+
- choco install -y php --version %php_ver_target%
34+
- choco install -y sqlite
35+
- choco install -y composer
36+
- refreshenv
37+
- composer install --no-interaction --no-progress --prefer-dist
38+
- cd C:\tools\php73
3539
# Get the MSSQL DLL's
3640
- ps: >-
3741
If ($env:PHP -eq "1") {
3842
$DLLVersion = "5.6.1"
39-
cd c:\tools\php\ext
40-
$source = "http://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc15-x64.zip"
41-
$destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc15-x64.zip"
43+
cd C:\tools\php73\ext
44+
$source = "http://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-7.3-nts-vc15-x64.zip"
45+
$destination = "C:\tools\php73\ext\php_sqlsrv-$($DLLVersion)-7.3-nts-vc15-x64.zip"
4246
Invoke-WebRequest $source -OutFile $destination
43-
7z x -y php_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc15-x64.zip > $null
44-
$source = "http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc15-x64.zip"
45-
$destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc15-x64.zip"
47+
7z x -y php_sqlsrv-$($DLLVersion)-7.3-nts-vc15-x64.zip > $null
48+
$source = "http://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-7.3-nts-vc15-x64.zip"
49+
$destination = "C:\tools\php73\ext\php_pdo_sqlsrv-$($DLLVersion)-7.3-nts-vc15-x64.zip"
4650
Invoke-WebRequest $source -OutFile $destination
47-
7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php_ver_target)-nts-vc15-x64.zip > $null
48-
Remove-Item c:\tools\php\ext* -include .zip
49-
cd c:\tools\php
51+
7z x -y php_pdo_sqlsrv-$($DLLVersion)-7.3-nts-vc15-x64.zip > $null
52+
Remove-Item C:\tools\php73\ext* -include .zip
53+
Invoke-WebRequest "https://xdebug.org/files/php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll" -OutFile "C:\tools\php73\ext\php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll"
54+
cd C:\tools\php73
5055
}
51-
- IF %PHP%==1 copy php.ini-production php.ini /Y
5256
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
5357
- IF %PHP%==1 echo extension_dir=ext >> php.ini
54-
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
55-
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
5658
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
5759
- ps: >-
5860
If ($env:php_ver_target -eq "5.6") {
@@ -70,25 +72,22 @@ install:
7072
- IF %PHP%==1 echo extension=php_pdo_sqlite.dll >> php.ini
7173
- IF %PHP%==1 echo extension=php_mysqli.dll >> php.ini
7274
- IF %PHP%==1 echo extension=php_pdo_mysql.dll >> php.ini
73-
- IF %PHP%==1 appveyor-retry appveyor DownloadFile https://xdebug.org/files/php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll -FileName c:\tools\php\ext\php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll
7475
- IF %PHP%==1 echo [xdebug] >> php.ini
7576
- IF %PHP%==1 echo zend_extension=php_xdebug-2.7.2-7.3-vc15-nts-x86_64.dll >> php.ini
7677
- IF %PHP%==1 echo zend.assertions=1 >> php.ini
7778
- IF %PHP%==1 echo assert.exception=On >> php.ini
7879
- IF %PHP%==1 echo xdebug.remote_enable=1 >> php.ini
7980
- IF %PHP%==1 echo xdebug.remote_autostart=1 >> php.ini
8081
- IF %PHP%==1 echo xdebug.profiler_enable=off >> php.ini
81-
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
82-
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
8382
- cd c:\projects\php-project-workspace
8483
- composer self-update
85-
- composer require php-coveralls/php-coveralls
86-
- composer require phpstan/phpstan
84+
- composer require phpstan/phpstan "0.11.3"
8785

8886
build_script:
8987
# postgres
9088
- SET PGUSER=postgres
9189
- SET PGPASSWORD=Password12!
90+
- PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
9291
- createdb ez_test
9392
- psql -c "CREATE USER ez_test WITH PASSWORD 'ezTest';"
9493
# sqlserver
@@ -113,4 +112,3 @@ on_success:
113112
test_script:
114113
- cd c:\projects\php-project-workspace
115114
- vendor\bin\phpunit --coverage-clover=coverage.xml
116-
- vendor\bin\phpstan analyse lib tests --level=1

lib/Database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ private function __wakeup()
3131
* @param mixed $setting - SQL connection parameters
3232
* @param mixed $tag - Store the instance for later use
3333
*/
34-
public static function initialize(string $vendor = null, array $setting = null, string $tag = null)
34+
public static function initialize(?string $vendor = null, ?array $setting = null, ?string $tag = null)
3535
{
36-
if (isset(self::$instances[$vendor]))
36+
if (isset(self::$instances[$vendor]) && empty($setting) && empty($tag))
3737
return \setInstance(self::$instances[$vendor]) ? self::$instances[$vendor] : false;
3838

3939
if (empty($vendor) || empty($setting)) {

0 commit comments

Comments
 (0)