Skip to content

Commit 4873da5

Browse files
committed
5.4.0
1 parent 5509bfb commit 4873da5

File tree

200 files changed

+3424
-1877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+3424
-1877
lines changed

.github/workflows/tasks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
# Entrypoint is not executed, so we need to run most of the commands manually
3535
- name: Execute entrypoint
3636
run: |
37+
/bin/bash /var/www/repomanager/bin/repomanager -p
3738
/bin/su -s /bin/bash -c "php /var/www/repomanager/tools/database/initialize.php" www-data
3839
/bin/su -s /bin/bash -c "php /var/www/repomanager/tools/database/update.php" www-data
39-
/bin/bash /var/www/repomanager/bin/repomanager -p
4040
4141
# Create deb tasks jobs in database
4242
- name: Create deb tasks jobs
@@ -109,9 +109,9 @@ jobs:
109109
# Entrypoint is not executed, so we need to run most of the commands manually
110110
- name: Execute entrypoint
111111
run: |
112+
/bin/bash /var/www/repomanager/bin/repomanager -p
112113
/bin/su -s /bin/bash -c "php /var/www/repomanager/tools/database/initialize.php" www-data
113114
/bin/su -s /bin/bash -c "php /var/www/repomanager/tools/database/update.php" www-data
114-
/bin/bash /var/www/repomanager/bin/repomanager -p
115115
116116
# Create rpm tasks jobs in database
117117
- name: Create rpm tasks jobs

www/config/tasks.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
$tasksDefinitions = [
3+
'create' => [
4+
'description' => 'Create repository snapshot',
5+
'required-params' => [
6+
'package-type',
7+
'repo-type',
8+
'arch',
9+
10+
// 'repo-id',
11+
// 'gpg-sign'
12+
],
13+
// Some required params are conditional
14+
'conditional-required-params' => [
15+
// Based on package type
16+
'package-type' => [
17+
'rpm' => [
18+
'required-params' => [
19+
'releasever'
20+
],
21+
'optional-params' => []
22+
],
23+
'deb' => [
24+
'required-params' => [
25+
'dist',
26+
'section'
27+
],
28+
'optional-params' => []
29+
]
30+
],
31+
// Based on repo type
32+
'repo-type' => [
33+
'mirror' => [
34+
'required-params' => [
35+
'source',
36+
'gpg-check',
37+
'gpg-sign'
38+
],
39+
'optional-params' => []
40+
]
41+
]
42+
],
43+
44+
'optional-params' => [
45+
'env',
46+
'group',
47+
'description',
48+
'package-include',
49+
'package-exclude'
50+
],
51+
'retrieve-repo-from-snap-id' => false
52+
],
53+
54+
55+
'delete' => [
56+
'description' => 'Delete repository snapshot',
57+
'required-params' => [
58+
'snap-id'
59+
],
60+
'optional-params' => [],
61+
'retrieve-repo-from-snap-id' => true
62+
],
63+
'rebuild' => [
64+
'description' => 'Rebuild repository metadata',
65+
'required-params' => [
66+
'snap-id',
67+
'gpg-sign'
68+
],
69+
'optional-params' => [],
70+
'retrieve-repo-from-snap-id' => true
71+
]
72+
];

www/controllers/Api/Api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function run()
160160
*/
161161
private static function returnSuccess(array $results)
162162
{
163-
$returnArray = array('return' => 201);
163+
$returnArray = ['return' => 201];
164164
$returnArray = array_merge($returnArray, $results);
165165

166166
http_response_code(201);

www/controllers/Api/Host/Host.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ public function execute()
5050
if ($this->method == 'GET') {
5151
try {
5252
$list = $myhost->listAll();
53-
return array('results' => $list);
5453
} catch (Exception $e) {
5554
throw new Exception('Hosts listing has failed.');
5655
}
56+
57+
return ['results' => $list];
5758
}
5859
}
5960
}
@@ -76,7 +77,13 @@ public function execute()
7677
/**
7778
* If register is successful, then return generated id and token
7879
*/
79-
return array('message' => array('Host successfully registered.'), 'results' => array('id' => $result['authId'], 'token' => $result['token']));
80+
return [
81+
'message' => ['Host successfully registered.'],
82+
'results' => [
83+
'id' => $result['authId'],
84+
'token' => $result['token']
85+
]
86+
];
8087
}
8188

