Indefero

Indefero Commit Details


Date:2009-06-19 10:31:45 (15 years 6 months ago)
Author:Loic d'Anterroches
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:25e296fbb63cb487943d11ad5308b923516f4aaa
Parents: e235242ea6b51e8e70767814bb1acbb0e144b42a
Message:Added the display of the repository size in the source subtab of a project.

Changes:

File differences

src/IDF/Project.php
350350
351351
352352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
353371
354372
355373
}
/**
* Get the repository size.
*
* @param bool Force to skip the cache (false)
* @return int Size in byte or -1 if not available
*/
public function getRepositorySize($force=false)
{
$last_eval = $this->getConf()->getVal('repository_size_check_date', 0);
if (!$force and $last_eval > time()-86400) {
return $this->getConf()->getVal('repository_size', -1);
}
$scm = IDF_Scm::get($this);
$this->getConf()->setVal('repository_size', $scm->getRepositorySize());
$this->getConf()->setVal('repository_size_check_date', time());
return $this->getConf()->getVal('repository_size', -1);
}
/**
* Get the access url to the repository.
*
* This will return the right url based on the user.
src/IDF/Scm.php
8888
8989
9090
91
92
93
94
95
96
97
98
99
100
91101
92102
93103
}
/**
* Return the size of the repository in bytes.
*
* @return int Size in byte, -1 if the size cannot be evaluated.
*/
public function getRepositorySize()
{
return -1;
}
/**
* Returns the URL of the git daemon.
*
* @param IDF_Project
src/IDF/Scm/Git.php
4141
4242
4343
44
45
46
47
48
49
50
51
4452
4553
4654
$this->project = $project;
}
public function getRepositorySize()
{
$cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -bs '
.escapeshellarg($this->repo);
$out = split(' ', shell_exec($cmd), 2);
return (int) $out[0];
}
public function isAvailable()
{
try {
src/IDF/Scm/Mercurial.php
3333
3434
3535
36
37
38
39
40
41
42
43
3644
3745
3846
$this->project = $project;
}
public function getRepositorySize()
{
$cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -bs '
.escapeshellarg($this->repo);
$out = split(' ', shell_exec($cmd), 2);
return (int) $out[0];
}
public static function factory($project)
{
$rep = sprintf(Pluf::f('mercurial_repositories'), $project->shortname);
src/IDF/Scm/Svn.php
5151
5252
5353
54
55
56
57
58
59
60
61
62
63
64
5465
5566
5667
return true;
}
public function getRepositorySize()
{
if (strpos($this->repo, 'file://') !== 0) {
return -1;
}
$cmd = Pluf::f('idf_exec_cmd_prefix', '').'du -bs '
.escapeshellarg(substr($this->repo, 7));
$out = split(' ', shell_exec($cmd), 2);
return (int) $out[0];
}
/**
* Given the string describing the author from the log find the
* author in the database.
src/IDF/Views/Project.php
510510
511511
512512
513
513514
514515
515516
'remote_svn' => $remote_svn,
'repository_access' => $prj->getRemoteAccessUrl(),
'repository_type' => $repository_type,
'repository_size' => $prj->getRepositorySize(),
'page_title' => $title,
'form' => $form,
),
src/IDF/templates/idf/admin/source.html
2020
2121
2222
23
23
24
25
26
27
28
2429
2530
2631
<th>{trans 'Repository access:'}</th>
<td>{$repository_access}
</td>
</tr>{if $remote_svn}
</tr>{if $repository_size != -1}
<tr>
<th>{trans 'Repository size:'}</th>
<td>{$repository_size|size}
</td>
</tr>{/if}{if $remote_svn}
<tr>
<th>{$form.f.svn_username.labelTag}:</th>
<td>{if $form.f.svn_username.errors}{$form.f.svn_username.fieldErrors}{/if}

Archive Download the corresponding diff file

Page rendered in 0.09446s using 13 queries.