Skip to content

Commit 5981fc4

Browse files
authored
Merge branch 'main' into bump-auth-dep
2 parents c037533 + e009e9c commit 5981fc4

5 files changed

Lines changed: 37 additions & 34 deletions

File tree

.github/workflows/asset-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Add Release Assets
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
67

78
jobs:
89
asset:

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [2.18.3](https://github.com/googleapis/google-api-php-client/compare/v2.18.2...v2.18.3) (2025-04-08)
4+
5+
6+
### Bug Fixes
7+
8+
* Convert Finder lazy iterator to array before deletion ([#2663](https://github.com/googleapis/google-api-php-client/issues/2663)) ([c699405](https://github.com/googleapis/google-api-php-client/commit/c6994051af1568359c97d267d9ef34ccbda31387))
9+
310
## [2.18.2](https://github.com/googleapis/google-api-php-client/compare/v2.18.1...v2.18.2) (2024-12-16)
411

512

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ composer installed.
4444
Once composer is installed, execute the following command in your project root to install this library:
4545

4646
```sh
47-
composer require google/apiclient:^2.15.0
47+
composer require google/apiclient
4848
```
4949

5050
If you're facing a timeout error then either increase the timeout for composer by adding the env flag as `COMPOSER_PROCESS_TIMEOUT=600 composer install` or you can put this in the `config` section of the composer schema:

examples/README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,3 @@
1010
```
1111
1212
1. Point your browser to the host and port you specified, i.e `http://localhost:8000`.
13-
14-
## G Suite OAuth Samples
15-
16-
G Suite APIs such as Slides, Sheets, and Drive use 3-legged OAuth authentification.
17-
Samples using OAuth can be found here:
18-
19-
https://github.com/gsuitedevs/php-samples

src/Task/Composer.php

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,37 @@ public static function cleanup(
3434
) {
3535
$composer = $event->getComposer();
3636
$extra = $composer->getPackage()->getExtra();
37-
$servicesToKeep = isset($extra['google/apiclient-services'])
38-
? $extra['google/apiclient-services']
39-
: [];
40-
if ($servicesToKeep) {
41-
$vendorDir = $composer->getConfig()->get('vendor-dir');
37+
$servicesToKeep = $extra['google/apiclient-services'] ?? [];
38+
if (empty($servicesToKeep)) {
39+
return;
40+
}
41+
$vendorDir = $composer->getConfig()->get('vendor-dir');
42+
$serviceDir = sprintf(
43+
'%s/google/apiclient-services/src/Google/Service',
44+
$vendorDir
45+
);
46+
if (!is_dir($serviceDir)) {
47+
// path for google/apiclient-services >= 0.200.0
4248
$serviceDir = sprintf(
43-
'%s/google/apiclient-services/src/Google/Service',
49+
'%s/google/apiclient-services/src',
4450
$vendorDir
4551
);
46-
if (!is_dir($serviceDir)) {
47-
// path for google/apiclient-services >= 0.200.0
48-
$serviceDir = sprintf(
49-
'%s/google/apiclient-services/src',
50-
$vendorDir
51-
);
52-
}
53-
self::verifyServicesToKeep($serviceDir, $servicesToKeep);
54-
$finder = self::getServicesToRemove($serviceDir, $servicesToKeep);
55-
$filesystem = $filesystem ?: new Filesystem();
56-
if (0 !== $count = count($finder)) {
57-
$event->getIO()->write(
58-
sprintf('Removing %s google services', $count)
59-
);
60-
foreach ($finder as $file) {
61-
$realpath = $file->getRealPath();
62-
$filesystem->remove($realpath);
63-
$filesystem->remove($realpath . '.php');
64-
}
65-
}
52+
}
53+
self::verifyServicesToKeep($serviceDir, $servicesToKeep);
54+
$finder = self::getServicesToRemove($serviceDir, $servicesToKeep);
55+
$filesystem = $filesystem ?: new Filesystem();
56+
$servicesToRemoveCount = $finder->count();
57+
if (0 === $servicesToRemoveCount) {
58+
return;
59+
}
60+
$event->getIO()->write(
61+
sprintf('Removing %d google services', $servicesToRemoveCount)
62+
);
63+
$pathsToRemove = iterator_to_array($finder);
64+
foreach ($pathsToRemove as $pathToRemove) {
65+
$realpath = $pathToRemove->getRealPath();
66+
$filesystem->remove($realpath);
67+
$filesystem->remove($realpath . '.php');
6668
}
6769
}
6870

0 commit comments

Comments
 (0)