Beispiel #1
0
 /**
  * Process the request.
  *
  * When processing the request, check if matching a project. If
  * so, directly set $request->project to the project.
  *
  * The url to match a project is in the format /p/(\w+)/whatever
  * or /api/p/(\w+)/whatever. This means that it will not try to
  * match on /login/ or /logout/.
  *
  * @param Pluf_HTTP_Request The request
  * @return bool false or redirect.
  */
 function process_request(&$request)
 {
     $match = array();
     if (preg_match('#^/(?:api/p|p)/([\\-\\w]+)/?#', $request->query, $match)) {
         try {
             $request->project = IDF_Project::getOr404($match[1]);
         } catch (Pluf_HTTP_Error404 $e) {
             return new Pluf_HTTP_Response_NotFound($request);
         }
         $request->conf = new IDF_Conf();
         $request->conf->setProject($request->project);
         self::setRights($request);
     }
     return false;
 }
Beispiel #2
0
 /**
  * Entry point for the post-update signal.
  *
  * It tries to find the name of the project, when found it runs an
  * update of the timeline.
  */
 public static function postUpdate($signal, &$params)
 {
     // Chop the ".git" and get what is left
     $pname = basename($params['git_dir'], '.git');
     try {
         $project = IDF_Project::getOr404($pname);
     } catch (Pluf_HTTP_Error404 $e) {
         Pluf_Log::event(array('IDF_Plugin_SyncGit::postUpdate', 'Project not found.', array($pname, $params)));
         return false;
         // Project not found
     }
     // Now we have the project and can update the timeline
     Pluf_Log::debug(array('IDF_Plugin_SyncGit::postUpdate', 'Project found', $pname, $project->id));
     IDF_Scm::syncTimeline($project, true);
     Pluf_Log::event(array('IDF_Plugin_SyncGit::postUpdate', 'sync', array($pname, $project->id)));
 }
Beispiel #3
0
 /**
  * Update the timeline in post commit.
  *
  */
 public function processSyncTimeline($params)
 {
     $pname = basename($params['rel_dir']);
     try {
         $project = IDF_Project::getOr404($pname);
     } catch (Pluf_HTTP_Error404 $e) {
         Pluf_Log::event(array('IDF_Plugin_SyncMercurial::processSyncTimeline', 'Project not found.', array($pname, $params)));
         return false;
         // Project not found
     }
     // Now we have the project and can update the timeline
     Pluf_Log::debug(array('IDF_Plugin_SyncMercurial::processSyncTimeline', 'Project found', $pname, $project->id));
     IDF_Scm::syncTimeline($project, true);
     Pluf_Log::event(array('IDF_Plugin_SyncMercurial::processSyncTimeline', 'sync', array($pname, $project->id)));
 }
Beispiel #4
0
 /**
  * Update the timeline after a push
  *
  */
 public function processSyncTimeline($project_name)
 {
     try {
         $project = IDF_Project::getOr404($project_name);
     } catch (Pluf_HTTP_Error404 $e) {
         Pluf_Log::event(array('IDF_Plugin_SyncMonotone::processSyncTimeline', 'Project not found.', array($project_name, $params)));
         return false;
         // Project not found
     }
     Pluf_Log::debug(array('IDF_Plugin_SyncMonotone::processSyncTimeline', 'Project found', $project_name, $project->id));
     IDF_Scm::syncTimeline($project, true);
     Pluf_Log::event(array('IDF_Plugin_SyncMonotone::processSyncTimeline', 'sync', array($project_name, $project->id)));
 }