8289
/**
@@ -89,6 +96,7 @@ public function execute()
8996

9097
// Package controller will be useful for packages operations
9198
$hostPackageController = new \Controllers\Host\Package\Package($this->hostId);
99+
$hostEventController = new \Controllers\Host\Package\Event($this->hostId);
92100
} catch (Exception $e) {
93101
throw new Exception('Coult not retrieve host Id in database');
94102
}
@@ -304,7 +312,7 @@ public function execute()
304312
}
305313
}
306314

307-
return array('message' => $message);
315+
return ['message' => $message];
308316
}
309317

310318
/**
@@ -323,10 +331,11 @@ public function execute()
323331
if (!empty($this->data->installed_packages)) {
324332
try {
325333
$hostPackageController->setPackagesInventory($this->data->installed_packages);
326-
return array('message' => array('Installed packages updated successfully.'));
327334
} catch (Exception $e) {
328335
throw new Exception('Installed packages update has failed: ' . $e->getMessage());
329336
}
337+
338+
return ['message' => ['Installed packages updated successfully.']];
330339
}
331340
}
332341

@@ -341,10 +350,11 @@ public function execute()
341350
if (!empty($this->data->available_packages)) {
342351
try {
343352
$hostPackageController->setPackagesAvailable($this->data->available_packages);
344-
return array('message' => array('Available packages updated successfully.'));
345353
} catch (Exception $e) {
346354
throw new Exception('Available packages update has failed: ' . $e->getMessage());
347355
}
356+
357+
return ['message' => ['Available packages updated successfully.']];
348358
}
349359
}
350360

@@ -358,11 +368,12 @@ public function execute()
358368
*/
359369
if (!empty($this->data->events)) {
360370
try {
361-
$hostPackageController->setEventsFullHistory($this->data->events);
362-
return array('message' => array('Package events history updated successfully.'));
371+
$hostEventController->setHistory($this->data->events);
363372
} catch (Exception $e) {
364373
throw new Exception('Package events history update has failed: ' . $e->getMessage());
365374
}
375+
376+
return ['message' => ['Package events history updated successfully.']];
366377
}
367378
}
368379
}

www/controllers/Api/Profile/Profile.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Controllers\Api\Profile;
44

55
use Exception;
6-
use Datetime;
76

87
class Profile extends \Controllers\Api\Controller
98
{
@@ -29,7 +28,7 @@ public function execute()
2928
* Print all profiles
3029
*/
3130
if (empty($this->profile) and $this->method == 'GET') {
32-
return array('results' => $myprofile->listName());
31+
return ['results' => $myprofile->listName()];
3332
}
3433

3534
/**
@@ -41,28 +40,28 @@ public function execute()
4140
* If $this->profile == 'server-settings' then return server configuration
4241
*/
4342
if ($this->profile == 'server-settings') {
44-
return array('results' => array($myprofile->getServerConfiguration()));
43+
return ['results' => [$myprofile->getServerConfiguration()]];
4544
}
4645

4746
/**
4847
* Return profile main configuration
4948
*/
5049
if (empty($this->component)) {
51-
return array('results' => array($myprofile->getProfileConfiguration($this->profile)));
50+
return ['results' => [$myprofile->getProfileConfiguration($this->profile)]];
5251
}
5352

5453
/**
5554
* Return profile packages excludes
5655
*/
5756
if ($this->component == 'excludes') {
58-
return array('results' => array($myprofile->getProfilePackagesConfiguration($this->profile)));
57+
return ['results' => [$myprofile->getProfilePackagesConfiguration($this->profile)]];
5958
}
6059

6160
/**
6261
* Return profile repos configuration
6362
*/
6463
if ($this->component == 'repos') {
65-
return array('results' => $myprofile->getReposMembersList($this->profile));
64+
return ['results' => $myprofile->getReposMembersList($this->profile)];
6665
}
6766
}
6867

www/controllers/Api/Repo/Repo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function execute()
4343
throw new Exception('No repositories found');
4444
}
4545

46-
return array('results' => $repos);
46+
return ['results' => $repos];
4747
}
4848
}
4949

@@ -68,7 +68,7 @@ public function execute()
6868
throw new Exception('No snapshots found for this repository');
6969
}
7070

71-
return array('results' => $snapshots);
71+
return ['results' => $snapshots];
7272
}
7373
}
7474

