Skip to content

Commit

Permalink
These are other possible cases where invalidate the opcache is a good…
Browse files Browse the repository at this point in the history
… thing

Signed-off-by: emanuele <emanuele45@gmail.com>
  • Loading branch information
emanuele45 committed May 19, 2015
1 parent 73caf84 commit ac9f3f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sources/admin/ManageLanguages.controller.php
Expand Up @@ -13,7 +13,7 @@
* copyright: 2011 Simple Machines (http://www.simplemachines.org)
* license: BSD, See included LICENSE.TXT for terms and conditions.
*
* @version 1.0.2
* @version 1.0.4
*
*/

Expand Down Expand Up @@ -793,6 +793,9 @@ public function action_editlang()
fwrite($fp, $current_data);
fclose($fp);

if (function_exists('opcache_invalidate'))
opcache_invalidate($settings['default_theme_dir'] . '/languages/' . $context['lang_id'] . '/index.' . $context['lang_id'] . '.php');

$madeSave = true;
}

Expand Down Expand Up @@ -997,6 +1000,9 @@ public function action_editlang()
fwrite($fp, strtr($file_contents, array("\r" => '')));
fclose($fp);

if (function_exists('opcache_invalidate'))
opcache_invalidate($current_file);

$madeSave = true;
}

Expand Down
9 changes: 9 additions & 0 deletions sources/admin/ManageThemes.controller.php
Expand Up @@ -1607,6 +1607,9 @@ private function _action_edit_submit()
fwrite($fp, $entire_file);
fclose($fp);

if (function_exists('opcache_invalidate'))
opcache_invalidate($theme_dir . '/' . $_REQUEST['filename']);

// We're done here.
redirectexit('action=admin;area=theme;th=' . $selectedTheme . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=browse;directory=' . dirname($_REQUEST['filename']));
}
Expand Down Expand Up @@ -1833,6 +1836,9 @@ public function action_copy()
fwrite($fp, file_get_contents($filename));
fclose($fp);

if (function_exists('opcache_invalidate'))
opcache_invalidate($filename);

redirectexit('action=admin;area=theme;th=' . $context['theme_id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=copy');
}
elseif (isset($_REQUEST['lang_file']) && preg_match('~^[^\./\\\\:\0]\.[^\./\\\\:\0]$~', $_REQUEST['lang_file']) != 0)
Expand All @@ -1848,6 +1854,9 @@ public function action_copy()
fwrite($fp, file_get_contents($filename));
fclose($fp);

if (function_exists('opcache_invalidate'))
opcache_invalidate($filename);

redirectexit('action=admin;area=theme;th=' . $context['theme_id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=copy');
}

Expand Down

0 comments on commit ac9f3f2

Please sign in to comment.