Skip to content

Commit 1b1b2ca

Browse files
authored
Merge branch 'master' into use-multiphp-container
2 parents 36fb683 + a9552af commit 1b1b2ca

File tree

70 files changed

+1198
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1198
-185
lines changed

.github/blunderbuss.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ assign_issues_by:
1313
- 'api: cloudiot'
1414
to:
1515
- laszlokorossy
16+
- labels:
17+
- 'api: spanner'
18+
to:
19+
- shivgautam
1620

1721
assign_prs_by:
1822
- labels:

appengine/flexible/drupal8/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ env: flex
7474

7575
For now, you need to disable the CSS and JS preprocessed caching that Drupal 8 enables by default.
7676
To do this, go to `/admin/config/development/performance` and deselect the two
77-
chechboxes (`Aggregate CSS files` and `Aggregate JS files`) under **Bandwidth Optimizations**.
77+
checkboxes (`Aggregate CSS files` and `Aggregate JS files`) under **Bandwidth Optimizations**.
7878

7979
Alternatively, you can use [Drush][4] to change this config setting:
8080

appengine/standard/errorreporting/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ or add the `auto_prepend_file` above to your local `php.ini`.
6262
Now run the sample locally using PHP's build-in web server:
6363

6464
```
65-
# export environemnt variables locally which are set by App Engine when deployed
65+
# export environment variables locally which are set by App Engine when deployed
6666
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
6767
export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID
6868
export GAE_SERVICE=local
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This file specifies files that are *not* uploaded to Google Cloud Platform
2+
# using gcloud. It follows the same syntax as .gitignore, with the addition of
3+
# "#!include" directives (which insert the entries of the given .gitignore-style
4+
# file at that point).
5+
#
6+
# For more information, run:
7+
# $ gcloud topic gcloudignore
8+
#
9+
.gcloudignore
10+
# If you would like to upload your .git directory, .gitignore file or files
11+
# from your .gitignore file, remove the corresponding line
12+
# below:
13+
.git
14+
.gitignore
15+
16+
# PHP Composer dependencies:
17+
/vendor/
18+
19+
# Files from phpize
20+
ext/Makefile.global
21+
ext/acinclude.m4
22+
ext/aclocal.m4
23+
ext/autom4te.cache/
24+
ext/config.guess
25+
ext/config.h.in
26+
ext/config.sub
27+
ext/configure
28+
ext/configure.ac
29+
ext/install-sh
30+
ext/ltmain.sh
31+
ext/missing
32+
ext/mkinstalldirs
33+
ext/run-tests.php
34+
35+
# Files from ./configure
36+
ext/Makefile
37+
ext/Makefile.fragments
38+
ext/Makefile.objects
39+
ext/config.h
40+
ext/config.log
41+
ext/config.nice
42+
ext/config.status
43+
ext/libtool
44+
45+
# Files from make
46+
ext/.libs/
47+
ext/modules/
48+
ext/*.la
49+
ext/*.lo
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Files from phpize
2+
ext/Makefile.global
3+
ext/acinclude.m4
4+
ext/aclocal.m4
5+
ext/autom4te.cache/
6+
ext/config.guess
7+
ext/config.h.in
8+
ext/config.sub
9+
ext/configure
10+
ext/configure.ac
11+
ext/install-sh
12+
ext/ltmain.sh
13+
ext/missing
14+
ext/mkinstalldirs
15+
ext/run-tests.php
16+
17+
# Files from ./configure
18+
ext/Makefile
19+
ext/Makefile.fragments
20+
ext/Makefile.objects
21+
ext/config.h
22+
ext/config.log
23+
ext/config.nice
24+
ext/config.status
25+
ext/libtool
26+
27+
# Files from make
28+
ext/.libs/
29+
ext/modules/
30+
ext/*.la
31+
ext/*.lo
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
runtime: php74
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"scripts": {
3+
"post-autoload-dump": [
4+
"cd ext && phpize --clean && phpize && ./configure && make",
5+
"cp ext/modules/my_custom_extension.so vendor/"
6+
]
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PHP_ARG_ENABLE(my_custom_extension, Whether to enable the MyCustomExtension extension, [ --enable-my-custom-extension Enable MyCustomExtension])
2+
3+
if test "$MY_CUSTOM_EXTENSION" != "no"; then
4+
PHP_NEW_EXTENSION(my_custom_extension, my_custom_extension.c, $ext_shared)
5+
fi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// include the PHP API itself
2+
#include
3+
// include the extension header
4+
#include "my_custom_extension.h"
5+
6+
// register the "helloworld_from_extension" function to the PHP API
7+
zend_function_entry my_custom_extension_functions[] = {
8+
PHP_FE(helloworld_from_extension, NULL)
9+
{NULL, NULL, NULL}
10+
};
11+
12+
// some information about our module
13+
zend_module_entry my_custom_extension_module_entry = {
14+
STANDARD_MODULE_HEADER,
15+
PHP_MY_CUSTOM_EXTENSION_EXTNAME,
16+
my_custom_extension_functions,
17+
NULL,
18+
NULL,
19+
NULL,
20+
NULL,
21+
NULL,
22+
PHP_MY_CUSTOM_EXTENSION_VERSION,
23+
STANDARD_MODULE_PROPERTIES
24+
};
25+
26+
// use a macro to output additional C code, to make ext dynamically loadable
27+
ZEND_GET_MODULE(my_custom_extension)
28+
29+
// Implement our "Hello World" function, which returns a string
30+
PHP_FUNCTION(helloworld_from_extension) {
31+
zval val;
32+
ZVAL_STRING(&val, "Hello World! (from my_custom_extension.so)\n");
33+
RETURN_STR(Z_STR(val));
34+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// module constants
2+
#define PHP_MY_CUSTOM_EXTENSION_EXTNAME "my_custom_extension"
3+
#define PHP_MY_CUSTOM_EXTENSION_VERSION "0.0.1"
4+
5+
// the function to be exported
6+
PHP_FUNCTION(helloworld_from_extension);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
3+
echo helloworld_from_extension();

appengine/standard/extensions/php.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=/workspace/vendor/my_custom_extension.so
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
/**
3+
* Copyright 2021 Google Inc.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
namespace Google\Cloud\Samples\AppEngine\HelloWorld;
18+
19+
use Google\Cloud\TestUtils\AppEngineDeploymentTrait;
20+
use PHPUnit\Framework\TestCase;
21+
22+
/**
23+
* @group deploy
24+
*/
25+
class DeployTest extends TestCase
26+
{
27+
use AppEngineDeploymentTrait;
28+
29+
public function testIndex()
30+
{
31+
$resp = $this->client->get('/');
32+
33+
$this->assertEquals(
34+
'200',
35+
$resp->getStatusCode(),
36+
'Top page status code should be 200'
37+
);
38+
39+
$this->assertStringContainsString(
40+
'Hello World! (from my_custom_extension.so)',
41+
(string) $resp->getBody()
42+
);
43+
}
44+
}

appengine/standard/grpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ been packaged with the Dev AppServer for PHP at this time. You can install gRPC
2929
locally and run them using PHP's build-in web server:
3030
3131
```
32-
# export environemnt variables locally which are set by app engine when deployed
32+
# export environment variables locally which are set by app engine when deployed
3333
export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID
3434
export GAE_INSTANCE=local
3535

