Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
cb83d071
Verified
Commit
cb83d071
authored
6 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
[REFACTORING] Update control
parent
85e2a85f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
install/view/update_download_view.php
+25
-32
25 additions, 32 deletions
install/view/update_download_view.php
with
25 additions
and
32 deletions
install/view/update_download_view.php
+
25
−
32
View file @
cb83d071
...
@@ -23,59 +23,52 @@ if ($_SESSION['user']['UserId'] <> 'superadmin') {
...
@@ -23,59 +23,52 @@ if ($_SESSION['user']['UserId'] <> 'superadmin') {
//retrives tags
//retrives tags
$client
=
new
\Gitlab\Client
(
'https://labs.maarch.org/api/v4/'
);
$client
=
new
\Gitlab\Client
(
'https://labs.maarch.org/api/v4/'
);
//$client->authenticate('aSecretToken', \Gitlab\Client::AUTH_URL_TOKEN);
// $project = $client->api('projects')->show('12');
$tags
=
$client
->
api
(
'tags'
)
->
all
(
'12'
);
$tags
=
$client
->
api
(
'tags'
)
->
all
(
'12'
);
//retrieve current version
//retrieve current version
$db
=
new
Database
();
$db
=
new
Database
();
$query
=
"SELECT param_value_int,
param_value_string FROM parameters WHERE id = 'database_version'"
;
$query
=
"SELECT
param_value_string FROM parameters WHERE id = 'database_version'"
;
$stmt
=
$db
->
query
(
$query
,
[]);
$stmt
=
$db
->
query
(
$query
,
[]);
$currentVersion
=
$stmt
->
fetchObject
();
$currentVersion
=
$stmt
->
fetchObject
();
$versionBranch
=
substr
(
$currentVersion
->
param_value_int
,
0
,
2
)
.
'.'
.
substr
(
$currentVersion
->
param_value_int
,
2
);
$currentVersionBranch
=
substr
(
$currentVersion
->
param_value_string
,
0
,
5
);
$currentVersionNumeric
=
preg_replace
(
"/[^0-9,]/"
,
""
,
$currentVersion
->
param_value_int
);
$currentVersionBranchYear
=
substr
(
$currentVersion
->
param_value_string
,
0
,
2
);
if
(
!
empty
(
$currentVersion
->
param_value_string
))
{
$currentVersionBranchMonth
=
substr
(
$currentVersion
->
param_value_string
,
3
,
2
);
$currentVersionTagNumeric
=
preg_replace
(
"/[^0-9,]/"
,
""
,
$currentVersion
->
param_value_string
);
$currentVersionTag
=
substr
(
$currentVersion
->
param_value_string
,
6
);
}
$allCurrentTags
=
[];
$allCurrentTags
=
[];
$allNextTags
=
[];
$allNextTags
=
[];
$cptCurrentTags
=
0
;
$cptCurrentTags
=
0
;
$isAnyAvailableTag
=
false
;
$isAnyAvailableTag
=
false
;
$isAnyAvailableVersion
=
false
;
$isAnyAvailableVersion
=
false
;
foreach
(
$tags
as
$key
=>
$value
)
{
foreach
(
$tags
as
$value
)
{
//echo $tags[$key]['name'] . ' ' . preg_replace("/[^0-9,]/", "", $tags[$key]['name']) . '<br />';
if
(
!
preg_match
(
"/^\d
{
2}\.\d{2
}
\.\d+$/"
,
$value
[
'name'
]))
{
if
(
!
preg_match
(
"/^\d
{
2}\.\d{2
}
\.\d+$/"
,
$tags
[
$key
][
'name'
]))
{
continue
;
continue
;
}
}
$tag
Numeric
=
preg_replace
(
"/[^0-9,]/"
,
""
,
$tags
[
$key
]
[
'name'
]);
$tag
=
substr
(
$value
[
'name'
]
,
6
);
$pos
=
strpos
(
$
tagNumeric
,
$currentVersion
Numeric
);
$pos
=
strpos
(
$
value
[
'name'
]
,
$currentVersion
Branch
);
if
(
$pos
===
false
)
{
if
(
$pos
===
false
)
{
//echo 'tag not in currentVersion:';
$year
=
substr
(
$value
[
'name'
],
0
,
2
);
$isAnyAvailableVersion
=
true
;
$month
=
substr
(
$value
[
'name'
],
3
,
2
);
$allNextTags
[]
=
$tags
[
$key
][
'name'
];
if
((
$year
==
$currentVersionBranchYear
&&
$month
>
$currentVersionBranchMonth
)
||
$year
>
$currentVersionBranchYear
)
{
$isAnyAvailableVersion
=
true
;
$allNextTags
[]
=
$value
[
'name'
];
}
}
else
{
}
else
{
//echo 'tag in currentVersion:';
$allCurrentTags
[
$cptCurrentTags
]
=
[];
$allCurrentTags
[
$cptCurrentTags
]
=
[];
$allCurrentTags
[
$cptCurrentTags
][
'name'
]
=
$tags
[
$key
][
'name'
];
$allCurrentTags
[
$cptCurrentTags
][
'name'
]
=
$value
[
'name'
];
$allCurrentTags
[
$cptCurrentTags
][
'numeric'
]
=
$tagNumeric
;
if
(
$tag
>
$currentVersionTag
)
{
if
(
$tagNumeric
>
$currentVersionTagNumeric
)
{
$allCurrentTags
[
$cptCurrentTags
][
'enabled'
]
=
true
;
$allCurrentTags
[
$cptCurrentTags
][
'enabled'
]
=
true
;
$isAnyAvailableTag
=
true
;
$isAnyAvailableTag
=
true
;
}
else
{
}
else
{
$allCurrentTags
[
$cptCurrentTags
][
'enabled'
]
=
false
;
$allCurrentTags
[
$cptCurrentTags
][
'enabled'
]
=
false
;
}
}
$cptCurrentTags
++
;
++
$cptCurrentTags
;
}
}
}
}
// require_once('install/class/Class_Install.php');
// $Class_Install = new Install;
?>
?>
<script>
<script>
function
launchProcess
(
myVar
)
{
function
launchProcess
(
myVar
)
{
...
@@ -121,7 +114,7 @@ foreach ($tags as $key => $value) {
...
@@ -121,7 +114,7 @@ foreach ($tags as $key => $value) {
<td>
<?php
echo
_YOUR_VERSION
;
?>
</td>
<td>
<?php
echo
_YOUR_VERSION
;
?>
</td>
<td>
:
</td>
<td>
:
</td>
<td>
<td>
<?php
echo
'<b>'
.
$currentVersion
->
param_value_string
.
'</b>
('
.
_BRANCH_VERSION
.
' : <b>'
.
$versionBranch
.
'</b>)
'
;
?>
<?php
echo
'<b>'
.
$currentVersion
->
param_value_string
.
'</b>'
;
?>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment