Fixed to be usable outside of a request context.
This commit is contained in:
parent
6c5da01319
commit
e208a3e1eb
@ -87,15 +87,15 @@ class IDF_Scm
|
||||
* Sync the changes in the repository with the timeline.
|
||||
*
|
||||
*/
|
||||
public static function syncTimeline($request)
|
||||
public static function syncTimeline($project)
|
||||
{
|
||||
$cache = Pluf_Cache::factory();
|
||||
$key = 'IDF_Scm:'.$request->project->shortname.':lastsync';
|
||||
$key = 'IDF_Scm:'.$project->shortname.':lastsync';
|
||||
if (null === ($res=$cache->get($key))) {
|
||||
$scm = IDF_Scm::get($request->project);
|
||||
$scm = IDF_Scm::get($project);
|
||||
foreach ($scm->getBranches() as $branche) {
|
||||
foreach ($scm->getChangeLog($branche, 25) as $change) {
|
||||
IDF_Commit::getOrAdd($change, $request->project);
|
||||
IDF_Commit::getOrAdd($change, $project);
|
||||
}
|
||||
}
|
||||
$cache->set($key, true, (int)(Pluf::f('cache_timeout', 300)/2));
|
||||
|
@ -79,7 +79,7 @@ class IDF_Views_Project
|
||||
$rights = array();
|
||||
if (true === IDF_Precondition::accessSource($request)) {
|
||||
$rights[] = '\'IDF_Commit\'';
|
||||
IDF_Scm::syncTimeline($request);
|
||||
IDF_Scm::syncTimeline($request->project);
|
||||
}
|
||||
if (true === IDF_Precondition::accessIssues($request)) {
|
||||
$rights[] = '\'IDF_Issue\'';
|
||||
@ -156,7 +156,7 @@ class IDF_Views_Project
|
||||
$rights = array();
|
||||
if (true === IDF_Precondition::accessSource($request)) {
|
||||
$rights[] = '\'IDF_Commit\'';
|
||||
IDF_Scm::syncTimeline($request);
|
||||
IDF_Scm::syncTimeline($request->project);
|
||||
}
|
||||
if (true === IDF_Precondition::accessIssues($request)) {
|
||||
$rights[] = '\'IDF_Issue\'';
|
||||
|
Loading…
Reference in New Issue
Block a user