Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VBcms-2-0
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Lasri
VBcms-2-0
Commits
7c2f0f75
Commit
7c2f0f75
authored
May 12, 2021
by
Sofiane Lasri
Browse files
Options
Downloads
Patches
Plain Diff
updateTest
parent
92e3eafe
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
update.php
+218
-0
218 additions, 0 deletions
update.php
vbcms-admin/backTasks.php
+10
-4
10 additions, 4 deletions
vbcms-admin/backTasks.php
vbcms-admin/updater.php
+6
-6
6 additions, 6 deletions
vbcms-admin/updater.php
with
234 additions
and
10 deletions
update.php
0 → 100644
+
218
−
0
View file @
7c2f0f75
if
(
isset
(
$_GET
[
"silentUpdate"
]))
{
// Ici on met à jour la base de donnée
include
'vbcms-config.php'
;
$bdd
=
new
PDO
(
"mysql:host=
$bddHost
;dbname=
$bddName
"
,
$bddUser
,
$bddMdp
);
$response
=
$bdd
->
prepare
(
"UPDATE `vbcms-settings` SET value = ? WHERE name = 'vbcmsVersion"
);
$response
->
execute
([
$vbcmsVer
]);
}
elseif
(
isset
(
$_GET
[
"deleteUpdateFile"
])){
unlink
(
'update.php'
);
}
else
{
?>
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
VBcms | Mise à jour
</title>
<meta
name=
"theme-color"
content=
"#BF946F"
>
<meta
name=
"author"
content=
"Sofiane Lasri"
>
<link
rel=
"icon"
href=
"https://vbcms.net/vbcms-admin/images/vbcms-logo/raccoon-in-box-128x.png"
type=
"image/png"
>
<meta
content=
"VBcms"
property=
"og:title"
>
<meta
content=
"Mise à jour de VBcms"
property=
"og:description"
>
<meta
content=
'https://vbcms.net/vbcms-admin/images/vbcms-logo/raccoon-in-box-512x.png'
property=
'og:image'
>
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
integrity=
"sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2"
crossorigin=
"anonymous"
>
<script
src=
"https://code.jquery.com/jquery-3.5.1.min.js"
></script>
<!-- Intégration de JS Snackbar -->
<link
rel=
"stylesheet"
href=
"https://vbcms.net/vbcms-admin/vendors/js-snackbar/css/js-snackbar.css?v=2.0.0"
/>
<script
src=
"https://vbcms.net/vbcms-admin/vendors/js-snackbar/js/js-snackbar.js?v=1.2.0"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://vbcms.net/vbcms-admin/fonts/fonts.css"
>
</head>
<body>
<style
type=
"text/css"
>
:root
{
--mainBrown
:
#bf946f
;
--secondaryBrown
:
#a77c58
;
--darkBrown
:
#74492a
;
--darkerBrown
:
#5c351f
;
--lightMB
:
#d3ab89
;
}
::-webkit-scrollbar
{
width
:
5px
;
height
:
7px
;
}
::-webkit-scrollbar-button
{
width
:
0px
;
height
:
0px
;
}
::-webkit-scrollbar-corner
{
background
:
transparent
;
}
::-webkit-scrollbar-thumb
{
background
:
#525965
;
border
:
0px
none
#ffffff
;
border-radius
:
0px
;
}
::-webkit-scrollbar-track
{
background
:
transparent
;
border
:
0px
none
#ffffff
;
border-radius
:
50px
;
}
html
{
height
:
100%
}
body
{
font-size
:
14px
;
font-family
:
'Inter'
,
sans-serif
;
/*background-image: url("https://vbcms.net/vbcms-admin/images/general/vbcms-illustration1.jpg");*/
background
:
rgb
(
167
,
124
,
88
);
background
:
-
moz-linear-gradient
(
180deg
,
rgba
(
167
,
124
,
88
,
1
)
0%
,
rgba
(
116
,
73
,
42
,
1
)
100%
);
background
:
-
webkit-linear-gradient
(
180deg
,
rgba
(
167
,
124
,
88
,
1
)
0%
,
rgba
(
116
,
73
,
42
,
1
)
100%
);
background
:
linear-gradient
(
180deg
,
rgba
(
167
,
124
,
88
,
1
)
0%
,
rgba
(
116
,
73
,
42
,
1
)
100%
);
background-size
:
cover
;
background-position
:
center
;
}
ul
{
list-style
:
none
;
}
.btn-brown
{
color
:
#fff
;
background-color
:
var
(
--mainBrown
);
border-color
:
var
(
--mainBrown
);
}
.btn-brown
:hover
{
color
:
#fff
;
background-color
:
var
(
--lightMB
);
border-color
:
var
(
--lightMB
);
}
.btn-brown
:focus
,
.btn-brown.focus
{
color
:
#fff
;
background-color
:
var
(
--darkerBrown
);
border-color
:
var
(
--darkerBrown
);
box-shadow
:
0
0
0
0.2rem
rgba
(
167
,
124
,
88
,
0.5
);
}
.btn-brown.disabled
,
.btn-brown
:disabled
{
color
:
#fff
;
background-color
:
var
(
--secondaryBrown
);
border-color
:
var
(
--secondaryBrown
);
}
.btn-brown
:not
(
:disabled
)
:not
(
.disabled
)
:active
,
.btn-brown
:not
(
:disabled
)
:not
(
.disabled
)
.active
,
.show
>
.btn-brown.dropdown-toggle
{
color
:
#fff
;
background-color
:
var
(
--secondaryBrown
);
border-color
:
var
(
--secondaryBrown
);
}
.btn-brown
:not
(
:disabled
)
:not
(
.disabled
)
:active:focus
,
.btn-brown
:not
(
:disabled
)
:not
(
.disabled
)
.active
:focus
,
.show
>
.btn-brown.dropdown-toggle
:focus
{
box-shadow
:
0
0
0
0.2rem
rgba
(
167
,
124
,
88
,
0.5
);
}
.installDiv
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
1000px
;
height
:
600px
;
background-color
:
white
;
border-radius
:
5px
;
overflow
:
hidden
;
box-shadow
:
0px
0px
5px
0px
rgba
(
0
,
0
,
0
,
0.5
);
}
.installDiv
.header
{
position
:
relative
;
display
:
flex
;
width
:
100%
;
height
:
50px
;
background-color
:
var
(
--mainBrown
);
align-items
:
center
;
}
.installDiv
.header
img
{
margin-left
:
5px
;
margin-right
:
5px
;
}
.installDiv
.header
span
{
font-family
:
"Linotype Kaliber Bold"
;
font-size
:
1.2em
;
color
:
white
;
}
#installStateTitle
{
position
:
absolute
;
width
:
100%
;
text-align
:
center
;
}
.installContent
{
height
:
100%
;
}
.centerItems
{
position
:
absolute
;
margin
:
0
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
text-align
:
center
;
}
</style>
<div
class=
"installDiv"
>
<div
class=
"header"
>
<img
height=
"45"
src=
"https://vbcms.net/vbcms-admin/images/vbcms-logo/raccoon-in-box-128x.png"
alt=
"vbcms-logo"
>
<span>
VBcms
</span><span
id=
"installStateTitle"
>
Mise à jour en cours
</span>
</div>
<div
class=
"content"
>
<div
class=
"p-2"
>
<h3>
Nous configurons votre installation
</h3>
<p>
Veuillez patienter quelques instants, vous serez automatiquement redirigé une fois la configuration terminée. :D
</p>
</div>
</div>
</div>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
.
get
(
"
install.php?silentUpdate
"
,
function
(
data
)
{
console
.
log
(
"
data=
"
+
data
);
if
(
data
!=
""
)
{
SnackBar
({
message
:
"
Echec lors de la configuration du site:
"
+
data
,
status
:
"
danger
"
,
timeout
:
false
});
}
else
{
$
.
get
(
"
install.php?deleteUpdateFile
"
,
function
(
data
)
{
console
.
log
(
"
data=
"
+
data
);
if
(
data
!=
""
)
{
SnackBar
({
message
:
"
La mise à jour a réussie, mais nous n'avons pas réussi à supprimer update.php:
"
+
data
,
status
:
"
danger
"
,
timeout
:
false
});
}
else
{
window
.
location
.
replace
(
"
/vbcms-admin
"
);
}
});
}
});
});
</script>
</body>
</html>
<?php
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
vbcms-admin/backTasks.php
+
10
−
4
View file @
7c2f0f75
...
...
@@ -76,20 +76,26 @@ if (isset($_GET["enableWSAddon"]) && !empty($_GET["enableWSAddon"])) {
$updateInfosData
=
json_decode
(
$updateInfos
,
true
);
$updateFilename
=
$GLOBALS
[
'vbcmsRootPath'
]
.
"/vbcms-content/updates/vbcms-update-v"
.
$updateInfosData
[
'version'
]
.
"_from-"
.
$vbcmsVer
.
".zip"
;
echo
$updateInfosData
[
"downloadLink"
]
.
"?serverId="
.
$serverId
.
"&key="
.
$key
;
if
(
!
file_exists
(
$GLOBALS
[
'vbcmsRootPath'
]
.
"/vbcms-content/updates"
))
mkdir
(
$GLOBALS
[
'vbcmsRootPath'
]
.
"/vbcms-content/updates"
,
0755
);
//echo $updateInfosData["downloadLink"]."?serverId=".$serverId."&key=".$key;
file_put_contents
(
$updateFilename
,
file_get_contents
(
$updateInfosData
[
"downloadLink"
]
.
"?serverId="
.
$serverId
.
"&key="
.
$key
));
if
(
file_exists
(
$updateFilename
))
{
$zip
=
new
ZipArchive
;
if
(
$zip
->
open
(
$updateFilename
)
===
TRUE
)
{
$zip
->
extractTo
(
$GLOBALS
[
'vbcmsRootPath'
]);
$zip
->
close
();
echo
"Mise à jour effectuée"
;
$response
[
"sucess"
]
=
true
;
$response
[
"link"
]
=
$GLOBALS
[
'vbcmsRootPath'
]
.
"/update.php"
;
}
else
{
echo
'Impossible d\'ouvrir l\'archive'
;
$response
[
"sucess"
]
=
false
;
$response
[
"code"
]
=
1
;
// Impossible d'ouvrir l'archive
}
}
else
{
echo
"Impossible de télécharger VBcms"
;
$response
[
"sucess"
]
=
false
;
$response
[
"code"
]
=
0
;
// Impossible de télécharger la màj
}
echo
json_encode
(
$response
);
}
else
{
?>
<!DOCTYPE html>
<html>
...
...
This diff is collapsed.
Click to expand it.
vbcms-admin/updater.php
+
6
−
6
View file @
7c2f0f75
...
...
@@ -128,17 +128,17 @@ if ($isUpToDate == 1) {
async
function
updateVBcms
(){
$
.
get
(
"
<?=
$websiteUrl
?>
vbcms-admin/backTasks?updateVBcms
"
,
function
(
data
)
{
console
.
log
(
"
data=
"
+
data
);
if
(
data
!
=
""
)
{
if
(
data
=
=
""
)
{
SnackBar
({
message
:
"
Impossible d
e
m
et
tre à jour VBcms
:
"
+
data
,
message
:
"
backTasks n
e
r
et
ourne rien
:
"
+
data
,
status
:
"
danger
"
,
timeout
:
false
});
}
else
{
SnackBar
({
message
:
"
La mise à jour va débuter dans quelques instants
"
,
status
:
"
sucess
"
});
console
.
log
(
details
)
details
=
JSON
.
parse
(
data
);
console
.
log
(
details
)
//if (details.success) {}
}
});
}
...
...
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