appengine/standard/logging/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ in your browser. Browse to `/` to send in some logs.
5858
Run the sample locally using PHP's build-in web server:
5959
6060
```
61-
# export environemnt variables locally which are set by App Engine when deployed
61+
# export environment variables locally which are set by App Engine when deployed
6262
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
6363
export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID
6464

appengine/standard/memorystore/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Before you can run or deploy the sample, you will need to do the following:
2121

2222
1. Update the environment variables `REDIS_HOST` and `REDIS_PORT` in `app.yaml`
2323
with your configuration values. These values are used when the application is
24-
deployed. Run the following command to get the values for your isntance:
24+
deployed. Run the following command to get the values for your instance:
2525

2626
$ gcloud beta redis instances describe YOUR_INSTANCE_NAME --region=REGION_ID
2727

@@ -66,7 +66,7 @@ $ gcloud beta compute networks vpc-access connectors create CONNECTOR_NAME \
6666
--project=PROJECT_ID
6767
```
6868

69-
Next, you neded to [configure App Engine to connect to your VPC network][connecting-appengine].
69+
Next, you need to [configure App Engine to connect to your VPC network][connecting-appengine].
7070
This is done by modifying [`app.yaml`](app.yaml) and setting the full name of
7171
the connector you just created under `vpc_access_connector`.
7272

appengine/standard/tasks/apps/handler/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ in your browser. Browse to `/` to send in some logs.
3131
Run the sample locally using PHP's build-in web server:
3232
3333
```
34-
# export environemnt variables locally which are set by App Engine when deployed
34+
# export environment variables locally which are set by App Engine when deployed
3535
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
3636
export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID
3737

appengine/standard/trace/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ for PHP 7.2.
2121
You can run these samples locally using PHP's build-in web server:
2222
2323
```
24-
# export environemnt variables locally which are set by app engine when deployed
24+
# export environment variables locally which are set by app engine when deployed
2525
export GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID
2626
2727
# Run PHP's built-in web server

