@@ -79,6 +79,7 @@ function url_get_contents ($Url) {
7979echo "- validate some very basic .env file settings \n" ;
8080echo "- check your PHP version and extension requirements \n" ;
8181echo "- check directory permissions \n" ;
82+ echo "- change your 'git remote' to the new Snipe-IT GitHub URL \n"
8283echo "- do a git pull to bring you to the latest version \n ";
8384echo " - run composer install to get your vendors up to date \n ";
8485echo " - run a backup \n ";
@@ -437,6 +438,30 @@ function url_get_contents ($Url) {
437438
438439if ((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