Пример #1
0
 /**
  * Main function called by the serve script.
  */
 public static function main($argv, $env)
 {
     if (count($argv) != 2) {
         self::fatalError('Missing argument USER.');
     }
     $username = $argv[1];
     umask(022);
     if (!isset($env['SSH_ORIGINAL_COMMAND'])) {
         self::fatalError('Need SSH_ORIGINAL_COMMAND in environment.');
     }
     $cmd = $env['SSH_ORIGINAL_COMMAND'];
     chdir(Pluf::f('idf_plugin_syncgit_git_home_dir', '/home/git'));
     $serve = new IDF_Plugin_SyncGit_Serve();
     try {
         $new_cmd = $serve->serve($username, $cmd);
     } catch (Exception $e) {
         self::fatalError($e->getMessage());
     }
     print $new_cmd;
     exit(0);
 }
Пример #2
0
 /**
  * Main function called by the serve script.
  */
 public static function main($argv, $env)
 {
     if (count($argv) != 2) {
         self::fatalError('Missing argument USER.');
     }
     $username = $argv[1];
     umask(022);
     if (!isset($env['SSH_ORIGINAL_COMMAND'])) {
         self::fatalError('Need SSH_ORIGINAL_COMMAND in environment.');
     }
     $cmd = $env['SSH_ORIGINAL_COMMAND'];
     $home = Pluf::f('idf_plugin_syncgit_git_home_dir', '/home/git');
     if (!is_dir($home) || is_link($home)) {
         throw new Pluf_Exception_Setting_error(sprintf('%s does not exist! Did you set up your git user? ' . 'Set "idf_plugin_syncgit_git_home_dir". to git\'s $HOME.', $home));
     }
     chdir($home);
     $serve = new IDF_Plugin_SyncGit_Serve();
     try {
         $new_cmd = $serve->serve($username, $cmd);
     } catch (Exception $e) {
         self::fatalError($e->getMessage());
     }
     print $new_cmd;
     exit(0);
 }