bigtable/src/create_cluster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function create_cluster(
9292
printf('Cluster created: %s', $clusterId);
9393
} else {
9494
$error = $operationResponse->getError();
95-
printf('Cluster not created: %s', $error);
95+
printf('Cluster not created: %s', $error->getMessage());
9696
}
9797
} else {
9898
throw $e;

cloud_sql/mysql/pdo/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Use these terminal commands to initialize other environment variables as well:
5050

5151
```bash
5252
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
53-
export CLOUD_SQL_CONNECTION_NAME='::'
53+
export INSTANCE_CONNECTION_NAME='::'
5454
export DB_USER=''
5555
export DB_PASS=''
5656
export DB_NAME=''
@@ -64,7 +64,7 @@ safe.
6464
Then use the following command to launch the proxy in the background:
6565

6666
```bash
67-
./cloud_sql_proxy -dir=$DB_SOCKET_DIR --instances=$CLOUD_SQL_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
67+
./cloud_sql_proxy -dir=$DB_SOCKET_DIR --instances=$INSTANCE_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
6868
```
6969

7070
### TCP mode
@@ -76,7 +76,7 @@ Use these terminal commands to initialize environment variables:
7676

7777
```bash
7878
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
79-
export CLOUD_SQL_CONNECTION_NAME='::'
79+
export INSTANCE_CONNECTION_NAME='::'
8080
export DB_HOST='127.0.0.1'
8181
export DB_USER=''
8282
export DB_PASS=''
@@ -91,7 +91,7 @@ safe.
9191
Then use the following command to launch the proxy in the background:
9292

9393
```bash
94-
./cloud_sql_proxy -instances=$CLOUD_SQL_CONNECTION_NAME=tcp:3306 -credential_file=$GOOGLE_APPLICAITON_CREDENTIALS &
94+
./cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:3306 -credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
9595
```
9696

9797
#### Windows/PowerShell

cloud_sql/mysql/pdo/app.flex.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env: flex
1919
# something like https://cloud.google.com/secret-manager/ to help keep secrets
2020
# secret.
2121
env_variables:
22-
CLOUD_SQL_CONNECTION_NAME: "::"
22+
INSTANCE_CONNECTION_NAME: "::"
2323
DB_USER: my-db-user
2424
DB_PASS: my-db-pass
2525
DB_NAME: my-db

cloud_sql/mysql/pdo/app.standard.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runtime: php74
1717
# Remember - storing secrets in plaintext is potentially unsafe. Consider using
1818
# something like https://cloud.google.com/secret-manager/ to help keep secrets secret.
1919
env_variables:
20-
CLOUD_SQL_CONNECTION_NAME: ::<MY-DATABASE>
20+
INSTANCE_CONNECTION_NAME: ::<INSTANCE-NAME>
2121
DB_USER: my-db-user
2222
DB_PASS: my-db-pass
2323
DB_NAME: my-db

cloud_sql/mysql/pdo/src/DBInitializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static function initUnixDatabaseConnection(
104104
// $username = 'your_db_user';
105105
// $password = 'yoursupersecretpassword';
106106
// $dbName = 'your_db_name';
107-
// $connectionName = getenv("CLOUD_SQL_CONNECTION_NAME");
107+
// $connectionName = getenv("INSTANCE_CONNECTION_NAME");
108108
// $socketDir = getenv('DB_SOCKET_DIR') ?: '/cloudsql';
109109

110110
// Connect using UNIX sockets

cloud_sql/postgres/pdo/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Use these terminal commands to initialize other environment variables as well:
5252

5353
```bash
5454
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
55-
export CLOUD_SQL_CONNECTION_NAME='::'
55+
export INSTANCE_CONNECTION_NAME='::'
5656
export DB_USER=''
5757
export DB_PASS=''
5858
export DB_NAME=''
@@ -66,21 +66,21 @@ safe.
6666
Then use the following command to launch the proxy in the background:
6767

6868
```bash
69-
./cloud_sql_proxy -dir=$DB_SOCKET_DIR --instances=$CLOUD_SQL_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
69+
./cloud_sql_proxy -dir=$DB_SOCKET_DIR --instances=$INSTANCE_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
7070
```
7171

7272
### TCP mode
7373

74-
To run the sample locally with a TCP conneciton, set environment variables and
74+
To run the sample locally with a TCP connection, set environment variables and
7575
launch the proxy as shown below.
7676

7777
#### Linux / macOS
7878

79-
Use these terminal commands to initalie environment variables:
79+
Use these terminal commands to initialize environment variables:
8080

8181
```bash
8282
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
83-
export CLOUD_SQL_CONNECTION_NAME='::'
83+
export INSTANCE_CONNECTION_NAME='::'
8484
export DB_HOST='127.0.0.1'
8585
export DB_USER=''
8686
export DB_PASS=''
@@ -95,7 +95,7 @@ safe.
9595
Then use the following command to launch the proxy in the background:
9696

9797
```bash
98-
./cloud_sql_proxy -instances=$CLOUD_SQL_CONNECTION_NAME=tcp:5432 -credential_file=$GOOGLE_APPLICAITON_CREDENTIALS &
98+
./cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:5432 -credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
9999
```
100100

101101
#### Windows/PowerShell
@@ -115,7 +115,7 @@ secure - consider a more secure solution such as
115115
[Secret Manager](https://cloud.google.com/secret-manager/) to help keep secrets
116116
safe.
117117
118-
Then use the following command to launch the proxy in a seperate PowerShell
118+
Then use the following command to launch the proxy in a separate PowerShell
119119
session:
120120
121121
```powershell

0 commit comments

Comments
 (0)