Fixed to correctly update the git daemon export flag as needed.

dev
Loic d'Anterroches 2009-01-20 17:31:55 +01:00
parent 8cfc5ec026
commit 5d3ce34c4b
3 changed files with 20 additions and 0 deletions

View File

@ -57,6 +57,17 @@ class IDF_Plugin_SyncGit_Cron
file_put_contents($authorized_keys, $out, LOCK_EX);
}
/**
* Mark export of git repositories for the daemon.
*/
public static function markExport()
{
foreach (Pluf::factory('IDF_Project')->getList() as $project) {
$rep = sprintf(Pluf::f('git_repositories'), $project->shortname);
IDF_Plugin_SyncGit_Serve::setGitExport($project->shortname, $rep);
}
}
/**
* Check if a sync is needed.
*
@ -66,6 +77,7 @@ class IDF_Plugin_SyncGit_Cron
if (file_exists(Pluf::f('idf_plugin_syncgit_sync_file'))) {
@unlink(Pluf::f('idf_plugin_syncgit_sync_file'));
self::sync();
self::markExport();
}
}
}

View File

@ -231,6 +231,9 @@ class IDF_Plugin_SyncGit_Serve
*/
public function gitExportDeny($fullpath)
{
if (!file_exists($fullpath)) {
return; // Not created yet.
}
@unlink($fullpath.DIRECTORY_SEPARATOR.'git-daemon-export-ok');
if (file_exists($fullpath.DIRECTORY_SEPARATOR.'git-daemon-export-ok')) {
throw new Exception('Cannot remove git-daemon-export-ok file.');
@ -245,6 +248,9 @@ class IDF_Plugin_SyncGit_Serve
*/
public function gitExportAllow($fullpath)
{
if (!file_exists($fullpath)) {
return; // Not created yet.
}
touch($fullpath.DIRECTORY_SEPARATOR.'git-daemon-export-ok');
if (!file_exists($fullpath.DIRECTORY_SEPARATOR.'git-daemon-export-ok')) {
throw new Exception('Cannot create git-daemon-export-ok file.');

View File

@ -63,6 +63,8 @@ Pluf_Signal::connect('Pluf_User::passwordUpdated',
#
# Git synchronization
Pluf_Signal::connect('IDF_Project::membershipsUpdated',
array('IDF_Plugin_SyncGit', 'entry'));
Pluf_Signal::connect('IDF_Key::postSave',
array('IDF_Plugin_SyncGit', 'entry'));