| doc/syncsvn.mdtext |
| 66 | 66 | $cfg['idf_plugin_syncsvn_authz_file'] = '/home/svn/dav_svn.authz'; |
| 67 | 67 | $cfg['idf_plugin_syncsvn_passwd_file'] = '/home/svn/dav_svn.passwd'; |
| 68 | 68 | $cfg['idf_plugin_syncsvn_svn_path'] = '/home/svn/repositories'; |
| 69 | // Delete the corresponding repository when deleting the project |
| 70 | $cfg['idf_plugin_syncsvn_remove_orphans'] = false; |
| 69 | 71 | |
| 70 | 72 | You can have more control over the permissions given to the owners, |
| 71 | 73 | members, extra authorized users and anonymous users if you want with |
| src/IDF/Plugin/SyncSvn.php |
| 52 | 52 | case 'Pluf_User::passwordUpdated': |
| 53 | 53 | $plug->processSyncPasswd($params['user']); |
| 54 | 54 | break; |
| 55 | case 'IDF_Project::preDelete': |
| 56 | $plug->processSvnDelete($params['project']); |
| 57 | break; |
| 55 | 58 | } |
| 56 | 59 | } |
| 57 | 60 | |
| ... | ... | |
| 83 | 86 | $ll = exec($cmd, $output, $return); |
| 84 | 87 | return ($return == 0); |
| 85 | 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Remove the project from the drive and update the access rights. |
| 92 | * |
| 93 | * @param IDF_Project |
| 94 | * @return bool Success |
| 95 | */ |
| 96 | function processSvnDelete($project) |
| 97 | { |
| 98 | if (!Pluf::f('idf_plugin_syncsvn_remove_orphans', false)) { |
| 99 | return; |
| 100 | } |
| 101 | if ($project->getConf()->getVal('scm') != 'svn') { |
| 102 | return false; |
| 103 | } |
| 104 | $this->SyncAccess($project); // exclude $project |
| 105 | $shortname = $project->shortname; |
| 106 | if (false===($svn_path=Pluf::f('idf_plugin_syncsvn_svn_path',false))) { |
| 107 | throw new Pluf_Exception_SettingError("'idf_plugin_syncsvn_svn_path' must be defined in your configuration file."); |
| 108 | } |
| 109 | if (file_exists($svn_path.'/'.$shortname)) { |
| 110 | $cmd = Pluf::f('idf_exec_cmd_prefix', '').'rm -rf '.$svn_path.'/'.$shortname; |
| 111 | exec($cmd); |
| 112 | } |
| 113 | } |
| 86 | 114 | |
| 87 | 115 | /** |
| 88 | 116 | * Synchronise an user's password. |
| ... | ... | |
| 156 | 184 | * We rebuild the complete file each time. This is just to be sure |
| 157 | 185 | * not to bork the rights when trying to just edit part of the |
| 158 | 186 | * file. |
| 187 | * |
| 188 | * @param IDF_Project Possibly exclude a project (null) |
| 159 | 189 | */ |
| 160 | | function SyncAccess() |
| 190 | function SyncAccess($exclude=null) |
| 161 | 191 | { |
| 162 | 192 | $authz_file = Pluf::f('idf_plugin_syncsvn_authz_file'); |
| 163 | 193 | $access_owners = Pluf::f('idf_plugin_syncsvn_access_owners', 'rw'); |
| ... | ... | |
| 170 | 200 | } |
| 171 | 201 | $fcontent = ''; |
| 172 | 202 | foreach (Pluf::factory('IDF_Project')->getList() as $project) { |
| 203 | if ($exclude and $exclude->id == $project->id) { |
| 204 | continue; |
| 205 | } |
| 173 | 206 | $conf = new IDF_Conf(); |
| 174 | 207 | $conf->setProject($project); |
| 175 | 208 | if ($conf->getVal('scm') != 'svn' or |
| src/IDF/Project.php |
| 586 | 586 | */ |
| 587 | 587 | public function preDelete() |
| 588 | 588 | { |
| 589 | /** |
| 590 | * [signal] |
| 591 | * |
| 592 | * IDF_Project::preDelete |
| 593 | * |
| 594 | * [sender] |
| 595 | * |
| 596 | * IDF_Project |
| 597 | * |
| 598 | * [description] |
| 599 | * |
| 600 | * This signal allows an application to perform special |
| 601 | * operations at the deletion of a project. |
| 602 | * |
| 603 | * [parameters] |
| 604 | * |
| 605 | * array('project' => $project) |
| 606 | * |
| 607 | */ |
| 608 | $params = array('project' => $this); |
| 609 | Pluf_Signal::send('IDF_Project::preDelete', |
| 610 | 'IDF_Project', $params); |
| 589 | 611 | $what = array('IDF_Upload', 'IDF_Review', 'IDF_Issue', |
| 590 | 612 | 'IDF_WikiPage', 'IDF_Commit', |
| 591 | 613 | ); |
| src/IDF/relations.php |
| 54 | 54 | array('IDF_Plugin_SyncSvn', 'entry')); |
| 55 | 55 | Pluf_Signal::connect('Pluf_User::passwordUpdated', |
| 56 | 56 | array('IDF_Plugin_SyncSvn', 'entry')); |
| 57 | | |
| 57 | Pluf_Signal::connect('IDF_Project::preDelete', |
| 58 | array('IDF_Plugin_SyncSvn', 'entry')); |
| 58 | 59 | # |
| 59 | 60 | # Mercurial synchronization |
| 60 | 61 | Pluf_Signal::connect('IDF_Project::membershipsUpdated', |