diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-09 21:17:47 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-09 21:17:47 -0400 |
commit | 180731c162b12f62a0065bc9ce8d537a95c98ed6 (patch) | |
tree | 58203102a57754985863097bee069512f1971bf7 /Zotlabs | |
parent | d714cd76dd4f38f7a04c7f9fbded427d7b06d3a8 (diff) | |
download | volse-hubzilla-180731c162b12f62a0065bc9ce8d537a95c98ed6.tar.gz volse-hubzilla-180731c162b12f62a0065bc9ce8d537a95c98ed6.tar.bz2 volse-hubzilla-180731c162b12f62a0065bc9ce8d537a95c98ed6.zip |
copy-paste error
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Admin.php | 20 | ||||
-rw-r--r-- | Zotlabs/Storage/GitRepo.php | 4 |
2 files changed, 23 insertions, 1 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 404585ccd..19b8a2e77 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -51,6 +51,10 @@ class Admin extends \Zotlabs\Web\Controller { $this->admin_page_plugins_post('removerepo'); break; } + if (argc() > 2 && argv(2) === 'updaterepo') { + $this->admin_page_plugins_post('updaterepo'); + break; + } if (argc() > 2 && is_file("addon/" . argv(2) . "/" . argv(2) . ".php")){ @include_once("addon/" . argv(2) . "/" . argv(2) . ".php"); @@ -1714,6 +1718,22 @@ class Admin extends \Zotlabs\Web\Controller { function admin_page_plugins_post($action) { switch($action) { + case 'updaterepo': + if(array_key_exists('repoName', $_REQUEST)) { + $repoName = $_REQUEST['repoName']; + } else { + json_return_and_die(array('message' => 'No repo name provided.', 'success' => false)); + } + $repoDir = __DIR__ . '/../../store/git/sys/extend/addon/'.$repoName; + if(!is_dir($repoDir)) { + json_return_and_die(array('message' => 'Invalid addon repo.', 'success' => false)); + } + $git = new GitRepo('sys', null, false, $repoName, $repoDir); + if($git->pull()) { + json_return_and_die(array('message' => 'Repo updated.', 'success' => true)); + } else { + json_return_and_die(array('message' => 'Error updating addon repo.', 'success' => false)); + } case 'removerepo': if(array_key_exists('repoName', $_REQUEST)) { $repoName = $_REQUEST['repoName']; diff --git a/Zotlabs/Storage/GitRepo.php b/Zotlabs/Storage/GitRepo.php index 81356950b..ac53aefc4 100644 --- a/Zotlabs/Storage/GitRepo.php +++ b/Zotlabs/Storage/GitRepo.php @@ -82,7 +82,9 @@ class GitRepo { } } } - + public function pull() { + return $this->git->pull(); + } /** * delete repository from disk */ |