initial commit of file from CVS for smeserver-sogo on Sat Sep 7 16:42:51 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 16:42:51 +10:00
parent 6d95628cf6
commit ac311161a2
122 changed files with 3844 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
mkdir /home/e-smith/sogo &> /dev/null
/usr/sbin/sogo-tool backup /tmp/backup ALL &> /dev/null
tar cvzf /home/e-smith/sogo/backup.tgz -C /tmp/ backup &> /dev/null
rm -rf /tmp/backup &> /dev/null

View File

@@ -0,0 +1,16 @@
#!/bin/bash
EVENT=$1
USER=$2
if [ -z "$EVENT" ]; then
echo "event name is missing"
exit 1
fi
if [ -z "$USER" ]; then
echo "user account is missing"
exit 1
fi
su -l -s /bin/bash sogo -c "/usr/sbin/sogo-tool remove $USER" > /dev/null 2>&1

View File

@@ -0,0 +1,99 @@
#!/usr/bin/perl -w
#----------------------------------------------------------------------
# copyright (C) 2010 Nethesis srl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#----------------------------------------------------------------------
use strict;
use DBI;
use esmith::ConfigDB;
use esmith::util;
# Exit early if there is nothing to do
die("sogo db must exist") unless ( -d "/var/lib/mysql/sogo/");
die("sogo db must exist") unless ( -f "/var/lib/mysql/sogo/sogo_folder_info.frm");
# This is a translation of the script 'sql-update-1.2.2_to_1.3.0-mysql.sh'
# that is safe to run multiple times, and which can be run on a 1.2.2
# installation without barfing.
my $conf = esmith::ConfigDB->open_ro
or die "Can't open configuration database: $!\n";
our $username = 'sogo';
our $password = $conf->get_prop("sogod", "DbPassword") || '';
our $database = 'sogo';
our $dbi_options = { PrintError => 0, ChopBlanks => 1, AutoCommit => 1 };
my $db_handle = DBI->connect("DBI:mysql:$database",
$username, $password, $dbi_options) ||
die ("Connection error: $DBI::errstr");
my $folders_sth = $db_handle->prepare(qq{
SELECT SUBSTRING_INDEX(c_quick_location, '/', -1)
FROM sogo_folder_info WHERE c_folder_type = 'Appointment';
}) || die ("Unable to prepare query: $DBI::errstr");
$folders_sth->execute() || die ("Unable to execute query: $DBI::errstr");
while (my @folders_row = $folders_sth->fetchrow_array()) {
$db_handle->do(qq{
ALTER TABLE $folders_row[0] ADD COLUMN c_category VARCHAR(255);
});
}
# This is a translation of the script 'sql-update-1.3.3_to_1.3.4-mysql.sh'
# that is safe to run multiple times, and which can be run on a 1.2.2 or 1.3.2
# installation without barfing.
my $contacts_sth = $db_handle->prepare(qq{
SELECT SUBSTRING_INDEX(c_quick_location, '/', -1)
FROM sogo_folder_info where c_folder_type = 'Contact';
}) || die ("Unable to prepare query: $DBI::errstr");
$contacts_sth->execute() || die ("Unable to execute query: $DBI::errstr");
while (my @contacts_row = $contacts_sth->fetchrow_array()) {
$db_handle->do(qq{
ALTER TABLE $contacts_row[0] ADD COLUMN c_categories VARCHAR(255);
});
}
# This is a translation of the script sql-update-1.3.11_to_1.3.12-mysql.sh
# that is safe to run multiple times, and which can be run on a 1.2.2 or 1.3.9
# installation without barfing.
$db_handle->do(qq{
ALTER TABLE sogo_sessions_folder ADD PRIMARY KEY (c_id);
});
# This is a translation of the script sql-update-1.3.16_to_1.3.17-mysql.sh
# This script only works with mysql
# updates c_cycleinfo to mediumtext
#
my $tables_sth = $db_handle->prepare(qq{
SELECT SUBSTRING_INDEX(c_quick_location, '/', -1)
FROM sogo_folder_info where c_path3 = 'Calendar';
}) || die ("Unable to prepare query: $DBI::errstr");
$tables_sth->execute() || die ("Unable to execute query: $DBI::errstr");
while (my @table_row = $tables_sth->fetchrow_array()) {
$db_handle->do(qq{
ALTER TABLE $table_row[0] MODIFY c_cycleinfo mediumtext;
});
}

View File

@@ -0,0 +1,21 @@
#! /bin/sh
# This script updates c_partstates to mediumtext
# adds c_description to Calendar quick tables
# http://www.sogo.nu/bugs/view.php?id=3175
# the field length was actually changed in v2.2.18
for TABLE in $(/usr/bin/mysql sogo -s -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from sogo_folder_info where c_path3 = 'Calendar';"); do
/usr/bin/mysql sogo -e "ALTER TABLE $TABLE MODIFY c_partstates mediumtext;"
/usr/bin/mysql sogo <<EOF
DELIMITER ;;
CREATE PROCEDURE upgrade_230()
BEGIN
DECLARE CONTINUE HANDLER FOR 1060 BEGIN END;
ALTER TABLE $TABLE ADD COLUMN c_description mediumtext;
END;;
CALL upgrade_230();;
DROP PROCEDURE upgrade_230;
EOF
done