Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
ae2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antoine
ae2
Commits
00f2411c
Commit
00f2411c
authored
Feb 04, 2015
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add script to refresh taiste db
parent
7ad64b2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
4 deletions
+57
-4
rootplace/prod_cron.php
rootplace/prod_cron.php
+57
-4
No files found.
rootplace/prod_cron.php
View file @
00f2411c
...
...
@@ -23,7 +23,8 @@
*/
define
(
"PROD_CRON"
,
"/var/www/cron_update.sh"
);
define
(
"PROD_SCRIPT"
,
"/var/www/update-official-www.sh"
);
define
(
"POST_COMMIT_SCRIPT"
,
"/data/svn/aeinfo/ae2/hooks/post-commit"
);
define
(
"POST_COMMIT_SCRIPT"
,
"/data/svn/ae2/hooks/post-commit"
);
define
(
"REFRESH_TAISTE"
,
"/var/www/refresh-taiste-database.sh"
);
$topdir
=
"../"
;
require_once
(
$topdir
.
"include/site.inc.php"
);
...
...
@@ -36,8 +37,10 @@ if ( !$site->user->is_in_group("root") )
$site
->
start_page
(
"none"
,
"Administration / passage en prod"
);
$cts
=
new
contents
(
"<a href=
\"
./
\"
>Administration</a> / Passage en production"
);
$tabs
=
array
(
array
(
""
,
"rootplace/prod_cron.php"
,
"Passage en prod"
),
array
(
""
,
"rootplace/prod_cron.php?view=refreshdb"
,
"Rafraichir taiste"
),
array
(
"script"
,
"rootplace/prod_cron.php?view=script"
,
"Script de passage en prod"
),
array
(
"commit"
,
"rootplace/prod_cron.php?view=commit"
,
"Script de post commit"
));
array
(
"commit"
,
"rootplace/prod_cron.php?view=commit"
,
"Script de post commit"
),
array
(
"clone"
,
"rootplace/prod_cron.php?view=refreshdbscript"
,
"Script de refresh de taiste"
));
if
(
$_REQUEST
[
"action"
]
==
"passprod"
&&
$GLOBALS
[
"svalid_call"
]
)
{
...
...
@@ -45,6 +48,12 @@ if ( $_REQUEST["action"] == "passprod" && $GLOBALS["svalid_call"] )
@
exec
(
escapeshellcmd
(
PROD_CRON
));
$Ok
=
true
;
}
if
(
$_REQUEST
[
"action"
]
==
"refreshdb"
&&
$GLOBALS
[
"svalid_call"
]
)
{
if
(
$site
->
is_sure
(
""
,
"Rafraichir taiste"
,
null
,
2
)
)
@
exec
(
escapeshellcmd
(
REFRESH_TAISTE
));
$Ok
=
true
;
}
if
(
$_REQUEST
[
"action"
]
==
"scriptprod"
&&
$GLOBALS
[
"svalid_call"
]
)
{
if
(
$site
->
is_sure
(
""
,
"Modification du script de passage en production"
,
null
,
2
)
)
...
...
@@ -77,7 +86,22 @@ if ( $_REQUEST["action"] == "scriptpostcommit" && $GLOBALS["svalid_call"] )
}
}
}
if
(
$_REQUEST
[
"action"
]
==
"refreshdbscript"
&&
$GLOBALS
[
"svalid_call"
]
)
{
if
(
$site
->
is_sure
(
""
,
"Modification du script de refresh de taiste"
,
null
,
2
)
)
{
if
(
!
$handle
=
@
fopen
(
REFRESH_TAISTE
,
"w"
))
$Ok
=
false
;
else
{
$content
=
preg_replace
(
"/
\r\n
/"
,
"
\n
"
,
htmlspecialchars_decode
(
$_REQUEST
[
"__script__"
]));
@
fwrite
(
$handle
,
$content
);
@
fclose
(
$handle
);
$_REQUEST
[
"view"
]
=
"script"
;
$Ok
=
true
;
}
}
}
$cts
->
add
(
new
tabshead
(
$tabs
,
$_REQUEST
[
"view"
]));
$cts
->
add_paragraph
(
"Révision en production : "
.
get_rev
());
...
...
@@ -88,6 +112,8 @@ if ( $Ok )
$cts
->
add_paragraph
(
"Script de passage en prod modifié"
);
elseif
(
$_REQUEST
[
"action"
]
==
"commit"
)
$cts
->
add_paragraph
(
"Script de post commit modifié"
);
elseif
(
$_REQUEST
[
"action"
]
==
"refreshdbscript"
)
$cts
->
add_paragraph
(
"Script de refresh modifié"
);
}
if
(
$_REQUEST
[
"view"
]
==
"script"
)
...
...
@@ -105,7 +131,7 @@ if($_REQUEST["view"]=="script")
$cts
->
add
(
$frm
,
true
);
}
}
if
(
$_REQUEST
[
"view"
]
==
"commit"
)
else
if
(
$_REQUEST
[
"view"
]
==
"commit"
)
{
if
(
!
$handle
=
@
fopen
(
POST_COMMIT_SCRIPT
,
"r"
))
$cts
->
add_paragraph
(
"Impossible d'ouvrir le script de post commit !"
);
...
...
@@ -120,6 +146,33 @@ if($_REQUEST["view"]=="commit")
$cts
->
add
(
$frm
,
true
);
}
}
else
if
(
$_REQUEST
[
"view"
]
==
"refreshdbscript"
)
{
if
(
!
$handle
=
@
fopen
(
REFRESH_TAISTE
,
"r"
))
$cts
->
add_paragraph
(
"Impossible d'ouvrir le script de rafraichissement !"
);
else
{
$script
=
@
fread
(
$handle
,
@
filesize
(
REFRESH_TAISTE
));
$frm
=
new
form
(
"refreshdbscript"
,
"prod_cron.php"
,
false
,
"POST"
,
"Editer le script de refresh de taiste"
);
$frm
->
allow_only_one_usage
();
$frm
->
add_hidden
(
"action"
,
"refreshdbscript"
);
$frm
->
add_text_area
(
"__script__"
,
"Script : "
,
$script
,
80
,
40
);
$frm
->
add_submit
(
"valid"
,
"Valider"
);
$cts
->
add
(
$frm
,
true
);
}
}
else
if
(
$_REQUEST
[
"view"
]
==
"refreshdb"
)
{
if
(
$_REQUEST
[
"action"
]
==
"refreshdb"
&&
$Ok
)
{
$cts
->
add_paragraph
(
"<b>Fafraichissement programmé dans les deux minutes à venir.</b>"
);
}
else
{
$frm
=
new
form
(
"refreshdb"
,
"prod_cron.php"
,
false
,
"POST"
,
"Rafraichir la BDD de taiste"
);
$frm
->
allow_only_one_usage
();
$frm
->
add_hidden
(
"action"
,
"refreshdb"
);
$frm
->
add_submit
(
"valid"
,
"Valider"
);
$cts
->
add
(
$frm
,
true
);
}
}
else
{
if
(
$_REQUEST
[
"action"
]
==
"passprod"
&&
$Ok
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment