Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function url_get_contents ($Url) {
echo "- validate some very basic .env file settings \n";
echo "- check your PHP version and extension requirements \n";
echo "- check directory permissions \n";
echo "- change your 'git remote' to the new Snipe-IT GitHub URL \n"
echo "- do a git pull to bring you to the latest version \n";
echo "- run composer install to get your vendors up to date \n";
echo "- run a backup \n";
Expand Down Expand Up @@ -437,6 +438,30 @@ function url_get_contents ($Url) {

if ((strpos('git version', $git_version)) === false) {
echo "Git is installed. \n";

// check remotes for legacy snipe/snipe-it URL
$remote = shell_exec('git remote -v');
foreach (explode("\n", $remote) as $line) {
$remote_bits = explode("\t", $line, 2);
if (count($remote_bits) != 2) {
continue;
}
@list($url, $purpose) = explode(" ", $remote_bits[1]);
if (in_array($url, ['[email protected]:snipe/snipe-it.git', 'https://github.com/snipe/snipe-it.git'])) {
// SSH or HTTPS remotes
$new_url = preg_replace("|snipe/snipe-it|", "grokability/snipe-it", $url);
echo $success_icon . " Resetting remote " . $remote_bits[0] . " at $url to $new_url for purpose: $purpose\n";
$push = '';
if ($purpose == '(push)') {
$push = '--push ';
}
$cmd = "git remote set-url $push" . $remote_bits[0] . " " . $new_url;
$remote_reset = shell_exec($cmd);
if ($remote_reset) {
echo '-- ' . $remote_reset . "\n";
}
}
}
$git_fetch = shell_exec('git fetch');
$git_checkout = shell_exec('git checkout '.$branch);
$git_stash = shell_exec('git stash');
Expand Down
Loading