aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-09 21:59:27 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-09 21:59:27 -0400
commit9c8cf7d43372aeea4d8a450e7cb17d7a24b64d5f (patch)
treea70fdba83c7ef24be410a14128d80943672678cd /Zotlabs/Module
parent180731c162b12f62a0065bc9ce8d537a95c98ed6 (diff)
downloadvolse-hubzilla-9c8cf7d43372aeea4d8a450e7cb17d7a24b64d5f.tar.gz
volse-hubzilla-9c8cf7d43372aeea4d8a450e7cb17d7a24b64d5f.tar.bz2
volse-hubzilla-9c8cf7d43372aeea4d8a450e7cb17d7a24b64d5f.zip
Fixed some bugs with empty repo name and improved the interface a bit.
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Admin.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 19b8a2e77..63f3e77f0 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -1729,9 +1729,13 @@ class Admin extends \Zotlabs\Web\Controller {
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 {
+ try {
+ 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));
+ }
+ } catch(\PHPGit\Exception\GitException $e) {
json_return_and_die(array('message' => 'Error updating addon repo.', 'success' => false));
}
case 'removerepo':
@@ -1769,7 +1773,7 @@ class Admin extends \Zotlabs\Web\Controller {
}
}
$repoName = null;
- if(array_key_exists('repoName',$_REQUEST)) {
+ if(array_key_exists('repoName',$_REQUEST) && $_REQUEST['repoName'] !== '') {
$repoName = $_REQUEST['repoName'];
} else {
$repoName = GitRepo::getRepoNameFromURL($repoURL);
@@ -1805,15 +1809,14 @@ class Admin extends \Zotlabs\Web\Controller {
}
}
$repoName = null;
- if(array_key_exists('repoName',$_REQUEST)) {
+ if(array_key_exists('repoName',$_REQUEST) && $_REQUEST['repoName'] !== '') {
$repoName = $_REQUEST['repoName'];
- logger('repoName: ' . $repoName);
} else {
$repoName = GitRepo::getRepoNameFromURL($repoURL);
}
if(!$repoName) {
logger('Invalid git repo');
- json_return_and_die(array('message' => 'Invalid git repo', 'success' => false));
+ json_return_and_die(array('message' => 'Invalid git repo: ' . $repoName, 'success' => false));
}
$repoDir = $tempAddonDir.'/'.$repoName;
// clone the repo if new automatically