Modify autoload for hitting disc and checking is file existing
The autoload was originally introduced in Pull Request #363 for supporting legacy classes.
Main idea is to avoid hitting disc which is done with calling file_exists(__DIR__ . '/../apiclient/src/Google/Client.php') and looking for a file, which in case that a newer version of google/apiclient than 2.7.2 results with failing check, specifically it looks for file vendor/google/apiclient-services/../apiclient/src/Google/Client.php and that results with no such file or directory.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!
-- conventional-commit-lint bot https://conventionalcommits.org/
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
If I understand the problem correctly, I think the best solution would be to just move toa new major (3.0) version of this library and remove the legacy namespaces.
To which new major (3.0) version you are exactly referring?
Ping @bshaffer ^ :)
@bojanpejic it would be a new major version of the library we haven't released yet, where we would remove these autoload.php files.
Just so we are clear, @bojanpejic and @umpirsky and anyone else following this PR...
If you update your code to use the new namespaces (e.g. Google\Client and Google\Service\ServiceName), these hits to disc will not happen. They only take place when using the LEGACY classnames (e.g. Google_Client and Google_Service_ServiceName)
We updated the codebase to use new namespaces and we still see:
90220 php-fpm RET __getcwd 0
90220 php-fpm CALL access(0x73a8f48,0<F_OK>)
90220 php-fpm NAMI "/www/sites/.../vendor/google/apiclient-services/../apiclient/src/Google/Client.php"
90220 php-fpm RET access -1 errno 2 No such file or directory