www/controllers/Api/Snapshot/Snapshot.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function execute()
5050
if ($this->action == 'upload' and !empty($this->postFiles)) {
5151
$mypackage->upload($this->snapId, $this->postFiles);
5252

53-
return array('results' => 'Packages uploaded successfully');
53+
return ['results' => 'Packages uploaded successfully'];
5454
}
5555
}
5656

@@ -97,11 +97,11 @@ public function execute()
9797
/**
9898
* Execute the task
9999
*/
100-
$mytask->execute(array($params));
100+
$mytask->execute([$params]);
101101

102102
unset($mytask);
103103

104-
return array('results' => 'Snapshot metadata rebuild started');
104+
return ['results' => 'Snapshot metadata rebuild started'];
105105
}
106106
}
107107
}

www/controllers/Api/Source/Source.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function execute()
4646
* Print all source repositories
4747
*/
4848
if (empty($this->type) and $this->method == 'GET') {
49-
return array('results' => $mysource->listAll());
49+
return ['results' => $mysource->listAll()];
5050
}
5151

5252
/**
@@ -62,7 +62,7 @@ public function execute()
6262
* If no source name or action is specified, then list all sources of the specified type
6363
*/
6464
if (empty($this->nameOrAction) and $this->method == 'GET') {
65-
return array('results' => $mysource->listAll($this->type));
65+
return ['results' => $mysource->listAll($this->type)];
6666
}
6767

6868
/**
@@ -96,15 +96,15 @@ public function execute()
9696
*/
9797
$mysource->importYamlFromApi($this->postFiles['template']['tmp_name']);
9898

99-
return array('results' => 'Source repositories imported successfully');
99+
return ['results' => 'Source repositories imported successfully'];
100100
}
101101

102102
/**
103103
* Else, return source repository details by its name
104104
*/
105105
if ($this->nameOrAction != 'import') {
106106
if ($this->method == 'GET') {
107-
return array('results' => $mysource->get($this->type, $this->nameOrAction));
107+
return ['results' => $mysource->get($this->type, $this->nameOrAction)];
108108
}
109109
}
110110
}

www/controllers/App/Config/Notification.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public static function get()
3030
*/
3131
if (empty($_SESSION['email'])) {
3232
$message = '<span>You can configure your email in your user profile. This email can be used as a recipient to send notifications of events like scheduled tasks status or scheduled tasks reminders.</span>';
33-
$NOTIFICATION_MESSAGES[] = array('Title' => 'Email contact is not set', 'Message' => $message);
33+
$NOTIFICATION_MESSAGES[] = [
34+
'Title' => 'Email contact is not set',
35+
'Message' => $message
36+
];
3437
$NOTIFICATION++;
3538
}
3639

www/controllers/App/Config/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function get()
3535
/**
3636
* Following parameters can be empty (or equal to 0), we don't increment the error counter in their case
3737
*/
38-
$ignoreEmptyParam = array('EMAIL_RECIPIENT', 'PROXY', 'RPM_DEFAULT_ARCH', 'DEB_DEFAULT_ARCH', 'DEB_DEFAULT_TRANSLATION', 'REPO_CONF_FILES_PREFIX', 'RETENTION', 'OIDC_PROVIDER_URL', 'OIDC_AUTHORIZATION_ENDPOINT', 'OIDC_TOKEN_ENDPOINT', 'OIDC_USERINFO_ENDPOINT', 'OIDC_SCOPES', 'OIDC_CLIENT_ID', 'OIDC_CLIENT_SECRET', 'OIDC_HTTP_PROXY', 'OIDC_CERT_PATH');
38+
$ignoreEmptyParam = ['EMAIL_RECIPIENT', 'PROXY', 'RPM_DEFAULT_ARCH', 'DEB_DEFAULT_ARCH', 'DEB_DEFAULT_TRANSLATION', 'REPO_CONF_FILES_PREFIX', 'RETENTION', 'OIDC_PROVIDER_URL', 'OIDC_AUTHORIZATION_ENDPOINT', 'OIDC_TOKEN_ENDPOINT', 'OIDC_USERINFO_ENDPOINT', 'OIDC_SCOPES', 'OIDC_CLIENT_ID', 'OIDC_CLIENT_SECRET', 'OIDC_HTTP_PROXY', 'OIDC_CERT_PATH'];
3939

4040
if (in_array($key, $ignoreEmptyParam)) {
4141
continue;

0 commit comments

Comments
 (0)