Merge pull request #199 from shivammathur/develop

2.1.1
This commit is contained in:
Shivam Mathur 2020-03-08 08:39:56 +05:30
commit a5e5d07fcb
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
9 changed files with 133 additions and 99 deletions

View File

@ -29,7 +29,7 @@ jobs:
php-versions: ['8.0'] php-versions: ['8.0']
env: env:
extensions: xml, opcache, xdebug, pcov extensions: xml, opcache, xdebug, pcov
key: cache-v1 key: cache-v2
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@ -27,7 +27,7 @@ jobs:
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
env: env:
extensions: xml, opcache, xdebug, pcov extensions: xml, opcache, xdebug, pcov
key: cache-v1 key: cache-v2
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@ -35,15 +35,15 @@ describe('Extension tests', () => {
it('checking addExtensionOnLinux', async () => { it('checking addExtensionOnLinux', async () => {
let linux: string = await extensions.addExtension( let linux: string = await extensions.addExtension(
'xdebug, pcov, ast-beta, xdebug-alpha, grpc-1.2.3', 'xdebug, pcov, ast-beta, pdo_mysql, pdo-odbc, xdebug-alpha, grpc-1.2.3',
'7.4', '7.4',
'linux' 'linux'
); );
expect(linux).toContain('update_extension xdebug 2.9.1'); expect(linux).toContain('update_extension xdebug 2.9.1');
expect(linux).toContain( expect(linux).toContain('sudo $debconf_fix apt-get install -y php7.4-pcov');
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php7.4-pcov'
);
expect(linux).toContain('add_unstable_extension ast beta extension'); expect(linux).toContain('add_unstable_extension ast beta extension');
expect(linux).toContain('add_pdo_extension mysql');
expect(linux).toContain('add_pdo_extension odbc');
expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension'); expect(linux).toContain('add_pecl_extension grpc 1.2.3 extension');
expect(linux).toContain( expect(linux).toContain(
'add_unstable_extension xdebug alpha zend_extension' 'add_unstable_extension xdebug alpha zend_extension'

10
dist/index.js vendored
View File

@ -2917,12 +2917,18 @@ function addExtensionLinux(extension_csv, version, pipe) {
'\n' + '\n' +
(yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux')); (yield utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
return; return;
// match pdo extensions
case /.*pdo[_-].*/.test(version_extension):
script +=
'\nadd_pdo_extension ' +
extension.replace('pdo_', '').replace('pdo-', '');
return;
default: default:
install_command = install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' + 'sudo $debconf_fix apt-get install -y php' +
version + version +
'-' + '-' +
extension.replace('pdo_', '').replace('pdo-', '') + extension +
pipe; pipe;
break; break;
} }

134
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.1.0", "version": "2.1.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -32,18 +32,18 @@
} }
}, },
"@babel/core": { "@babel/core": {
"version": "7.8.6", "version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.6.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.7.tgz",
"integrity": "sha512-Sheg7yEJD51YHAvLEV/7Uvw95AeWqYPL3Vk3zGujJKIhJ+8oLw2ALaf3hbucILhKsgSoADOvtKRJuNVdcJkOrg==", "integrity": "sha512-rBlqF3Yko9cynC5CCFy6+K/w2N+Sq/ff2BPy+Krp7rHlABIr5epbA7OxVeKoMHB39LZOp1UY5SuLjy6uWi35yA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/code-frame": "^7.8.3", "@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.8.6", "@babel/generator": "^7.8.7",
"@babel/helpers": "^7.8.4", "@babel/helpers": "^7.8.4",
"@babel/parser": "^7.8.6", "@babel/parser": "^7.8.7",
"@babel/template": "^7.8.6", "@babel/template": "^7.8.6",
"@babel/traverse": "^7.8.6", "@babel/traverse": "^7.8.6",
"@babel/types": "^7.8.6", "@babel/types": "^7.8.7",
"convert-source-map": "^1.7.0", "convert-source-map": "^1.7.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"gensync": "^1.0.0-beta.1", "gensync": "^1.0.0-beta.1",
@ -69,12 +69,12 @@
} }
}, },
"@babel/generator": { "@babel/generator": {
"version": "7.8.6", "version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.6.tgz", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.7.tgz",
"integrity": "sha512-4bpOR5ZBz+wWcMeVtcf7FbjcFzCp+817z2/gHNncIRcM9MmKzUhtWCYAq27RAfUrAFwb+OCG1s9WEaVxfi6cjg==", "integrity": "sha512-DQwjiKJqH4C3qGiyQCAExJHoZssn49JTMJgZ8SANGgVFdkupcUhLOdkAeoC6kmHZCPfoDG5M0b6cFlSN5wW7Ew==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/types": "^7.8.6", "@babel/types": "^7.8.7",
"jsesc": "^2.5.1", "jsesc": "^2.5.1",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"source-map": "^0.5.0" "source-map": "^0.5.0"
@ -198,9 +198,9 @@
} }
}, },
"@babel/parser": { "@babel/parser": {
"version": "7.8.6", "version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.6.tgz", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.8.7.tgz",
"integrity": "sha512-trGNYSfwq5s0SgM1BMEB8hX3NDmO7EP2wsDGDexiaKMB92BaRpS+qZfpkMqUBhcsOTBwNy9B/jieo4ad/t/z2g==", "integrity": "sha512-9JWls8WilDXFGxs0phaXAZgpxTZhSk/yOYH2hTHC0X1yC7Z78IJfvR1vJ+rmJKq3I35td2XzXzN6ZLYlna+r/A==",
"dev": true "dev": true
}, },
"@babel/plugin-syntax-bigint": { "@babel/plugin-syntax-bigint": {
@ -222,12 +222,12 @@
} }
}, },
"@babel/runtime": { "@babel/runtime": {
"version": "7.8.4", "version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.8.4.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.8.7.tgz",
"integrity": "sha512-neAp3zt80trRVBI1x0azq6c57aNBqYZH8KhMm3TaB7wEI5Q4A2SHfBHE8w9gOhI/lrqxtEbXZgQIrHP+wvSGwQ==", "integrity": "sha512-+AATMUFppJDw6aiR5NVPHqIQBlV/Pj8wY/EZH+lmvRdUo9xBaz/rF3alAwFJQavvKfeOlPE7oaaDHVbcySbCsg==",
"dev": true, "dev": true,
"requires": { "requires": {
"regenerator-runtime": "^0.13.2" "regenerator-runtime": "^0.13.4"
} }
}, },
"@babel/template": { "@babel/template": {
@ -267,9 +267,9 @@
} }
}, },
"@babel/types": { "@babel/types": {
"version": "7.8.6", "version": "7.8.7",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.6.tgz", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.8.7.tgz",
"integrity": "sha512-wqz7pgWMIrht3gquyEFPVXeXCti72Rm8ep9b5tQKz9Yg9LzJA3HxosF1SB3Kc81KD1A3XBkkVYtJvCKS2Z/QrA==", "integrity": "sha512-k2TreEHxFA4CjGkL+GYjRyx35W0Mr7DP5+9q6WMkyKXB+904bYmG40syjMFV0oLlhhFCwWl0vA0DyzTDkwAiJw==",
"dev": true, "dev": true,
"requires": { "requires": {
"esutils": "^2.0.2", "esutils": "^2.0.2",
@ -662,9 +662,9 @@
} }
}, },
"@types/jest": { "@types/jest": {
"version": "25.1.3", "version": "25.1.4",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.3.tgz", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.4.tgz",
"integrity": "sha512-jqargqzyJWgWAJCXX96LBGR/Ei7wQcZBvRv0PLEu9ZByMfcs23keUJrKv9FMR6YZf9YCbfqDqgmY+JUBsnqhrg==", "integrity": "sha512-QDDY2uNAhCV7TMCITrxz+MRk1EizcsevzfeS6LykIlq2V1E5oO4wXG8V2ZEd9w7Snxeeagk46YbMgZ8ESHx3sw==",
"dev": true, "dev": true,
"requires": { "requires": {
"jest-diff": "^25.1.0", "jest-diff": "^25.1.0",
@ -678,9 +678,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "13.7.7", "version": "13.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.7.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.0.tgz",
"integrity": "sha512-Uo4chgKbnPNlxQwoFmYIwctkQVkMMmsAoGGU4JKwLuvBefF0pCq4FybNSnfkfRCpC7ZW7kttcC/TrRtAJsvGtg==", "integrity": "sha512-0ARSQootUG1RljH2HncpsY2TJBfGQIKOOi7kxzUY6z54ePu/ZD+wJA8zI2Q6v8rol2qpG/rvqsReco8zNMPvhQ==",
"dev": true "dev": true
}, },
"@types/parse-json": { "@types/parse-json": {
@ -711,12 +711,12 @@
"dev": true "dev": true
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "2.21.0", "version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.21.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.22.0.tgz",
"integrity": "sha512-b5jjjDMxzcjh/Sbjuo7WyhrQmVJg0WipTHQgXh5Xwx10uYm6nPWqN1WGOsaNq4HR3Zh4wUx4IRQdDkCHwyewyw==", "integrity": "sha512-BvxRLaTDVQ3N+Qq8BivLiE9akQLAOUfxNHIEhedOcg8B2+jY8Rc4/D+iVprvuMX1AdezFYautuGDwr9QxqSxBQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "2.21.0", "@typescript-eslint/experimental-utils": "2.22.0",
"eslint-utils": "^1.4.3", "eslint-utils": "^1.4.3",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0", "regexpp": "^3.0.0",
@ -724,32 +724,32 @@
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "2.21.0", "version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.21.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz",
"integrity": "sha512-olKw9JP/XUkav4lq0I7S1mhGgONJF9rHNhKFn9wJlpfRVjNo3PPjSvybxEldvCXnvD+WAshSzqH5cEjPp9CsBA==", "integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.21.0", "@typescript-eslint/typescript-estree": "2.22.0",
"eslint-scope": "^5.0.0" "eslint-scope": "^5.0.0"
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "2.21.0", "version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.21.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.22.0.tgz",
"integrity": "sha512-VrmbdrrrvvI6cPPOG7uOgGUFXNYTiSbnRq8ZMyuGa4+qmXJXVLEEz78hKuqupvkpwJQNk1Ucz1TenrRP90gmBg==", "integrity": "sha512-FaZKC1X+nvD7qMPqKFUYHz3H0TAioSVFGvG29f796Nc5tBluoqfHgLbSFKsh7mKjRoeTm8J9WX2Wo9EyZWjG7w==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint-visitor-keys": "^1.0.0", "@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.21.0", "@typescript-eslint/experimental-utils": "2.22.0",
"@typescript-eslint/typescript-estree": "2.21.0", "@typescript-eslint/typescript-estree": "2.22.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
} }
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "2.21.0", "version": "2.22.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.21.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz",
"integrity": "sha512-NC/nogZNb9IK2MEFQqyDBAciOT8Lp8O3KgAfvHx2Skx6WBo+KmDqlU3R9KxHONaijfTIKtojRe3SZQyMjr3wBw==", "integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.1", "debug": "^4.1.1",
@ -1113,9 +1113,9 @@
} }
}, },
"browser-process-hrtime": { "browser-process-hrtime": {
"version": "0.1.3", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
"integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==", "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==",
"dev": true "dev": true
}, },
"browser-resolve": { "browser-resolve": {
@ -1883,9 +1883,9 @@
} }
}, },
"eslint-plugin-jest": { "eslint-plugin-jest": {
"version": "23.8.1", "version": "23.8.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz",
"integrity": "sha512-OycLNqPo/2EfO6kTqnmsu1khz1gTIOxGl3ThIVwL5/oycDF4pm5uNDyvFelNLdpr4COUuM8PVi3963NEG1Efpw==", "integrity": "sha512-xwbnvOsotSV27MtAe7s8uGWOori0nUsrXh2f1EnpmXua8sDfY6VZhHAhHg2sqK7HBNycRQExF074XSZ7DvfoFg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "^2.5.0" "@typescript-eslint/experimental-utils": "^2.5.0"
@ -1926,13 +1926,13 @@
"dev": true "dev": true
}, },
"espree": { "espree": {
"version": "6.1.2", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.0.tgz",
"integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", "integrity": "sha512-Xs8airJ7RQolnDIbLtRutmfvSsAe0xqMMAantCN/GMoqf81TFbeI1T7Jpd56qYu1uuh32dOG5W/X9uO+ghPXzA==",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "^7.1.0", "acorn": "^7.1.0",
"acorn-jsx": "^5.1.0", "acorn-jsx": "^5.2.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
} }
}, },
@ -2739,9 +2739,9 @@
"dev": true "dev": true
}, },
"inquirer": { "inquirer": {
"version": "7.0.5", "version": "7.0.6",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.5.tgz", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.6.tgz",
"integrity": "sha512-6Z5cP+LAO0rzNE7xWjWtT84jxKa5ScLEGLgegPXeO3dGeU8lNe5Ii7SlXH6KVtLGlDuaEhsvsFjrjWjw8j5lFg==", "integrity": "sha512-7SVO4h+QIdMq6XcqIqrNte3gS5MzCCKZdsq9DO4PJziBFNYzP3PGFbDjgadDb//MCahzgjCxvQ/O2wa7kx9o4w==",
"dev": true, "dev": true,
"requires": { "requires": {
"ansi-escapes": "^4.2.1", "ansi-escapes": "^4.2.1",
@ -4430,9 +4430,9 @@
} }
}, },
"regenerator-runtime": { "regenerator-runtime": {
"version": "0.13.3", "version": "0.13.4",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz",
"integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==", "integrity": "sha512-plpwicqEzfEyTQohIKktWigcLzmNStMGwbOUbykx51/29Z3JOGYldaaNGK7ngNXV+UcoqvIMmloZ48Sr74sd+g==",
"dev": true "dev": true
}, },
"regex-not": { "regex-not": {
@ -5713,12 +5713,12 @@
} }
}, },
"w3c-hr-time": { "w3c-hr-time": {
"version": "1.0.1", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
"integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"browser-process-hrtime": "^0.1.2" "browser-process-hrtime": "^1.0.0"
} }
}, },
"w3c-xmlserializer": { "w3c-xmlserializer": {
@ -5874,12 +5874,12 @@
"dev": true "dev": true
}, },
"yaml": { "yaml": {
"version": "1.7.2", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.7.2.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.8.0.tgz",
"integrity": "sha512-qXROVp90sb83XtAoqE8bP9RwAkTTZbugRUTm5YeFCBfNRPEp2YzTeqWiz7m5OORHzEvrA/qcGS8hp/E+MMROYw==", "integrity": "sha512-6qI/tTx7OVtA4qNqD0OyutbM6Z9EKu4rxWm/2Y3FDEBQ4/2X2XAnyuRXMzAE2+1BPyqzksJZtrIwblOHg0IEzA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/runtime": "^7.6.3" "@babel/runtime": "^7.8.7"
} }
}, },
"yargs": { "yargs": {

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-php", "name": "setup-php",
"version": "2.1.0", "version": "2.1.1",
"private": false, "private": false,
"description": "Setup PHP for use with GitHub Actions", "description": "Setup PHP for use with GitHub Actions",
"main": "dist/index.js", "main": "dist/index.js",
@ -30,15 +30,15 @@
"fs": "0.0.1-security" "fs": "0.0.1-security"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^25.1.3", "@types/jest": "^25.1.4",
"@types/node": "^13.7.7", "@types/node": "^13.9.0",
"@typescript-eslint/eslint-plugin": "^2.21.0", "@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.21.0", "@typescript-eslint/parser": "^2.22.0",
"@zeit/ncc": "^0.21.1", "@zeit/ncc": "^0.21.1",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0", "eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1", "eslint-plugin-import": "^2.20.1",
"eslint-plugin-jest": "^23.8.1", "eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.2", "eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3", "husky": "^4.2.3",
"jest": "^25.1.0", "jest": "^25.1.0",

View File

@ -241,12 +241,18 @@ export async function addExtensionLinux(
'\n' + '\n' +
(await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux')); (await utils.addLog('$tick', 'xdebug', 'Enabled', 'linux'));
return; return;
// match pdo extensions
case /.*pdo[_-].*/.test(version_extension):
script +=
'\nadd_pdo_extension ' +
extension.replace('pdo_', '').replace('pdo-', '');
return;
default: default:
install_command = install_command =
'sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php' + 'sudo $debconf_fix apt-get install -y php' +
version + version +
'-' + '-' +
extension.replace('pdo_', '').replace('pdo-', '') + extension +
pipe; pipe;
break; break;
} }

View File

@ -74,11 +74,10 @@ add_extension() {
elif check_extension "$extension"; then elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled" add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then elif ! check_extension "$extension"; then
( eval "$install_command" >/dev/null 2>&1 &&
eval "$install_command" >/dev/null 2>&1 && if [[ "$version" =~ $old_versions ]]; then echo "$prefix=$ext_dir/$extension.so" >>"$ini_file"; fi
check_extension "$extension" && (check_extension "$extension" && add_log "$tick" "$extension" "Installed and enabled") ||
add_log "$tick" "$extension" "Installed and enabled" add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
) || add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
fi fi
} }
@ -172,6 +171,7 @@ setup_php() {
tick="✓" tick="✓"
cross="✗" cross="✗"
version=$1 version=$1
nodot_version=${1/./}
old_versions="5.[3-5]" old_versions="5.[3-5]"
tool_path_dir="/usr/local/bin" tool_path_dir="/usr/local/bin"
existing_version=$(php-config --version | cut -c 1-3) existing_version=$(php-config --version | cut -c 1-3)
@ -180,8 +180,7 @@ existing_version=$(php-config --version | cut -c 1-3)
# Setup PHP # Setup PHP
step_log "Setup PHP" step_log "Setup PHP"
if [[ "$version" =~ $old_versions ]]; then if [[ "$version" =~ $old_versions ]]; then
script="https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh" curl -sSL https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh | bash -s "$nodot_version" >/dev/null 2>&1 &&
curl -sSL "$script" | bash -s "$version" >/dev/null 2>&1 &&
status="Installed" status="Installed"
elif [ "$existing_version" != "$version" ]; then elif [ "$existing_version" != "$version" ]; then
setup_php "install" setup_php "install"
@ -195,10 +194,9 @@ fi
ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g") ini_file=$(php -d "date.timezone=UTC" --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
sudo chmod 777 "$ini_file" "$tool_path_dir" sudo chmod 777 "$ini_file" "$tool_path_dir"
echo "date.timezone=UTC" >>"$ini_file" echo "date.timezone=UTC" >>"$ini_file"
echo "detect_unicode=Off" >>"$ini_file" ext_dir=$(php -i | grep -Ei "extension_dir => /" | sed -e "s|.*=> s*||")
ext_dir=$(php -i | grep -Ei "extension_dir => /usr" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||") scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
sudo mkdir -p "$ext_dir" sudo mkdir -p "$ext_dir"
semver=$(php -v | head -n 1 | cut -f 2 -d ' ') semver=$(php -v | head -n 1 | cut -f 2 -d ' ')
configure_pecl if [[ ! "$version" =~ $old_versions ]]; then configure_pecl; fi
add_log "$tick" "PHP" "$status PHP $semver" add_log "$tick" "PHP" "$status PHP $semver"

View File

@ -56,8 +56,7 @@ get_pecl_version() {
# Function to test if extension is loaded # Function to test if extension is loaded
check_extension() { check_extension() {
extension=$1 php -m | grep -i -q -w "$1"
php -m | grep -i -q -w "$extension"
} }
# Function to delete extensions # Function to delete extensions
@ -77,6 +76,32 @@ remove_extension() {
delete_extension "$extension" delete_extension "$extension"
} }
# Function to enable existing extension
enable_extension() {
if ! check_extension "$1" && [ -e "$ext_dir/$1.so" ]; then
echo "$2=$1.so" >>"$ini_file"
fi
}
# Funcion to add PDO extension
add_pdo_extension() {
pdo_ext="pdo_$1"
if check_extension "$pdo_ext"; then
add_log "$tick" "$pdo_ext" "Enabled"
else
read -r ext ext_name <<< "$1 $1"
sudo rm -rf "$scan_dir"/*pdo.ini >/dev/null 2>&1 && enable_extension "pdo" "extension" >/dev/null 2>&1
if [ "$ext" = "mysql" ]; then
enable_extension "mysqlnd" "extension"
ext_name="mysqli"
fi
add_extension "$ext_name" "$apt_install php$version-$ext" "extension" >/dev/null 2>&1
enable_extension "$pdo_ext" "extension"
(check_extension "$pdo_ext" && add_log "$tick" "$pdo_ext" "Enabled") ||
add_log "$cross" "$pdo_ext" "Could not install $pdo_ext on PHP $semver"
fi
}
# Function to setup extensions # Function to setup extensions
add_extension() { add_extension() {
extension=$1 extension=$1
@ -85,11 +110,10 @@ add_extension() {
if [[ "$version" =~ $old_versions ]]; then if [[ "$version" =~ $old_versions ]]; then
install_command="update_ppa && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}" install_command="update_ppa && ${install_command/5\.[4-5]-$extension/5-$extension=$release_version}"
fi fi
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then enable_extension "$extension" "$prefix"
echo "$prefix=$extension.so" >>"$ini_file" && add_log "$tick" "$extension" "Enabled" if check_extension "$extension"; then
elif check_extension "$extension"; then
add_log "$tick" "$extension" "Enabled" add_log "$tick" "$extension" "Enabled"
elif ! check_extension "$extension"; then else
eval "$install_command" >/dev/null 2>&1 || eval "$install_command" >/dev/null 2>&1 ||
(update_ppa && eval "$install_command" >/dev/null 2>&1) || (update_ppa && eval "$install_command" >/dev/null 2>&1) ||
sudo pecl install -f "$extension" >/dev/null 2>&1 sudo pecl install -f "$extension" >/dev/null 2>&1