-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrepostats.php
108 lines (83 loc) · 3.22 KB
/
repostats.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
declare(strict_types=1);
/**
* This file is part of the VitexSoftware package
*
* https://vitexsoftware.com/
*
* (c) Vítězslav Dvořák <http://vitexsoftware.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace VSCZ;
require_once 'includes/VSInit.php';
$repostats = new AccessLog();
$oPage->includeJavaScript('js/jquery.tablesorter.min.js');
$oPage->addJavaScript('$("#packs").tablesorter();');
$oPage->addItem(new ui\PageTop(_('Deb Repository')));
$packTabs = new \Ease\TWB5\Tabs('PackTabs');
$reposinfo = new \Ease\TWB5\Card(new \Ease\Html\H3Tag(_('How to use repository')));
$reposinfo->addItem(new \Ease\Html\EmTag(_('On current debian or ubuntu')));
$steps = $reposinfo->addItem(new \Ease\Html\UlTag(
null,
['class' => 'list-group'],
));
$steps->addItemSmart(
'wget -O - http://v.s.cz/[email protected] | sudo apt-key add - ',
['class' => 'list-group-item'],
);
$steps->addItemSmart(
'echo deb http://v.s.cz/ stable main | sudo tee /etc/apt/sources.list.d/vitexsoftware.list ',
['class' => 'list-group-item'],
);
$steps->addItemSmart('sudo apt update', ['class' => 'list-group-item']);
$steps->addItemSmart(
'sudo apt install <em>package(s)</em>',
['class' => 'list-group-item'],
);
$reposinfo->addItem(sprintf(
_('apt-get update feeded %d times'),
$repostats->getUpdatedCount(),
));
$packages = ui\PackageInfo::getPackagesInfo();
$ptable = new \Ease\Html\TableTag(null, ['class' => 'table', 'id' => 'packs']);
$ptable->setHeader([_('Package name'), _('Version'), _('Age'), _('Release date'),
_('Size'),
_('Package'), _('Installs'), _('Downloads')]);
$oPage->addJavascript('$(".hinter").popover();', null, true);
$oPage->addCss('.hinter { font-weight: bold; font-size: large; }');
foreach ($packages as $pName => $pProps) {
$packFile = trim($pProps['Filename']);
$icon = 'img/deb/'.$pName.'.png';
if (!file_exists($icon)) {
$icon = 'img/deb-package.png';
}
if (!file_exists($packFile)) {
continue;
}
$installs = $repostats->getPackageInstalls($pName);
$downloads = $repostats->getPackageDownloads($pName);
$fileMtime = filemtime($packFile);
$incTime = date('Y m. d.', $fileMtime);
$packAge = ui\WebPage::secondsToTime((float) (time() - $fileMtime));
$package = new \Ease\Html\ATag(
$pProps['Filename'],
'<img style="width: 18px;" src="img/deb-package.png"> '.$pProps['Architecture'],
['class' => 'btn btn-xs btn-success'],
);
$pInfo = new \Ease\Html\ATag(
'package.php?package='.$pName.'#',
$pName,
['tabindex' => 0, 'class' => 'hinter', 'data-toggle' => 'popover', 'data-trigger' => 'hover',
'data-content' => $pProps['Description']],
);
$ptable->addRowColumns(['<img class="debicon" src="'.$icon.'"> '.$pInfo, $pProps['Version'],
$packAge, $incTime, ui\WebPage::_format_bytes($pProps['Size']),
$package, $installs, $downloads]);
}
$packTabs->addTab(_('Packages'), $ptable);
$packTabs->addTab(_('Instructions'), $reposinfo);
$oPage->addItem(new \Ease\TWB5\Container($packTabs));
$oPage->addItem(new ui\PageBottom());
$oPage->draw();