Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
M
maintenanceMode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SondagesPro
coreAndTools
maintenanceMode
Commits
17130b35
Commit
17130b35
authored
Jul 17, 2019
by
Chenu Denis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[feature] Show better warning message in plugin manager
parent
72764aad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
6 deletions
+40
-6
maintenanceMode.php
maintenanceMode.php
+40
-6
No files found.
maintenanceMode.php
View file @
17130b35
...
...
@@ -6,7 +6,7 @@
* @copyright 2017-2019 Denis Chenu <http://www.sondages.pro>
* @license AGPL v3
* @version 1.
4
.0
* @version 1.
5
.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
...
...
@@ -64,7 +64,7 @@ class maintenanceMode extends PluginBase {
if
(
intval
(
App
()
->
getConfig
(
'versionnumber'
))
<
3
)
{
return
;
}
$this
->
subscribe
(
'beforeActivate'
);
$oRenderMessage
=
Plugin
::
model
()
->
find
(
"name=:name"
,
array
(
":name"
=>
'renderMessage'
));
if
(
!
$oRenderMessage
||
!
$oRenderMessage
->
active
)
{
$this
->
subscribe
(
'beforeControllerAction'
,
'addFlashMessage'
);
...
...
@@ -74,10 +74,8 @@ class maintenanceMode extends PluginBase {
$this
->
subscribe
(
'beforeControllerAction'
);
/* disable login for admin */
$this
->
subscribe
(
'newUserSession'
);
/* Disable mail send */
$this
->
subscribe
(
'beforeTokenEmail'
);
$this
->
subscribe
(
'beforeActivate'
);
/* This need twigExtendByPlugins */
$this
->
subscribe
(
'getPluginTwigPath'
);
...
...
@@ -127,7 +125,26 @@ class maintenanceMode extends PluginBase {
*/
public
function
getPluginSettings
(
$getValues
=
true
)
{
$pluginSettings
=
parent
::
getPluginSettings
(
$getValues
);
$pluginSettings
=
parent
::
getPluginSettings
(
$getValues
);
/* Add a big warning about needed renderMessage */
$oRenderMessage
=
Plugin
::
model
()
->
find
(
"name=:name"
,
array
(
":name"
=>
'renderMessage'
));
if
(
!
$oRenderMessage
)
{
$warningRenderMessage
[
'warningRenderMessage'
]
=
array
(
'type'
=>
"info"
,
'content'
=>
CHtml
::
tag
(
"p"
,
array
(),
$this
->
gT
(
"You can not use maintenance mode with actual configuration."
))
.
CHtml
::
tag
(
"p"
,
array
(),
$this
->
gT
(
"You must download and activate renderMessage plugin"
)),
'class'
=>
"h3 alert alert-warning"
,
);
$pluginSettings
=
$warningRenderMessage
+
$pluginSettings
;
}
elseif
(
!
$oRenderMessage
->
active
)
{
$warningRenderMessage
[
'warningRenderMessage'
]
=
array
(
'type'
=>
"info"
,
'content'
=>
CHtml
::
tag
(
"p"
,
array
(),
$this
->
gT
(
"You can not use maintenance mode with actual configuration."
))
.
CHtml
::
tag
(
"p"
,
array
(),
$this
->
gT
(
"You must and activate renderMessage plugin"
)),
'class'
=>
"h3 alert alert-warning"
,
);
$pluginSettings
=
$warningRenderMessage
+
$pluginSettings
;
}
$aDateFormatData
=
getDateFormatData
(
Yii
::
app
()
->
session
[
'dateformat'
]);
if
(
$getValues
){
if
(
!
empty
(
$pluginSettings
[
'dateTime'
][
'current'
])){
...
...
@@ -327,6 +344,23 @@ class maintenanceMode extends PluginBase {
parent
::
saveSettings
(
$settings
);
}
/**
* @inheritdoc
*/
public
static
function
getDescription
()
{
$oRenderMessage
=
Plugin
::
model
()
->
find
(
"name=:name"
,
array
(
":name"
=>
'renderMessage'
));
if
(
!
$oRenderMessage
)
{
return
"You must download and activate renderMessage plugin to use maintenanceMode."
;
}
if
(
!
$oRenderMessage
->
active
)
{
return
"You must activate renderMessage plugin to use maintenanceMode."
;
}
// Unable to use $this since we are in a static function.
return
"Put your LimeSurvey instance on maintenance mode , allow admin access or not."
;
}
/**
* Return if website are in maintenance mode
* @return boolean
...
...
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