Skip to content

Commit

Permalink
fix: set update to no for disabled and deleted plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit1290 committed Feb 6, 2020
1 parent 62d04d0 commit 195338f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions classes/CheckForUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ public function activate() {
$path = dirname(dirname(__FILE__))."/db/check_for_update.sql";
_elgg_services()->db->runSqlScript($path);
}

public function upgrade() {
$dbprefix = elgg_get_config('dbprefix');
$dbrows = elgg()->db->getData("SELECT * FROM `{$dbprefix}check_for_update` WHERE `check_update`='yes' AND `github_url` <> ''");
foreach ($dbrows as $dbrow) {
$plugin_id = $dbrow->plugin_id;
$plugin = elgg_get_plugin_from_id($plugin_id);

if ($plugin == null) {
elgg()->db->updateData("UPDATE `{$dbprefix}check_for_update` SET `check_update`='no' WHERE `plugin_id`='$plugin_id'");
continue;
}

if (!is_dir($plugin->getPath())) {
elgg()->db->updateData("UPDATE `{$dbprefix}check_for_update` SET `check_update`='no' WHERE `plugin_id`='$plugin_id'");
continue;
}
}
}

}

Expand Down

0 comments on commit 195338f

Please sign in to comment.