Skip to content

Commit 56a44ad

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 78cfb19 + a12ee3c commit 56a44ad

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

upgrade.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function url_get_contents ($Url) {
7979
echo "- validate some very basic .env file settings \n";
8080
echo "- check your PHP version and extension requirements \n";
8181
echo "- check directory permissions \n";
82+
echo "- change your 'git remote' to the new Snipe-IT GitHub URL \n"
8283
echo "- do a git pull to bring you to the latest version \n";
8384
echo "- run composer install to get your vendors up to date \n";
8485
echo "- run a backup \n";
@@ -437,6 +438,30 @@ function url_get_contents ($Url) {
437438

438439
if ((strpos('git version', $git_version)) === false) {
439440
echo "Git is installed. \n";
441+
442+
// check remotes for legacy snipe/snipe-it URL
443+
$remote = shell_exec('git remote -v');
444+
foreach (explode("\n", $remote) as $line) {
445+
$remote_bits = explode("\t", $line, 2);
446+
if (count($remote_bits) != 2) {
447+
continue;
448+
}
449+
@list($url, $purpose) = explode(" ", $remote_bits[1]);
450+
if (in_array($url, ['[email protected]:snipe/snipe-it.git', 'https://github.com/snipe/snipe-it.git'])) {
451+
// SSH or HTTPS remotes
452+
$new_url = preg_replace("|snipe/snipe-it|", "grokability/snipe-it", $url);
453+
echo $success_icon . " Resetting remote " . $remote_bits[0] . " at $url to $new_url for purpose: $purpose\n";
454+
$push = '';
455+
if ($purpose == '(push)') {
456+
$push = '--push ';
457+
}
458+
$cmd = "git remote set-url $push" . $remote_bits[0] . " " . $new_url;
459+
$remote_reset = shell_exec($cmd);
460+
if ($remote_reset) {
461+
echo '-- ' . $remote_reset . "\n";
462+
}
463+
}
464+
}
440465
$git_fetch = shell_exec('git fetch');
441466
$git_checkout = shell_exec('git checkout '.$branch);
442467
$git_stash = shell_exec('git stash');

0 commit comments

Comments
 (0)