mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
Fixed startup.
This commit is contained in:
parent
b652fa60c3
commit
d5920fa0ef
1 changed files with 30 additions and 18 deletions
|
@ -83,9 +83,15 @@ const migratePluginsFromNodeModules = async () => {
|
||||||
|
|
||||||
export const checkForMigration = async () => {
|
export const checkForMigration = async () => {
|
||||||
logger.info('check installed plugins for migration');
|
logger.info('check installed plugins for migration');
|
||||||
const files = await fs.readdir(pluginInstallPath);
|
|
||||||
|
|
||||||
const node_modules = path.join(findEtherpadRoot(),'src', 'node_modules');
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fs.access(installedPluginsPath, fs.constants.F_OK);
|
||||||
|
} catch (err) {
|
||||||
|
await migratePluginsFromNodeModules();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the plugin is already installed in node_modules
|
* Check if the plugin is already installed in node_modules
|
||||||
* If not, create a symlink to node_modules
|
* If not, create a symlink to node_modules
|
||||||
|
@ -93,6 +99,12 @@ export const checkForMigration = async () => {
|
||||||
* 1. Live Plugin Manager does not support loading plugins from the directory so that node can access them normally
|
* 1. Live Plugin Manager does not support loading plugins from the directory so that node can access them normally
|
||||||
* 2. Plugins can't be directly installed to node_modules otherwise upgrading Etherpad will remove them
|
* 2. Plugins can't be directly installed to node_modules otherwise upgrading Etherpad will remove them
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
fs.stat(pluginInstallPath).then(async (err) => {
|
||||||
|
const files = await fs.readdir(pluginInstallPath);
|
||||||
|
|
||||||
|
const node_modules = path.join(findEtherpadRoot(),'src', 'node_modules');
|
||||||
for (let file of files){
|
for (let file of files){
|
||||||
const moduleName = path.basename(file);
|
const moduleName = path.basename(file);
|
||||||
try {
|
try {
|
||||||
|
@ -104,13 +116,7 @@ export const checkForMigration = async () => {
|
||||||
await fs.symlink(path.join(pluginInstallPath,file), path.join(node_modules,moduleName), 'dir')
|
await fs.symlink(path.join(pluginInstallPath,file), path.join(node_modules,moduleName), 'dir')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
try {
|
|
||||||
await fs.access(installedPluginsPath, fs.constants.F_OK);
|
|
||||||
} catch (err) {
|
|
||||||
await migratePluginsFromNodeModules();
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileContent = await fs.readFile(installedPluginsPath);
|
const fileContent = await fs.readFile(installedPluginsPath);
|
||||||
const installedPlugins = JSON.parse(fileContent.toString());
|
const installedPlugins = JSON.parse(fileContent.toString());
|
||||||
|
|
||||||
|
@ -138,7 +144,13 @@ const persistInstalledPlugins = async () => {
|
||||||
export const uninstall = async (pluginName: string, cb:Function|null = null) => {
|
export const uninstall = async (pluginName: string, cb:Function|null = null) => {
|
||||||
cb = wrapTaskCb(cb);
|
cb = wrapTaskCb(cb);
|
||||||
logger.info(`Uninstalling plugin ${pluginName}...`);
|
logger.info(`Uninstalling plugin ${pluginName}...`);
|
||||||
|
//TODO track if a dependency is used by another plugin
|
||||||
|
const plugins = manager.list();
|
||||||
|
const info = manager.getInfo(pluginName)
|
||||||
await manager.uninstall(pluginName);
|
await manager.uninstall(pluginName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger.info(`Successfully uninstalled plugin ${pluginName}`);
|
logger.info(`Successfully uninstalled plugin ${pluginName}`);
|
||||||
await hooks.aCallAll('pluginUninstall', {pluginName});
|
await hooks.aCallAll('pluginUninstall', {pluginName});
|
||||||
cb(null);
|
cb(null);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue