Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'Google_Client' not found #67

Closed
ghost opened this issue Aug 5, 2017 · 14 comments
Closed

Class 'Google_Client' not found #67

ghost opened this issue Aug 5, 2017 · 14 comments

Comments

@ghost
Copy link

ghost commented Aug 5, 2017

An error Class 'Google_Client' not found appears on the dashboard, after adding statistics panel...

image

Google Analytics version 1.2.1
October build 419

@Daugirdas
Copy link

You need to install Google APIs Client Library for PHP

@ametad
Copy link
Contributor

ametad commented Aug 8, 2017

How did you install the plugin?

@Daugirdas it should have installed the lib automatically.

@woodinteractive
Copy link

woodinteractive commented Aug 10, 2017

@ametad some problem here. Ran the Client Library install. No change.
screen shot 2017-08-09 at 7 32 41 pm

@ametad
Copy link
Contributor

ametad commented Aug 10, 2017

@woodinteractive I am sorry, I don't understand what "Client Library install" means. Could you explain?

When you install this plugin through the backend in OctoberCMS or on the command line with:

$ php artisan plugin:install rainlab.googleanalytics

Then the dependencies are installed also.

It will NOT work when you just copy the files from this repository in your plugins/ directory. Because the dependencies must be retrieved in the installation process.

@Daugirdas
Copy link

Dependencies are other OctoberCMS plugins. Google APIs Client Library for PHP is not. To install follow instructions on github. I personally installed it in app root folder with
composer require google/apiclient:^2.0
That's it.

@ghost
Copy link
Author

ghost commented Aug 10, 2017

@ametad I installed the plugin with the october backend installer...
to solve that problem, I copied composer.json from the google analytics plugin repository
into the google analytics plugin (because the file was missing), then I ran composer update from project root

@ametad
Copy link
Contributor

ametad commented Aug 10, 2017

@dunets You did install it with the backend... well that is strange(!) it didnot install the composer dependencies. Because that is the way it works normally. This could be a bug.

@ghost
Copy link
Author

ghost commented Aug 10, 2017

@ametad yes on my local development everything works well, but not on a production server... I need to install many things manually with composer and I have bugs like that...

@ametad
Copy link
Contributor

ametad commented Aug 10, 2017

What is the difference between your local and production? I think there lies the answer to your problems...

@ametad
Copy link
Contributor

ametad commented Aug 10, 2017

Hmm... The last install I did was about three month ago, no problems then.
But now I have this problem too of the missing Google_Client Class!

I did:

  • a clean install of October build 419
  • then installed this plugin
  • configured the settings
  • added an analytics widget to the dashboard

The problem is indeed that for some reason the dependencies are not installed properly in this new installation. Unlike previous installations where the Google_Client class is just to be found!

I am not sure what the problem is... because before, I have seen a 'vendor' map here: plugins/rainlab/googleanalytics/vendor
But this vendor map is not there anymore on a clean install...

So what is going on here?

@ametad
Copy link
Contributor

ametad commented Aug 10, 2017

When I make a plugin and submit it to the OC Market, it is without vendor map (and with composer.json). But when this plugin is installed on a october instance, the vendor map has been included in the folder where the plugin resides.

I must admit; I don't know exactly how this vendor map in the plugin's directory has got there?!

@ametad
Copy link
Contributor

ametad commented Aug 17, 2017

https://stackoverflow.com/questions/45622700

Answer is that the vendor map in the plugins folder should be there.

@LukeTowers
Copy link
Contributor

The octobercms.com marketplace build process pulls in the plugin’s dependencies into a vendor directory under the plugin’s own directory and then removes composer.lock and composer.json from the package that gets generated. This is to support users that don’t use composer while also supporting users that use both marketplace plugins and composer-based plugins.

If we left the composer.json in the plugin during the build process and then the user were to run composer update from the project root on that marketplace plugin, suddenly they would have duplicated dependencies which was causing a lot of issues.

All of this to say: Don't include your vendor directory when submitting a plugin to the marketplace, the marketplace will take care of that. Do include your composer.json file though.

In regards to RainLab.GoogleAnalytics, the build on the marketplace appears to be broken which means that it needs to be rebuilt on the marketplace. This could be triggered by pushing an update to the Github repository, which I haven't been able to until @ametad pointed out that adblockers occasionally cause problems with Github repositories.

@LukeTowers
Copy link
Contributor

This should be fixed now that the marketplace has rebuilt the plugin for the last version release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants