Skip to content

Commit 919b956

Browse files
committed
Fix de la version en db - Correction ortho - Ajout du dataType pour l'update
1 parent f01af21 commit 919b956

5 files changed

Lines changed: 50 additions & 5 deletions

File tree

app/Config/core.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* In production mode, flash messages redirect after a time interval.
3232
* In development mode, you need to click the flash message to continue.
3333
*/
34-
Configure::write('debug', 3);
34+
Configure::write('debug', 0);
3535

3636
/**
3737
* Configure the Error handler used to handle errors for your application. By default
@@ -356,7 +356,7 @@
356356
$engine = 'File';
357357

358358
// In development mode, caches should expire quickly.
359-
$duration = '+999 days';
359+
$duration = '+2 hours';
360360
if (Configure::read('debug') > 0) {
361361
$duration = '+10 seconds';
362362
}

app/Controller/PluginController.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ function admin_delete($id = false) {
2020
if(isset($slug['Plugin']['name']) && $this->EyPlugin->delete($slug['Plugin']['name'])) {
2121
Cache::clearGroup('_cake_core_');
2222
Cache::clearGroup('_cake_model_');
23+
24+
App::uses('Folder', 'Utility');
25+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
26+
$folder->delete();
27+
2328
$this->History->set('DELETE_PLUGIN', 'plugin');
2429
$this->Session->setFlash($this->Lang->get('PLUGIN__DELETE_SUCCESS'), 'default.success');
2530
$this->redirect(array('controller' => 'plugin', 'action' => 'index', 'admin' => true));
@@ -42,6 +47,11 @@ function admin_enable($id = false) {
4247
if($this->EyPlugin->enable($id)) {
4348
Cache::clearGroup('_cake_core_');
4449
Cache::clearGroup('_cake_model_');
50+
51+
App::uses('Folder', 'Utility');
52+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
53+
$folder->delete();
54+
4555
$this->History->set('ENABLE_PLUGIN', 'plugin');
4656
$this->Session->setFlash($this->Lang->get('PLUGIN__ENABLE_SUCCESS'), 'default.success');
4757
$this->redirect(array('controller' => 'plugin', 'action' => 'index', 'admin' => true));
@@ -64,6 +74,11 @@ function admin_disable($id = false) {
6474
if($this->EyPlugin->disable($id)) {
6575
Cache::clearGroup('_cake_core_');
6676
Cache::clearGroup('_cake_model_');
77+
78+
App::uses('Folder', 'Utility');
79+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
80+
$folder->delete();
81+
6782
$this->History->set('DISABLE_PLUGIN', 'plugin');
6883
$this->Session->setFlash($this->Lang->get('PLUGIN__DISABLE_SUCCESS'), 'default.success');
6984
$this->redirect(array('controller' => 'plugin', 'action' => 'index', 'admin' => true));
@@ -97,6 +112,10 @@ function admin_install($apiID = false, $slug = false) {
97112
Cache::clearGroup('_cake_core_');
98113
Cache::clearGroup('_cake_model_');
99114

115+
App::uses('Folder', 'Utility');
116+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
117+
$folder->delete();
118+
100119
echo json_encode(array(
101120
'statut' => 'success',
102121
'plugin' => array(
@@ -127,6 +146,11 @@ function admin_update($plugin_id) {
127146
if($updated === true) {
128147
Cache::clearGroup('_cake_core_');
129148
Cache::clearGroup('_cake_model_');
149+
150+
App::uses('Folder', 'Utility');
151+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
152+
$folder->delete();
153+
130154
$this->History->set('UPDATE_PLUGIN', 'plugin');
131155
$this->Session->setFlash($this->Lang->get('PLUGIN__UPDATE_SUCCESS'), 'default.success');
132156
$this->redirect(array('controller' => 'plugin', 'action' => 'index', 'admin' => true));

app/Controller/UpdateController.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ public function admin_index() { // ajout d'un commentaire pour git
3434
}
3535
}
3636

37+
public function admin_clear_cache() {
38+
if($this->isConnected && $this->User->isAdmin()) {
39+
$this->autoRender = false;
40+
41+
App::uses('Folder', 'Utility');
42+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
43+
$folder->delete();
44+
45+
$this->redirect(array('action' => 'index'));
46+
} else {
47+
throw new ForbiddenException();
48+
}
49+
}
50+
3751
public function admin_update($componentUpdated = '0') {
3852
if($this->isConnected AND $this->User->isAdmin()) {
3953
$this->response->type('json');
@@ -42,9 +56,13 @@ public function admin_update($componentUpdated = '0') {
4256
$componentUpdated = ($componentUpdated) ? true : false;
4357
if($this->Update->updateCMS($componentUpdated)) {
4458
if($componentUpdated == '1') {
59+
60+
App::uses('Folder', 'Utility');
61+
$folder = new Folder(ROOT.DS.'app'.DS.'tmp'.DS.'cache');
62+
$folder->delete();
63+
64+
$this->Configuration->setKey('version', $this->Update->update['version']);
4565
echo json_encode(array('statut' => 'success', 'msg' => $this->Lang->get('UPDATE__SUCCESS')));
46-
Cache::clearGroup('_cake_core_');
47-
Cache::clearGroup('_cake_model_');
4866
} else {
4967
echo json_encode(array('statut' => 'continue', 'msg' => ''));
5068
}

app/View/Update/admin_index.ctp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<p class="text-center"><?= $Lang->get('UPDATE__LAST_VERSION') ?> : <?= $Update->update['version'] ?></p>
1212
<div class="btn-group">
1313
<button id="update" class="btn btn-large btn-primary"><?= $Lang->get('GLOBAL__UPDATE') ?></button>
14+
<a class="btn btn-warning" href="<?= $this->Html->url(array('action' => 'clear_cache')) ?>"><?= $Lang->get('UPDATE__CLEAR_CACHE') ?></a>
1415
<a href="<?= $this->Html->url(array('action' => 'check')) ?>" class="btn btn-large btn-info"><?= $Lang->get('UPDATE__CHECK_STATUS') ?></a>
1516
<a href="http://mineweb.org/changelog" target="_blank" class="btn btn-large btn-default"><?= $Lang->get('UPDATE__VIEW_CHANGELOG') ?></a>
1617
</div>
@@ -78,6 +79,7 @@
7879
type: 'POST',
7980
url: '<?= $this->Html->url(array('action' => 'update')) ?>/'+updaterUpdated,
8081
data: inputs,
82+
dataType: 'JSON',
8183
success: function(data) {
8284

8385
if(data.statut == "success") {

lang/fr_FR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"GLOBAL__INFORMATIONS":"Informations",
1818
"GLOBAL__UPDATED":"Derni\u00e8re mise \u00e0 jour",
1919
"GLOBAL__CLOSE": "Fermer",
20-
"GLOBAL__CUSTOMIZE": "Personalisation",
20+
"GLOBAL__CUSTOMIZE": "Personnalisation",
2121
"GLOBAL__SUCCESS":"Succès",
2222
"GLOBAL__INFO":"Information",
2323
"GLOBAL__WARNING":"Attention",
@@ -443,6 +443,7 @@
443443
"UPDATE__FAILED": "La mise \u00e0 jour \u00e0 \u00e9chou\u00e9e",
444444
"UPDATE__SUCCESS": "La mise \u00e0 jour s'est bien d\u00e9roul\u00e9e",
445445
"UPDATE__LOADING": "Mise \u00e0 jour en cours ...",
446+
"UPDATE__CLEAR_CACHE":"Supprimer le cache (conseillé)",
446447

447448
"STATS__TITLE":"Statistiques",
448449
"STATS__NBR_VISITS":"Nombre de visites",

0 commit comments

Comments
 (0)