Skip to content
Permalink
Browse files

Polish and fixes for language cache -- addresses bug 2891

  • Loading branch information...
martinlanghoff
martinlanghoff committed Apr 20, 2005
1 parent 80d8a1b commit d6ead3a251878a064b65504021edd32d85deff51
Showing with 41 additions and 8 deletions.
  1. +3 −0 admin/configvars.php
  2. +6 −5 admin/cron.php
  3. +1 −0 admin/index.php
  4. +1 −0 lang/en/admin.php
  5. +1 −0 lib/adminlib.php
  6. +21 −0 lib/moodlelib.php
  7. +8 −3 lib/setup.php
@@ -220,6 +220,9 @@ function display_warning() {
$interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'),
'<input name="langlist" type="text" size="60" value="'.s($config->langlist).'" alt="langlist" />' );
/// language menu
$interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
/// locale
$interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
'<input name="locale" type="text" size="10" value="'.s($config->locale).'" alt="locale" />' );
@@ -69,6 +69,12 @@
}
mtrace("Finished activity modules");
if (!empty($CFG->langcache)) {
mtrace('Updating languages cache');
get_list_of_languages();
}
/// Run all core cron jobs, but not every time since they aren't too important.
/// These don't have a timer to reduce load, so we'll use a random number
/// to randomly choose the percentage of times we should run these jobs.
@@ -121,11 +127,6 @@
}
flush();
if (!empty($CFG->langcache)) {
get_list_of_languages();
}
flush();
if (!empty($CFG->notifyloginfailures)) {
notify_login_failures();
}
@@ -153,6 +153,7 @@
if (main_upgrade($CFG->version)) {
$db->debug=false;
if (set_config("version", $version)) {
remove_dir($CFG->dataroot . '/cache', true); // flush cache
notify($strdatabasesuccess, "green");
print_continue("index.php");
exit;
@@ -47,6 +47,7 @@
$string['configlangdir'] = 'Most languages are printed left-to-right, but some, like Arabic and Hebrew, are printed right-to-left.';
$string['configlanglist'] = 'Leave this blank to allow users to choose from any language you have in this installation of Moodle. However, you can shorten the language menu by entering a comma-separated list of language codes that you want. For example: en,es_es,fr,it';
$string['configlangmenu'] = 'Choose whether or not you want to display the general-purpose language menu on the home page, login page etc. This does not affect the user\'s ability to set the preferred language in their own profile.';
$string['configlangcache'] = 'Cache the language menu. Saves a lot of memory and processing power. If you enable this, the menu takes a few minutes to update after you have added or removed languages.';
$string['configlocale'] = 'Choose a sitewide locale - this will affect the format and language of dates. You need to have this locale data installed on your operating system. (eg en_US or es_ES). If you don\'t know what to choose leave it blank.';
$string['configloginhttps'] = 'Turning this on will make Moodle use a secure https connection just for the login page (providing a secure login), and then afterwards revert back to the normal http URL for general speed. CAUTION: this setting REQUIRES https to be specifically enabled on the web server - if it is not then YOU COULD LOCK YOURSELF OUT OF YOUR SITE.';
$string['configloglifetime'] = 'This specifies the length of time you want to keep logs about user activity. Logs that are older than this age are automatically deleted. It is best to keep logs as long as possible, in case you need them, but if you have a very busy server and are experiencing performance problems, then you may want to lower the log lifetime.';
@@ -180,6 +180,7 @@ function upgrade_activity_modules($return) {
if (! update_record('modules', $module)) {
error('Could not update '. $module->name .' record in modules table!');
}
remove_dir($CFG->dataroot . '/cache', true); // flush cache
notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
echo '<hr />';
} else {
@@ -6047,5 +6047,26 @@ function file_get_contents($file) {
}
function remove_dir($dir, $content_only=false) {
// if content_only=true then delete all but
// the directory itself
$handle = opendir($dir);
while (false!==($item = readdir($handle))) {
if($item != '.' && $item != '..') {
if(is_dir($dir.'/'.$item)) {
remove_dir($dir.'/'.$item);
}else{
unlink($dir.'/'.$item);
}
}
}
closedir($handle);
if ($content_only) {
return true;
}
return rmdir($dir);
}
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
?>
@@ -179,14 +179,19 @@
$CFG->directorypermissions = 0777; // Must be octal (that's why it's here)
}
/// Setup cache dir for Smarty and others
if (!file_exists($CFG->dataroot .'/cache')) {
make_upload_directory('cache');
}
/// Set up smarty template system
//require_once($CFG->libdir .'/smarty/Smarty.class.php');
//$smarty = new Smarty;
//$smarty->template_dir = $CFG->dirroot .'/templates/'. $CFG->template;
//if (!file_exists($CFG->dataroot .'/cache')) {
// make_upload_directory('cache');
//if (!file_exists($CFG->dataroot .'/cache/smarty')) {
// make_upload_directory('cache/smarty');
//}
//$smarty->compile_dir = $CFG->dataroot .'/cache';
//$smarty->compile_dir = $CFG->dataroot .'/cache/smarty';
/// Set up session handling
if(empty($CFG->respectsessionsettings)) {

0 comments on commit d6ead3a

Please sign in to comment.
You can’t perform that action at this time.