Browse Source

added debug message

pull/24/head
Teknikode 8 years ago
parent
commit
a117e66511
  1. 23
      includes/update_profile.php

23
includes/update_profile.php

@ -131,15 +131,19 @@ if(isset($_POST)) @@ -131,15 +131,19 @@ if(isset($_POST))
// Add the user's keys to his git account
if ($public_key != $user->public_key)
{
if (!is_dir('../cache/gitolite-admin'))
{
mkdir('../cache/gitolite-admin', 0777, true);
}
$Git = new Git();
$Git->windows_mode();
$repo = $Git->open($CONF['git_repo_path'][0]."gitolite-admin\\");
$repo->setenv("HOME", "/home/git");
$repo->pull('origin', 'master');
$GitRepo = new GitRepo();
$GitRepo->setenv("HOME", "/home/git");
$repo = $GitRepo->create_new('C:\\inetpub\\wwwroot\\teknik\\cache\\gitolite-admin\\', 'git@localhost:gitolite-admin', true);
if (is_dir($CONF['git_repo_path'][0]."gitolite-admin\\keydir\\u\\".$user->username))
if (is_dir("../cache/gitolite-admin/keydir/u/".$user->username))
{
$files = glob($CONF['git_repo_path'][0]."gitolite-admin\\keydir\\u\\".$user->username."/*");
$files = glob("../cache/gitolite-admin/keydir/u/".$user->username."/*");
foreach($files as $file){ // iterate files
if(is_file($file))
unlink($file); // delete file
@ -147,7 +151,7 @@ if(isset($_POST)) @@ -147,7 +151,7 @@ if(isset($_POST))
}
else
{
mkdir($CONF['git_repo_path'][0]."gitolite-admin\\keydir\\u\\".$user->username, 0777, true);
mkdir("../cache/gitolite-admin/keydir/u/".$user->username, 0777, true);
}
$index = 0;
$keys = explode(",", $public_key);
@ -156,7 +160,7 @@ if(isset($_POST)) @@ -156,7 +160,7 @@ if(isset($_POST))
preg_match($pattern, $key, $matches);
$key = "ssh-rsa " . $matches[2];
$keyFileName = $CONF['git_repo_path'][0]."gitolite-admin\\keydir\\u\\".$user->username."\\".$user->username."@Key".$index.".pub";
$keyFileName = "../cache/gitolite-admin/keydir/u/".$user->username."/".$user->username."@Key".$index.".pub";
$fileHandle = fopen($keyFileName, 'w');
fwrite($fileHandle, $key);
fclose($fileHandle);
@ -165,6 +169,11 @@ if(isset($_POST)) @@ -165,6 +169,11 @@ if(isset($_POST))
$repo->add('.');
$repo->commit('Modified keys for '.$user->username);
$repo->push('origin', 'master');
if (is_dir('../cache/gitolite-admin'))
{
unlink('../cache/gitolite-admin');
}
}
/*
if ($minecraft != $user->minecraft_user)

Loading…
Cancel
Save