diff options
author | redmatrix <git@macgirvin.com> | 2016-05-10 21:11:35 +1000 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-10 21:11:35 +1000 |
commit | 40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (patch) | |
tree | 8267b5452fb67e8a105d669a8c867a146f14d24b /Zotlabs/Module/Admin.php | |
parent | 45c19e365d8b73c8623f5d1c65b528cd628374a5 (diff) | |
parent | 78b40e6363d422727bb716f5e72983291c75d217 (diff) | |
download | volse-hubzilla-40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb.tar.gz volse-hubzilla-40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb.tar.bz2 volse-hubzilla-40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb.zip |
Merge pull request #374 from anaqreon/plugin-repo
Delete existing repo if the new one has a different URL. Fixed bug th…
Diffstat (limited to 'Zotlabs/Module/Admin.php')
-rw-r--r-- | Zotlabs/Module/Admin.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 63f3e77f0..1b98a2ced 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1822,6 +1822,15 @@ class Admin extends \Zotlabs\Web\Controller { // clone the repo if new automatically $git = new GitRepo('sys', $repoURL, true, $repoName, $repoDir); + $remotes = $git->git->remote(); + $fetchURL = $remotes['origin']['fetch']; + if($fetchURL !== $git->url) { + if(rrmdir($repoDir)) { + $git = new GitRepo('sys', $repoURL, true, $repoName, $repoDir); + } else { + json_return_and_die(array('message' => 'Error deleting existing addon repo.', 'success' => false)); + } + } $repo = $git->probeRepo(); $repo['readme'] = $repo['manifest'] = null; foreach ($git->git->tree('master') as $object) { |