aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-03 09:52:03 +0100
committerChocobozzz <me@florianbigard.com>2021-12-03 10:14:17 +0100
commitca87d95bcbfec9241e5840267862bace8b0197fa (patch)
tree8cc01322ac3140e0ab191770cae0e03b84ab2bb9 /server/lib/plugins
parent8406a9e8eec261e563d99c92f8a18b6bd3e46e0f (diff)
downloadPeerTube-ca87d95bcbfec9241e5840267862bace8b0197fa.tar.gz
PeerTube-ca87d95bcbfec9241e5840267862bace8b0197fa.tar.zst
PeerTube-ca87d95bcbfec9241e5840267862bace8b0197fa.zip
Fix plugin upgrade
Correctly decache all plugin paths
Diffstat (limited to 'server/lib/plugins')
-rw-r--r--server/lib/plugins/plugin-manager.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index d4d2a7edc..8add72a85 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -1,8 +1,8 @@
1import decache from 'decache'
2import express from 'express' 1import express from 'express'
3import { createReadStream, createWriteStream } from 'fs' 2import { createReadStream, createWriteStream } from 'fs'
4import { ensureDir, outputFile, readJSON } from 'fs-extra' 3import { ensureDir, outputFile, readJSON } from 'fs-extra'
5import { basename, join } from 'path' 4import { basename, join } from 'path'
5import { decachePlugin } from '@server/helpers/decache'
6import { MOAuthTokenUser, MUser } from '@server/types/models' 6import { MOAuthTokenUser, MUser } from '@server/types/models'
7import { getCompleteLocale } from '@shared/core-utils' 7import { getCompleteLocale } from '@shared/core-utils'
8import { ClientScript, PluginPackageJson, PluginTranslation, PluginTranslationPaths, RegisterServerHookOptions } from '@shared/models' 8import { ClientScript, PluginPackageJson, PluginTranslation, PluginTranslationPaths, RegisterServerHookOptions } from '@shared/models'
@@ -312,12 +312,12 @@ export class PluginManager implements ServerHook {
312 logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr }) 312 logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr })
313 313
314 try { 314 try {
315 await this.uninstall(npmName) 315 // await this.uninstall(npmName)
316 } catch (err) { 316 } catch (err) {
317 logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err }) 317 logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err })
318 318
319 try { 319 try {
320 await removeNpmPlugin(npmName) 320 // await removeNpmPlugin(npmName)
321 } catch (err) { 321 } catch (err) {
322 logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) 322 logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err })
323 } 323 }
@@ -420,7 +420,7 @@ export class PluginManager implements ServerHook {
420 420
421 // Delete cache if needed 421 // Delete cache if needed
422 const modulePath = join(pluginPath, packageJSON.library) 422 const modulePath = join(pluginPath, packageJSON.library)
423 decache(modulePath) 423 decachePlugin(pluginPath, modulePath)
424 const library: PluginLibrary = require(modulePath) 424 const library: PluginLibrary = require(modulePath)
425 425
426 if (!isLibraryCodeValid(library)) { 426 if (!isLibraryCodeValid(library)) {