diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-03 06:30:46 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-03 06:30:46 -0400 |
commit | 9619d02be988a5af7746fa5524b17e645f99d40d (patch) | |
tree | 1bf4cdeb30789e7eeae7e8701b7ad230557d5601 /Zotlabs | |
parent | 4ed5d6573c69157721d484ba0ce506788fcc8024 (diff) | |
download | volse-hubzilla-9619d02be988a5af7746fa5524b17e645f99d40d.tar.gz volse-hubzilla-9619d02be988a5af7746fa5524b17e645f99d40d.tar.bz2 volse-hubzilla-9619d02be988a5af7746fa5524b17e645f99d40d.zip |
AJAX and spinner for add repo form submission. Repo info will be displayed below the form.
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Admin.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 9bc0482c0..ae0a0ad85 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -1651,10 +1651,8 @@ class Admin extends \Zotlabs\Web\Controller { if(array_key_exists('repoURL',$_REQUEST)) { require __DIR__ . '/../../library/PHPGit.autoload.php'; // Load PHPGit dependencies - info('Repo URL submitted: ' . $_REQUEST['repoURL']); - //$git = new Git(); + logger('Repo URL submitted: ' . $_REQUEST['repoURL']); $repoURL = $_REQUEST['repoURL']; - //logger('hubsites: new git object created: ' . json_encode($git)); $urlpath = parse_url($repoURL, PHP_URL_PATH); $lastslash = strrpos($urlpath, '/') + 1; $gitext = strrpos($urlpath, '.'); @@ -1666,27 +1664,32 @@ class Admin extends \Zotlabs\Web\Controller { break; } $storepath = realpath(__DIR__ . '/../../store/'); - logger('storepath: ' . $storepath); + //logger('storepath: ' . $storepath); $repopath = $storepath . '/pluginrepos/' . $reponame; if (!file_exists($repopath)) { - logger('epopath does not exist'); + //logger('repopath does not exist'); if (mkdir($repopath, 0770, true)) { - logger('repopath created'); + //logger('repopath created'); $git = new Git(); - logger('new git object created'); + //logger('new git object created'); $cloned = $git->clone($repoURL, $repopath); if (!$cloned) { logger('git clone failed'); notice('Repo coule not be cloned. Filesystem path error.'); - return null; + json_return_and_die(array('message' => 'Repo coule not be cloned. Filesystem path error.', 'success' => false)); } + json_return_and_die(array('message' => 'Successfully cloned to: ' . $repopath , 'success' => true)); } else { logger('repopath could not be created'); notice('Repo coule not be cloned. Filesystem path error.'); - return null; + json_return_and_die(array('message' => 'Repo coule not be cloned. Filesystem path error', 'success' => false)); } - } + } else { + json_return_and_die(array('message' => 'Repo already exists at: ' . $repopath, 'success' => true)); + } + } else { + json_return_and_die(array('message' => 'No repo URL provided', 'success' => false)); } break; default: |