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

Install failed, if installed with Project ID #26

Closed
mediaclinic opened this issue May 25, 2020 · 6 comments
Closed

Install failed, if installed with Project ID #26

mediaclinic opened this issue May 25, 2020 · 6 comments

Comments

@mediaclinic
Copy link

Interesting failure: with the latest version, tried to install new OctoberCMS site via ProjectID (I have project setup with Image Resize plugin) and get this error:

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from system_settings where item = abwebdevelopers_imageresize limit 1)

If I remove it from project, installation works without error.

@bradietilley
Copy link
Contributor

bradietilley commented May 26, 2020

@bennothommo Do you think this could have something to do with the migration ClearOldCacheDir? This migration references the plugin's settings, but perhaps at this stage (during installation) the settings do not exist...

That's the only recent change I can think of that would cause this issue.

Perhaps I can wrap the migration in:

if (DB::table('system_settings')->where('item', 'abwebdevelopers_imageresize')->exists()) {
    // Now you can safely reference the plugin's settings here?
}

@mediaclinic I'll release a fix for this today, if I can confirm that my guess above is correct

@bennothommo
Copy link
Contributor

@bradietilley yeah that's probably it - I've had the same issue crop up sometimes when I'm starting a new install through Composer, and the database is available but the migrations have not yet been run. It usually works if I disable the plugin and then re-enable it afterwards, as @mediaclinic indicated.

@bradietilley
Copy link
Contributor

bradietilley commented May 26, 2020

I have updated the migration so that it wraps the migration code in a existence check on the plugin's settings.

@mediaclinic Can you please try with v2.1.6?

@mediaclinic
Copy link
Author

mediaclinic commented May 26, 2020

Did not help. Here is the install.log, if it helps a bit:

[2020/05/26 11:28:37] Install step: setupConfig
[2020/05/26 11:28:37] Handler error (onInstallStep): SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from `system_settings` where `item` = abwebdevelopers_imageresize limit 1)
[2020/05/26 11:28:37] Trace log:
#0 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#1 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#2 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1719): Illuminate\Database\Connection->select('select * from `...', Array, true)
#3 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1704): Illuminate\Database\Query\Builder->runSelect()
#4 /var/www/clients/client3/web15/web/vendor/october/rain/src/Database/QueryBuilder.php(217): Illuminate\Database\Query\Builder->get(Array)
#5 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(323): October\Rain\Database\QueryBuilder->October\Rain\Database\{closure}()
#6 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(304): Illuminate\Cache\Repository->remember('system::setting...', 1440, Object(Closure))
#7 /var/www/clients/client3/web15/web/vendor/october/rain/src/Database/QueryBuilder.php(158): Illuminate\Cache\CacheManager->__call('remember', Array)
#8 /var/www/clients/client3/web15/web/vendor/october/rain/src/Database/QueryBuilder.php(121): October\Rain\Database\QueryBuilder->getCached(Array)
#9 /var/www/clients/client3/web15/web/vendor/october/rain/src/Database/QueryBuilder.php(92): October\Rain\Database\QueryBuilder->getDuplicateCached(Array)
#10 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(481): October\Rain\Database\QueryBuilder->get(Array)
#11 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(465): Illuminate\Database\Eloquent\Builder->getModels(Array)
#12 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(77): Illuminate\Database\Eloquent\Builder->get(Array)
#13 /var/www/clients/client3/web15/web/modules/system/behaviors/SettingsModel.php(114): Illuminate\Database\Eloquent\Builder->first()
#14 /var/www/clients/client3/web15/web/modules/system/behaviors/SettingsModel.php(76): System\Behaviors\SettingsModel->getSettingsRecord()
#15 [internal function]: System\Behaviors\SettingsModel->instance()
#16 /var/www/clients/client3/web15/web/vendor/october/rain/src/Extension/ExtendableTrait.php(411): call_user_func_array(Array, Array)
#17 /var/www/clients/client3/web15/web/vendor/october/rain/src/Database/Model.php(648): October\Rain\Database\Model->extendableCall('instance', Array)
#18 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1489): October\Rain\Database\Model->__call('instance', Array)
#19 /var/www/clients/client3/web15/web/plugins/abwebdevelopers/imageresize/models/Settings.php(282): Illuminate\Database\Eloquent\Model::__callStatic('instance', Array)
#20 /var/www/clients/client3/web15/web/plugins/abwebdevelopers/imageresize/Plugin.php(95): ABWebDevelopers\ImageResize\Models\Settings::cleanupOnCacheClear()
#21 /var/www/clients/client3/web15/web/modules/system/classes/PluginManager.php(295): ABWebDevelopers\ImageResize\Plugin->boot()
#22 /var/www/clients/client3/web15/web/modules/system/classes/PluginManager.php(277): System\Classes\PluginManager->bootPlugin(Object(ABWebDevelopers\ImageResize\Plugin))
#23 /var/www/clients/client3/web15/web/modules/system/ServiceProvider.php(102): System\Classes\PluginManager->bootAll()
#24 [internal function]: System\ServiceProvider->boot()
#25 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#26 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#27 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(October\Rain\Foundation\Application), Array, Object(Closure))
#28 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\Container\BoundMethod::call(Object(October\Rain\Foundation\Application), Array, Array, NULL)
#29 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(792): Illuminate\Container\Container->call(Array)
#30 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Foundation\Application->bootProvider(Object(System\ServiceProvider))
#31 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(System\ServiceProvider), 24)
#32 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): array_walk(Array, Object(Closure))
#33 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#34 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(213): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(October\Rain\Foundation\Application))
#35 /var/www/clients/client3/web15/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(296): Illuminate\Foundation\Application->bootstrapWith(Array)
#36 /var/www/clients/client3/web15/web/install_files/php/Installer.php(696): Illuminate\Foundation\Console\Kernel->bootstrap()
#37 /var/www/clients/client3/web15/web/install_files/php/Installer.php(412): Installer->bootFramework()
#38 /var/www/clients/client3/web15/web/install_files/php/Installer.php(378): Installer->buildConfigFile()
#39 /var/www/clients/client3/web15/web/install_files/php/Installer.php(48): Installer->onInstallStep()
#40 /var/www/clients/client3/web15/web/install_files/php/boot.php(91): Installer->__construct()
#41 /var/www/clients/client3/web15/web/install.php(1): include('/var/www/client...')
#42 {main}

@bradietilley
Copy link
Contributor

bradietilley commented May 27, 2020

@mediaclinic Thanks for that.

Ben and I investigated it further and found that October will boot all of the plugins even when no database connection is configured, i.e. during installation, as demonstrated by your error log's stack trace. We have also noticed this issue on other plugins that reference Settings in the boot method.

In the latest release, I have wrapped the event callback in try/catch which tests the database connection by checking the existence of the system_settings table.

If you update to v2.1.7 this issue should be resolved.

@mediaclinic
Copy link
Author

This works like a charm!

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

No branches or pull requests

3 participants