Skip to content

Commit

Permalink
Don't use plugin model in updatedb helper
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Sep 16, 2021
1 parent 43025b7 commit e4cccb5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -4914,14 +4914,20 @@ function ($v) {
$dir = new DirectoryIterator(APPPATH . DIRECTORY_SEPARATOR . 'core' . DIRECTORY_SEPARATOR . 'plugins');
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$plugin = Plugin::model()->findByAttributes(
['name' => $fileinfo->getFilename()]
);
$plugin = $oDB->createCommand()
->select('*')
->from('{{plugins}}')
->where("name = :name", [':name' => $fileinfo->getFilename()]);
->queryRow();

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Sep 17, 2021

Collaborator

queryRow return an array …

Then Trying to get property 'plugin_type' of non-object with debug set …
And nothing fixed (i think) without debug.


if (!empty($plugin)) {
if ($plugin->plugin_type !== 'core') {
$plugin->plugin_type = 'core';
$plugin->save();
$oDB->createCommand()->update(
'{{plugins}}',
['plugin_type' => 'core'],
'name = :name',
[':name' => $plugin->name]
);
}
} else {
// Plugin in folder but not in database?
Expand Down

3 comments on commit e4cccb5

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

                    if (!empty($plugin)) {
                        if ($plugin['plugin_type'] == 'core') {
                            $oDB->createCommand()->update(
                                '{{plugins}}',
                                ['plugin_type' => 'core'],
                                'name = :name',
                                [':name' => $plugin['name']]
                            );
                        }

@olleharstedt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, I changed it for $plugin['name'] but forgot that one, thank you.

@olleharstedt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

                    if ($plugin['plugin_type'] == 'core') { 

should be

                    if ($plugin['plugin_type'] !== 'core') {

Please sign in to comment.