From 77eb9bcfa04faee0fbf20a1d9fae90bdf0dcbcc3 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Wed, 18 May 2016 21:32:23 -0400 Subject: Link new plugins when updating repos via admin/plugins --- Zotlabs/Module/Admin.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Zotlabs/Module/Admin.php') diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 9b54a4081..cb843e212 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1758,6 +1758,18 @@ class Admin extends \Zotlabs\Web\Controller { $git = new GitRepo('sys', null, false, $repoName, $repoDir); try { if ($git->pull()) { + $files = array_diff(scandir($repoDir), array('.', '..')); + foreach ($files as $file) { + if (is_dir($repoDir . '/' . $file) && $file !== '.git') { + $source = '../extend/addon/' . $repoName . '/' . $file; + $target = realpath(__DIR__ . '/../../addon/') . '/' . $file; + unlink($target); + if (!symlink($source, $target)) { + logger('Error linking addons to /addon'); + json_return_and_die(array('message' => 'Error linking addons to /addon', 'success' => false)); + } + } + } json_return_and_die(array('message' => 'Repo updated.', 'success' => true)); } else { json_return_and_die(array('message' => 'Error updating addon repo.', 'success' => false)); -- cgit v1.2.3