You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.4 KiB
78 lines
2.4 KiB
![]()
14 years ago
|
<?php
|
||
|
/* For licensing terms, see /license.txt */
|
||
|
/**
|
||
|
* @package chamilo.admin
|
||
|
*/
|
||
|
// resetting the course id
|
||
|
$cidReset = true;
|
||
|
|
||
![]()
9 years ago
|
require_once __DIR__.'/../inc/global.inc.php';
|
||
![]()
14 years ago
|
|
||
![]()
8 years ago
|
ini_set('memory_limit', -1);
|
||
|
ini_set('max_execution_time', 0);
|
||
|
|
||
![]()
14 years ago
|
// setting the section (for the tabs)
|
||
|
$this_section = SECTION_PLATFORM_ADMIN;
|
||
|
|
||
|
// Access restrictions
|
||
![]()
14 years ago
|
api_protect_admin_script(true);
|
||
![]()
14 years ago
|
|
||
|
// setting breadcrumbs
|
||
![]()
6 years ago
|
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Administration')];
|
||
![]()
14 years ago
|
|
||
![]()
9 years ago
|
$form = new FormValidator(
|
||
|
'archive_cleanup_form',
|
||
|
'post',
|
||
|
'',
|
||
|
'',
|
||
![]()
8 years ago
|
[],
|
||
![]()
9 years ago
|
FormValidator::LAYOUT_BOX
|
||
|
);
|
||
![]()
6 years ago
|
$form->addButtonSend(get_lang('Proceed with cleanup'));
|
||
![]()
14 years ago
|
|
||
|
if ($form->validate()) {
|
||
![]()
8 years ago
|
if (function_exists('opcache_reset')) {
|
||
|
opcache_reset();
|
||
|
}
|
||
|
|
||
![]()
7 years ago
|
$file = api_get_path(SYS_PUBLIC_PATH).'build/main.js';
|
||
|
if (file_exists($file)) {
|
||
|
unlink($file);
|
||
|
}
|
||
|
$dir = api_get_path(SYS_PUBLIC_PATH).'build';
|
||
|
$files = scandir($dir);
|
||
|
foreach ($files as $file) {
|
||
|
if (preg_match('/main\..*\.js/', $file)) {
|
||
|
unlink($dir.'/'.$file);
|
||
|
}
|
||
|
}
|
||
|
|
||
![]()
9 years ago
|
$archive_path = api_get_path(SYS_ARCHIVE_PATH);
|
||
|
$htaccess = @file_get_contents($archive_path.'.htaccess');
|
||
|
$result = rmdirr($archive_path, true, true);
|
||
![]()
7 years ago
|
if (false === $result) {
|
||
![]()
6 years ago
|
Display::addFlash(Display::return_message(get_lang('Cleanup of cache and temporary filesFailed'), 'error'));
|
||
![]()
7 years ago
|
} else {
|
||
![]()
6 years ago
|
Display::addFlash(Display::return_message(get_lang('The app/cache/ directory cleanup has been executed successfully.')));
|
||
![]()
7 years ago
|
}
|
||
![]()
9 years ago
|
try {
|
||
|
\Chamilo\CoreBundle\Composer\ScriptHandler::dumpCssFiles();
|
||
![]()
6 years ago
|
Display::addFlash(Display::return_message(get_lang('The styles and assets in the web/ folder have been refreshed.')));
|
||
![]()
9 years ago
|
} catch (Exception $e) {
|
||
![]()
6 years ago
|
Display::addFlash(Display::return_message(get_lang('The styles and assets in the web/ folder could not be refreshed, probably due to a permissions problem. Make sure the web/ folder is writeable by your web server.'), 'error'));
|
||
![]()
9 years ago
|
error_log($e->getMessage());
|
||
|
}
|
||
![]()
9 years ago
|
|
||
|
if (!empty($htaccess)) {
|
||
|
@file_put_contents($archive_path.'/.htaccess', $htaccess);
|
||
|
}
|
||
![]()
9 years ago
|
|
||
![]()
9 years ago
|
header('Location: '.api_get_self());
|
||
|
exit;
|
||
![]()
14 years ago
|
}
|
||
|
|
||
![]()
6 years ago
|
Display::display_header(get_lang('Cleanup of cache and temporary files'));
|
||
|
echo Display::return_message(get_lang('Cleanup of cache and temporary filesDescr'), 'warning');
|
||
![]()
14 years ago
|
$form->display();
|
||
![]()
11 years ago
|
Display::display_footer();
|