Skip to content

Commit

Permalink
https://github.com/WWBN/AVideo/issues/4190#issuecomment-747702349
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielnetoDotCom committed Dec 17, 2020
1 parent 60dbb0a commit 14f030a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions objects/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ static function getPluginByUUID($uuid) {
ObjectYPT::setCache($name, $getPluginByUUID[$uuid]);
} else {
$name = AVideoPlugin::getPluginsNameOnByDefaultFromUUID($uuid);
if($name!==false && empty($pluginJustInstalled[$uuid])){
if ($name !== false && empty($pluginJustInstalled[$uuid])) {
$pluginJustInstalled[$uuid] = 1;
_error_log("plugin::getPluginByUUID {$name} {$uuid} this plugin is On By Default we will install it ($sql)");
self::deleteByUUID($uuid);
$getPluginByUUID[$uuid] = self::getOrCreatePluginByName($name, 'active');
}else{
} else {
$getPluginByUUID[$uuid] = false;
}
}
Expand Down Expand Up @@ -231,7 +232,7 @@ static function getAvailablePlugins($comparePluginVersion = false) {
$obj->pluginversion = $p->getPluginVersion();
$obj->pluginversionMarketPlace = (!empty($pluginsMarketplace->plugins->{$obj->uuid}) ? $pluginsMarketplace->plugins->{$obj->uuid}->pluginversion : 0);
$obj->pluginversionCompare = (!empty($obj->pluginversionMarketPlace) ? version_compare($obj->pluginversion, $obj->pluginversionMarketPlace) : 0);
$obj->permissions = $obj->enabled?Permissions::getPluginPermissions($obj->id):array();
$obj->permissions = $obj->enabled ? Permissions::getPluginPermissions($obj->id) : array();
$obj->isPluginTablesInstalled = AVideoPlugin::isPluginTablesInstalled($obj->name, false);
if ($obj->pluginversionCompare < 0) {
$obj->tags[] = "update";
Expand Down Expand Up @@ -281,7 +282,7 @@ static function getDatabaseFile($pluginName) {

static function getDatabaseFileName($pluginName) {
global $global;

$pluginName = AVideoPlugin::fixName($pluginName);
$dir = $global['systemRootPath'] . "plugin";
$filename = $dir . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . "install" . DIRECTORY_SEPARATOR . "install.sql";
Expand Down Expand Up @@ -383,6 +384,18 @@ static function getEnabled($uuid) {
return $getEnabled[$uuid];
}

static function deleteByUUID($uuid) {
global $global;
if (!empty($uuid)) {
$sql = "DELETE FROM " . static::getTableName() . " ";
$sql .= " WHERE uuid = ?";
$global['lastQuery'] = $sql;
//_error_log("Delete Query: ".$sql);
return sqlDAL::writeSql($sql, "s", array($uuid));
}
return false;
}

static function getOrCreatePluginByName($name, $statusIfCreate = 'inactive') {
global $global;
if (self::getPluginByName($name) === false) {
Expand Down

0 comments on commit 14f030a

Please sign in to comment.