* Hold an instance of the class
*/
protected static $_instance;
-
+
/**
* Backends are singletons
*/
public static function instance() {
-
+
if (!isset(self::$_instance)) {
$c = __CLASS__;
self::$_instance = new $c;
}
- /**
+ /**
* Update mailman configuration for the given list
* Write configuration in temporary file, and load it with mailman config_list tool
* @return true on success, false otherwise
protected function updateListConfig($list) {
// write configuration in temporary file
$config_file=$GLOBALS['tmp_dir']."/mailman_config_".$list->getID().".in";
-
+
if ($fp = fopen($config_file, 'w')) {
- // Define encoding of this file for Python. See SR #764
- // Please note that this allows config_list to run with UTF-8 strings, but if the
+ // Define encoding of this file for Python. See SR #764
+ // Please note that this allows config_list to run with UTF-8 strings, but if the
// description contains non-ascii chars, they will be displayed badly in mailman config web page.
fwrite($fp, "# coding=UTF-8\n\n");
// Deactivate monthly reminders by default
fwrite($fp, "description = '".addslashes($list->getDescription())."'\n");
// Allow up to 200 kB messages
fwrite($fp, "max_message_size = 200\n");
-
+
if ($list->isPublic() == 0) { // Private lists
// Don't advertise this list when people ask what lists are on this machine
fwrite($fp, "advertised = False\n");
fwrite($fp, "subscribe_policy = 2\n");
}
fclose($fp);
-
+
if (system($GLOBALS['mailman_bin_dir']."/config_list -i $config_file ".$list->getName()) !== false) {
if (unlink($config_file)) {
return true;
if (!$result) {
printf('Unable to update the list status: '.db_error());
return false;
- }
+ }
else {
return true;
}
if (!$result) {
printf('Unable to update the list status: '.db_error());
return false;
- }
+ }
else {
return true;
}
}
/**
- * Delete mailing list
+ * Delete mailing list
* - list and archives are deleted
* - backup first in temp directory
* @return true on success, false otherwise