Update any references to reading ee file. Update code style. Update prefix of key for workspace specific.

This commit is contained in:
Taylor Dondich
2019-12-09 11:46:30 -08:00
parent ee0ea57680
commit 92b850b0a6
4 changed files with 28 additions and 9 deletions

View File

@@ -166,8 +166,14 @@ class PmLicenseManager
} }
} }
if (file_exists(PATH_DATA_SITE . "ee")) { $eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
$aPlugins = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee'))); if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$aPlugins = unserialize($eeData);
$aDenied = []; $aDenied = [];
foreach ($aPlugins as $aPlugin) { foreach ($aPlugins as $aPlugin) {
$sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-')); $sClassName = substr($aPlugin ['sFilename'], 0, strpos($aPlugin ['sFilename'], '-'));

View File

@@ -354,8 +354,14 @@ class AddonsStore extends BaseAddonsStore
$oPluginRegistry = PluginRegistry::loadSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
$aPluginsPP = array(); $aPluginsPP = array();
if (file_exists(PATH_DATA_SITE . 'ee')) { $eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
$aPluginsPP = unserialize(trim(file_get_contents(PATH_DATA_SITE . 'ee'))); if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$aPluginsPP = unserialize($eeData);
} }
$pmLicenseManagerO = PmLicenseManager::getSingleton(); $pmLicenseManagerO = PmLicenseManager::getSingleton();

View File

@@ -1500,8 +1500,14 @@ class adminProxy extends HttpProxyController
//Installed Plugins (license info?) //Installed Plugins (license info?)
$arrayAddon = array(); $arrayAddon = array();
if (file_exists(PATH_DATA_SITE . "ee")) { $eeData = Cache::get(config('system.workspace') . 'enterprise.ee', function () {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee"))); if (file_exists(PATH_DATA_SITE . 'ee')) {
return trim(file_get_contents(PATH_DATA_SITE . 'ee'));
}
return null;
});
if ($eeData) {
$arrayAddon = unserialize($eeData);
} }
$plugins = array(); $plugins = array();

View File

@@ -215,13 +215,14 @@ class enterprisePlugin extends PMPlugin
*/ */
public function registerEE($pluginFile, $pluginVersion) public function registerEE($pluginFile, $pluginVersion)
{ {
$cacheKey = config('system.workspace') . 'enterprise.ee';
// Fetch the value from cache. If not present, fetch from the filesystem. // Fetch the value from cache. If not present, fetch from the filesystem.
$value = Cache::get('enterprise.ee', function () { $value = Cache::get($cacheKey, function () {
if (file_exists(PATH_DATA_SITE . "ee")) { if (file_exists(PATH_DATA_SITE . "ee")) {
return trim(file_get_contents(PATH_DATA_SITE . "ee")); return trim(file_get_contents(PATH_DATA_SITE . "ee"));
} }
}); });
if($value) { if ($value) {
$this->systemAvailable = unserialize($value); $this->systemAvailable = unserialize($value);
} else { } else {
// Handle potential no value // Handle potential no value
@@ -240,7 +241,7 @@ class enterprisePlugin extends PMPlugin
$this->systemAvailable[$pluginFile]["sFilename"] = $filename; $this->systemAvailable[$pluginFile]["sFilename"] = $filename;
file_put_contents(PATH_DATA_SITE . "ee", serialize($this->systemAvailable)); file_put_contents(PATH_DATA_SITE . "ee", serialize($this->systemAvailable));
// Put in cache as well // Put in cache as well
Cache::forever('enterprise.ee', serialize($this->systemAvailable)); Cache::forever($cacheKey, serialize($this->systemAvailable));
} }
return true; return true;
} }