コード例 #1
0
 /**
  * Delete mailing list
  * - list and archives are deleted
  * - backup first in temp directory
  * @return true on success, false otherwise
  */
 public function deleteList($group_list_id)
 {
     $dar = $this->_getMailingListDao()->searchByGroupListId($group_list_id);
     if ($row = $dar->getRow()) {
         $list = new MailingList($row);
         $list_dir = $GLOBALS['mailman_list_dir'] . "/" . $list->getListName();
         if (is_dir($list_dir) && $list->getIsPublic() == 9) {
             // Archive first
             $list_archive_dir = $GLOBALS['mailman_list_dir'] . "/../archives/private/" . $list->getListName();
             // Does it work? TODO
             $backupfile = ForgeConfig::get('sys_project_backup_path') . "/" . $list->getListName() . "-mailman.tgz";
             system("tar cfz {$backupfile} {$list_dir} {$list_archive_dir}");
             chmod($backupfile, 0600);
             // Delete the mailing list if asked to and the mailing exists (archive deleted as well)
             system($GLOBALS['mailman_bin_dir'] . '/rmlist -a ' . $list->getListName() . ' >/dev/null');
             return $this->_getMailingListDao()->deleteListDefinitively($group_list_id);
         }
     }
     return false;
 }