1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00

Merge pull request #23 from polytan02/master

Update z-push to use latest sources and extra things
This commit is contained in:
polytan02 2017-02-14 20:36:00 +00:00 committed by GitHub
commit 66a050ab6c
16 changed files with 292 additions and 245 deletions

View file

@ -1,8 +1,16 @@
# Z-Push For Yunohost # Z-Push For Yunohost
=========== * * *
### Known bug :
- [ ] z-push seems unable to create mailboxes folders. It means that you must send at least one email from roundcube or rainloop to have the mailboxes created. After than it all works fine.
* Z-push for Yunohost support IMAP sync and Carddav/Caldav sync if Baikal is installed ### Current status
* Ability to send calendar invitations - [x] Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal is installed
- [x] Ability to send calendar invitations
* The sources are based on https://github.com/fmbiete/Z-Push-contrib - [x] Use of push for emails, contacts and calendar
- [x] Sync States are now stored in /home/yunohost.app/$app
- [x] Logrotate has been activated as z-push can become noisy at times
- [x] After an upgrade, we now "fixstates" to avoid full resync of devices
- [x] z-push is now configured to use smtp to send emails instead of php_mail() function. This let us have emails signed by dkim for example.
- [x] The sources are based on http://download.z-push.org/final/
- [x] Use of version 2.3.4 final

View file

@ -6,29 +6,13 @@
* *
* Created : 27.11.2012 * Created : 27.11.2012
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2012 - 2014 Jean-Louis Dupond
*
* Jean-Louis Dupond released this code as AGPLv3 here: https://github.com/dupondje/PHP-Push-2/issues/93
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional * as published by the Free Software Foundation.
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -65,3 +49,8 @@ define('CALDAV_PERSONAL', 'default');
// SabreDav version must be at least 1.9.0, otherwise set this to false // SabreDav version must be at least 1.9.0, otherwise set this to false
// Setting this to false will work with most servers, but it will be slower // Setting this to false will work with most servers, but it will be slower
define('CALDAV_SUPPORTS_SYNC', false); define('CALDAV_SUPPORTS_SYNC', false);
// Maximum period to sync.
// Some servers don't support more than 10 years so you will need to change this
define('CALDAV_MAX_SYNC_PERIOD', 2147483647);

View file

@ -6,29 +6,11 @@
* *
* Created : 16.03.2013 * Created : 16.03.2013
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2013 - 2016 Francisco Miguel Biete
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional * as published by the Free Software Foundation.
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -65,6 +47,7 @@ define('CARDDAV_PORT', '443');
// Add the trailing / // Add the trailing /
define('CARDDAV_PATH', 'BAIKALPATH/card.php/addressbooks/%u/'); define('CARDDAV_PATH', 'BAIKALPATH/card.php/addressbooks/%u/');
// Server path to the default addressbook // Server path to the default addressbook
// Mobile device will create new contacts here. It must be under CARDDAV_PATH // Mobile device will create new contacts here. It must be under CARDDAV_PATH
// %u: replaced with the username // %u: replaced with the username
@ -77,10 +60,13 @@ define('CARDDAV_DEFAULT_PATH', 'BAIKALPATH/card.php/addressbooks/%u/default');
// %u: replaced with the username // %u: replaced with the username
// %d: replaced with the domain // %d: replaced with the domain
// Add the trailing / // Add the trailing /
define('CARDDAV_GAL_PATH', '');
//define('CARDDAV_GAL_PATH', '/caldav.php/%d/GAL/');
// Minimal length for the search pattern to do the real search. // Minimal length for the search pattern to do the real search.
define('CARDDAV_GAL_MIN_LENGTH', 5);
//define('CARDDAV_GAL_MIN_LENGTH', 5);
// Addressbook display name, the name showed in the mobile device // Addressbook display name, the name showed in the mobile device
// %u: replaced with the username // %u: replaced with the username

View file

@ -7,29 +7,11 @@
* *
* Created : 29.11.2010 * Created : 29.11.2010
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional * as published by the Free Software Foundation.
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -65,12 +47,12 @@ class BackendCombinedConfig {
'i' => array( 'i' => array(
'name' => 'BackendIMAP', 'name' => 'BackendIMAP',
), ),
'c' => array(
'name' => 'BackendCalDAV',
),
'd' => array( 'd' => array(
'name' => 'BackendCardDAV', 'name' => 'BackendCardDAV',
), ),
'l' => array(
'name' => 'BackendCalDAV',
),
), ),
'delimiter' => '/', 'delimiter' => '/',
//force one type of folder to one backend //force one type of folder to one backend
@ -81,24 +63,22 @@ class BackendCombinedConfig {
SYNC_FOLDER_TYPE_WASTEBASKET => 'i', SYNC_FOLDER_TYPE_WASTEBASKET => 'i',
SYNC_FOLDER_TYPE_SENTMAIL => 'i', SYNC_FOLDER_TYPE_SENTMAIL => 'i',
SYNC_FOLDER_TYPE_OUTBOX => 'i', SYNC_FOLDER_TYPE_OUTBOX => 'i',
SYNC_FOLDER_TYPE_TASK => 'c', SYNC_FOLDER_TYPE_TASK => 'l',
SYNC_FOLDER_TYPE_APPOINTMENT => 'c', SYNC_FOLDER_TYPE_APPOINTMENT => 'l',
SYNC_FOLDER_TYPE_CONTACT => 'd', SYNC_FOLDER_TYPE_CONTACT => 'd',
SYNC_FOLDER_TYPE_NOTE => 'c', SYNC_FOLDER_TYPE_NOTE => 'l',
SYNC_FOLDER_TYPE_JOURNAL => 'c', SYNC_FOLDER_TYPE_JOURNAL => 'l',
SYNC_FOLDER_TYPE_OTHER => 'i', SYNC_FOLDER_TYPE_OTHER => 'i',
SYNC_FOLDER_TYPE_USER_MAIL => 'i', SYNC_FOLDER_TYPE_USER_MAIL => 'i',
SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'c', SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'l',
SYNC_FOLDER_TYPE_USER_CONTACT => 'd', SYNC_FOLDER_TYPE_USER_CONTACT => 'd',
SYNC_FOLDER_TYPE_USER_TASK => 'c', SYNC_FOLDER_TYPE_USER_TASK => 'l',
SYNC_FOLDER_TYPE_USER_JOURNAL => 'c', SYNC_FOLDER_TYPE_USER_JOURNAL => 'l',
SYNC_FOLDER_TYPE_USER_NOTE => 'c', SYNC_FOLDER_TYPE_USER_NOTE => 'l',
SYNC_FOLDER_TYPE_UNKNOWN => 'i', SYNC_FOLDER_TYPE_UNKNOWN => 'i',
), ),
//creating a new folder in the root folder should create a folder in one backend //creating a new folder in the root folder should create a folder in one backend
'rootcreatefolderbackend' => 'i', 'rootcreatefolderbackend' => 'i',
//enable to use username mapping for the different backends
'usemapping' => false,
); );
} }
} }

View file

@ -6,29 +6,11 @@
* *
* Created : 27.11.2012 * Created : 27.11.2012
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional * as published by the Free Software Foundation.
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -52,10 +34,9 @@ define('IMAP_SERVER', 'localhost');
define('IMAP_PORT', 993); define('IMAP_PORT', 993);
// best cross-platform compatibility (see http://php.net/imap_open for options) // best cross-platform compatibility (see http://php.net/imap_open for options)
// Original :
//define('IMAP_OPTIONS', '/notls/norsh');
define('IMAP_OPTIONS', '/ssl/novalidate-cert'); define('IMAP_OPTIONS', '/ssl/novalidate-cert');
// Mark messages as read when moving to Trash. // Mark messages as read when moving to Trash.
// BE AWARE that you will lose the unread flag, but some mail clients do this so the Trash folder doesn't get boldened // BE AWARE that you will lose the unread flag, but some mail clients do this so the Trash folder doesn't get boldened
define('IMAP_AUTOSEEN_ON_DELETE', false); define('IMAP_AUTOSEEN_ON_DELETE', false);
@ -87,9 +68,10 @@ define('IMAP_AUTOSEEN_ON_DELETE', false);
// gmail is a special case, where the default folders are under the [gmail] prefix and the folders defined by the user are under INBOX. // gmail is a special case, where the default folders are under the [gmail] prefix and the folders defined by the user are under INBOX.
// This configuration seems to work: // This configuration seems to work:
// define('IMAP_FOLDER_PREFIX', ''); // define('IMAP_FOLDER_PREFIX', '');
// define('IMAP_FOLDER_PREFIX_IN_INBOX', false);
// define('IMAP_FOLDER_INBOX', 'INBOX'); // define('IMAP_FOLDER_INBOX', 'INBOX');
// define('IMAP_FOLDER_SENT', '[Gmail]/Sent'); // define('IMAP_FOLDER_SENT', '[Gmail]/Sent');
// define('IMAP_FOLDER_DRAFTS', '[Gmail]/Drafts'); // define('IMAP_FOLDER_DRAFT', '[Gmail]/Drafts');
// define('IMAP_FOLDER_TRASH', '[Gmail]/Trash'); // define('IMAP_FOLDER_TRASH', '[Gmail]/Trash');
// define('IMAP_FOLDER_SPAM', '[Gmail]/Spam'); // define('IMAP_FOLDER_SPAM', '[Gmail]/Spam');
// define('IMAP_FOLDER_ARCHIVE', '[Gmail]/All Mail'); // define('IMAP_FOLDER_ARCHIVE', '[Gmail]/All Mail');
@ -105,7 +87,7 @@ define('IMAP_FOLDER_PREFIX', '');
define('IMAP_FOLDER_PREFIX_IN_INBOX', false); define('IMAP_FOLDER_PREFIX_IN_INBOX', false);
// Inbox folder name (case doesn't matter) - (empty in 4) // Inbox folder name (case doesn't matter) - (empty in 4)
define('IMAP_FOLDER_INBOX', 'Inbox'); define('IMAP_FOLDER_INBOX', 'INBOX');
// Sent folder name (case doesn't matter) // Sent folder name (case doesn't matter)
define('IMAP_FOLDER_SENT', 'Sent'); define('IMAP_FOLDER_SENT', 'Sent');
@ -156,6 +138,8 @@ define('IMAP_FROM_SQL_USER', '');
define('IMAP_FROM_SQL_PASSWORD', ''); define('IMAP_FROM_SQL_PASSWORD', '');
define('IMAP_FROM_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true))); define('IMAP_FROM_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true)));
define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where mail_address = '#username@#domain'"); define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where mail_address = '#username@#domain'");
//A tester :
//define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where users = '#username@#domain'");
define('IMAP_FROM_SQL_FIELDS', serialize(array('first_name', 'last_name', 'mail_address'))); define('IMAP_FROM_SQL_FIELDS', serialize(array('first_name', 'last_name', 'mail_address')));
define('IMAP_FROM_SQL_FROM', '#first_name #last_name <#mail_address>'); define('IMAP_FROM_SQL_FROM', '#first_name #last_name <#mail_address>');
define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name'); define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name');
@ -173,11 +157,12 @@ define('IMAP_FROM_LDAP_SERVER_PORT', '389');
//define('IMAP_FROM_LDAP_PASSWORD', 'password'); //define('IMAP_FROM_LDAP_PASSWORD', 'password');
//define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org'); //define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org');
//define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)'); //define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)');
define('IMAP_FROM_LDAP_USER', ''); define('IMAP_FROM_LDAP_USER', '');
define('IMAP_FROM_LDAP_PASSWORD', ''); define('IMAP_FROM_LDAP_PASSWORD', '');
define('IMAP_FROM_LDAP_BASE', 'dc=yunohost,dc=org'); define('IMAP_FROM_LDAP_BASE', 'dc=yunohost,dc=org');
define('IMAP_FROM_LDAP_QUERY', '(mail=#username)'); //a revoir, le mail n'est pas le username ! exemple login : john email john.doe@domain.tld
//define('IMAP_FROM_LDAP_QUERY', '(mail=#username)');
define('IMAP_FROM_LDAP_QUERY', '(mail=#mail)');
define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail'))); define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail')));
define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>'); define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>');
@ -189,12 +174,12 @@ define('IMAP_FROM_LDAP_FULLNAME', '#givenname #sn');
// mail => mail() php function // mail => mail() php function
// sendmail => sendmail executable // sendmail => sendmail executable
// smtp => direct connection against SMTP // smtp => direct connection against SMTP
define('IMAP_SMTP_METHOD', 'mail'); define('IMAP_SMTP_METHOD', 'smtp');
global $imap_smtp_params; global $imap_smtp_params;
// SMTP Parameters // SMTP Parameters
// mail : no params // mail : no params
$imap_smtp_params = array(); //$imap_smtp_params = array();
// sendmail // sendmail
//$imap_smtp_params = array('sendmail_path' => '/usr/bin/sendmail', 'sendmail_args' => '-i'); //$imap_smtp_params = array('sendmail_path' => '/usr/bin/sendmail', 'sendmail_args' => '-i');
// smtp // smtp
@ -217,6 +202,8 @@ $imap_smtp_params = array();
// IMPORTANT: To use SSL you must use PHP 5.1 or later, install openssl libs and use ssl:// within the host variable // IMPORTANT: To use SSL you must use PHP 5.1 or later, install openssl libs and use ssl:// within the host variable
// IMPORTANT: To use SSL with PHP 5.6 you should set verify_peer, verify_peer_name and allow_self_signed // IMPORTANT: To use SSL with PHP 5.6 you should set verify_peer, verify_peer_name and allow_self_signed
//$imap_smtp_params = array('host' => 'ssl://localhost', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password'); //$imap_smtp_params = array('host' => 'ssl://localhost', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password');
$imap_smtp_params = array('host' => 'tcp://DOMAINTOCHANGE', 'port' => 587, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password', 'localhost' => 'DOMAINTOCHANGE', 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true);

View file

@ -6,29 +6,11 @@
* *
* Created : 01.10.2007 * Created : 01.10.2007
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional * as published by the Free Software Foundation.
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -53,10 +35,6 @@
// Try to set unlimited timeout // Try to set unlimited timeout
define('SCRIPT_TIMEOUT', 0); define('SCRIPT_TIMEOUT', 0);
// Your PHP could have a bug when base64 encoding: https://bugs.php.net/bug.php?id=68532
// NOTE: Run "php testing/testing-bug68532fixed.php" to know what value put here
define('BUG68532FIXED', false);
// When accessing through a proxy, the "X-Forwarded-For" header contains the original remote IP // When accessing through a proxy, the "X-Forwarded-For" header contains the original remote IP
define('USE_X_FORWARDED_FOR_HEADER', false); define('USE_X_FORWARDED_FOR_HEADER', false);
@ -64,74 +42,45 @@
// This setting specifies the owner parameter in the certificate to look at. // This setting specifies the owner parameter in the certificate to look at.
define("CERTIFICATE_OWNER_PARAMETER", "SSL_CLIENT_S_DN_CN"); define("CERTIFICATE_OWNER_PARAMETER", "SSL_CLIENT_S_DN_CN");
// Location of the trusted CA, e.g. '/etc/ssl/certs/EmailCA.pem'
// Uncomment and modify the following line if the validation of the certificates fails.
// define('CAINFO', '/etc/ssl/certs/EmailCA.pem');
/* /*
* Whether to use the complete email address as a login name * Whether to use the complete email address as a login name
* (e.g. user@company.com) or the username only (user). * (e.g. user@company.com) or the username only (user).
* This is required for Z-Push to work properly after autodiscover. * This is required for Z-Push to work properly after autodiscover.
* Possible values: * Possible values:
* false - use the username only (default). * false - use the username only.
* true - use the complete email address. * true - string the mobile sends as username, e.g. full email address (default).
*/ */
define('USE_FULLEMAIL_FOR_LOGIN', true); define('USE_FULLEMAIL_FOR_LOGIN', true);
/********************************************************************************** /**********************************************************************************
* Device pre-authorization. Useful when using Z-Push as a standalone product. * StateMachine setting
* *
* It will use the STATE_MACHINE specified below, to store the users/devices * These StateMachines can be used:
* FILE => STATE_DIR/PreAuthUserDevices * FILE - FileStateMachine (default). Needs STATE_DIR set as well.
* SQL => auth_users * SQL - SqlStateMachine has own configuration file. STATE_DIR is ignored.
* * State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa
* FALSE => default
* TRUE
*/
define('PRE_AUTHORIZE_USERS', false);
// New users are pre-authorized automatically
define('PRE_AUTHORIZE_NEW_USERS', false);
// New devices are pre-authorized automatically for pre-authorized users
define('PRE_AUTHORIZE_NEW_DEVICES', false);
// Max number of devices pre-authorized for user, you can pre-authorize more manually
define('PRE_AUTHORIZE_MAX_DEVICES', 5);
/**********************************************************************************
* Select StateMachine mechanism
*
* FILE => FileStateMachine, default
* SQL => SqlStateMachine
*/ */
define('STATE_MACHINE', 'FILE'); define('STATE_MACHINE', 'FILE');
define('STATE_DIR', 'STATEDIRTOCHANGE/');
/********************************************************************************** /**********************************************************************************
* Default FileStateMachine settings * IPC - InterProcessCommunication
*/
define('STATE_DIR', 'ALIASTOCHANGE/');
/**********************************************************************************
* Optional SqlStateMachine settings
* *
* DSN: formatted PDO connection string * Is either provided by using shared memory on a single host or
* mysql:host=xxx;port=xxx;dbname=xxx * using the memcache provider for multi-host environments.
* DON'T FORGET TO INSTALL THE PHP-DRIVER PACKAGE!!! * When another implementation should be used, the class can be set here explicitly.
* USER: username to DB * If empty Z-Push will try to use available providers.
* PASSWORD: password to DB
* OPTIONS: array with options needed
*/ */
define('STATE_SQL_DSN', ''); define('IPC_PROVIDER', '');
define('STATE_SQL_USER', '');
define('STATE_SQL_PASSWORD', '');
define('STATE_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true)));
/********************************************************************************** /**********************************************************************************
* Logging settings * Logging settings
*
* The LOGBACKEND specifies where the logs are sent to.
* Either to file ("filelog") or to a "syslog" server or a custom log class in core/log/logclass.
* filelog and syslog have several options that can be set below.
* For more information about the syslog configuration, see https://wiki.z-hub.io/x/HIAT
* Possible LOGLEVEL and LOGUSERLEVEL values are: * Possible LOGLEVEL and LOGUSERLEVEL values are:
* LOGLEVEL_OFF - no logging * LOGLEVEL_OFF - no logging
* LOGLEVEL_FATAL - log only critical errors * LOGLEVEL_FATAL - log only critical errors
@ -146,14 +95,13 @@
* The verbosity increases from top to bottom. More verbose levels include less verbose * The verbosity increases from top to bottom. More verbose levels include less verbose
* ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR, * ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR,
* LOGLEVEL_WARN and LOGLEVEL_INFO level entries. * LOGLEVEL_WARN and LOGLEVEL_INFO level entries.
*
* LOGAUTHFAIL is logged to the LOGBACKEND.
*/ */
define('LOGFILEDIR', 'LOGTOCHANGE/'); define('LOGBACKEND', 'filelog');
define('LOGFILE', LOGFILEDIR . 'z-push.log');
define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');
define('LOGLEVEL', LOGLEVEL_INFO); define('LOGLEVEL', LOGLEVEL_INFO);
define('LOGAUTHFAIL', false); define('LOGAUTHFAIL', false);
// To save e.g. WBXML data only for selected users, add the usernames to the array // To save e.g. WBXML data only for selected users, add the usernames to the array
// The data will be saved into a dedicated file per user in the LOGFILEDIR // The data will be saved into a dedicated file per user in the LOGFILEDIR
// Users have to be encapusulated in quotes, several users are comma separated, like: // Users have to be encapusulated in quotes, several users are comma separated, like:
@ -161,18 +109,24 @@
define('LOGUSERLEVEL', LOGLEVEL_DEVICEID); define('LOGUSERLEVEL', LOGLEVEL_DEVICEID);
$specialLogUsers = array(); $specialLogUsers = array();
// If you want to disable log to file, and log to syslog instead // Filelog settings
define('LOG_SYSLOG_ENABLED', false); define('LOGFILEDIR', 'LOGTOCHANGE/');
define('LOGFILE', LOGFILEDIR . 'z-push.log');
define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');
// Syslog settings
// false will log to local syslog, otherwise put the remote syslog IP here // false will log to local syslog, otherwise put the remote syslog IP here
define('LOG_SYSLOG_HOST', false); define('LOG_SYSLOG_HOST', false);
// Syslog port // Syslog port
define('LOG_SYSLOG_PORT', 514); define('LOG_SYSLOG_PORT', 514);
// Program showed in the syslog. Useful if you have more than one instance login to the same syslog // Program showed in the syslog. Useful if you have more than one instance login to the same syslog
define('LOG_SYSLOG_PROGRAM', '[z-push]'); define('LOG_SYSLOG_PROGRAM', 'z-push');
// Syslog facility - use LOG_USER when running on Windows
define('LOG_SYSLOG_FACILITY', LOG_LOCAL0);
// Location of the trusted CA, e.g. '/etc/ssl/certs/EmailCA.pem'
define('LOG_MEMORY_PROFILER', false); // Uncomment and modify the following line if the validation of the certificates fails.
define('LOG_MEMORY_PROFILER_FILE', 'LOGTOCHANGE/memory_profile'); // define('CAINFO', '/etc/ssl/certs/EmailCA.pem');
/********************************************************************************** /**********************************************************************************
* Mobile settings * Mobile settings
@ -186,6 +140,10 @@
// true - allow older devices, but enforce policies on devices which support it // true - allow older devices, but enforce policies on devices which support it
define('LOOSE_PROVISIONING', false); define('LOOSE_PROVISIONING', false);
// The file containing the policies' settings.
// Set a full path or relative to the z-push main directory
define('PROVISIONING_POLICYFILE', 'policies.ini');
// Default conflict preference // Default conflict preference
// Some devices allow to set if the server or PIM (mobile) // Some devices allow to set if the server or PIM (mobile)
// should win in case of a synchronization conflict // should win in case of a synchronization conflict
@ -208,11 +166,6 @@
// a higher value if you have a high load on the server. // a higher value if you have a high load on the server.
define('PING_INTERVAL', 30); define('PING_INTERVAL', 30);
// Interval in seconds to force a re-check of potentially missed notifications when
// using a changes sink. Default are 300 seconds (every 5 min).
// This can also be disabled by setting it to false
define('SINK_FORCERECHECK', 300);
// Set the fileas (save as) order for contacts in the webaccess/webapp/outlook. // Set the fileas (save as) order for contacts in the webaccess/webapp/outlook.
// It will only affect new/modified contacts on the mobile which then are synced to the server. // It will only affect new/modified contacts on the mobile which then are synced to the server.
// Possible values are: // Possible values are:
@ -231,12 +184,14 @@
// SYNC_FILEAS_LASTFIRST will be used // SYNC_FILEAS_LASTFIRST will be used
define('FILEAS_ORDER', SYNC_FILEAS_LASTFIRST); define('FILEAS_ORDER', SYNC_FILEAS_LASTFIRST);
// Amount of items to be synchronized per request // Maximum amount of items to be synchronized per request.
// Normally this value is requested by the mobile. Common values are 5, 25, 50 or 100. // Normally this value is requested by the mobile. Common values are 5, 25, 50 or 100.
// Exporting too much items can cause mobile timeout on busy systems. // Exporting too much items can cause mobile timeout on busy systems.
// Z-Push will use the lowest value, either set here or by the mobile. // Z-Push will use the lowest provided value, either set here or by the mobile.
// default: 100 - value used if mobile does not limit amount of items // MS Outlook 2013+ request up to 512 items to accelerate the sync process.
define('SYNC_MAX_ITEMS', 100); // If you detect high load (also on subsystems) you could try a lower setting.
// max: 512 - value used if mobile does not limit amount of items
define('SYNC_MAX_ITEMS', 512);
// The devices usually send a list of supported properties for calendar and contact // The devices usually send a list of supported properties for calendar and contact
// items. If a device does not includes such a supported property in Sync request, // items. If a device does not includes such a supported property in Sync request,
@ -245,7 +200,7 @@
// to tell if a property was deleted or it was not set at all if it does not appear in Sync. // to tell if a property was deleted or it was not set at all if it does not appear in Sync.
// This parameter defines Z-Push behaviour during Sync if a device does not issue a list with // This parameter defines Z-Push behaviour during Sync if a device does not issue a list with
// supported properties. // supported properties.
// See also https://jira.zarafa.com/browse/ZP-302. // See also https://jira.z-hub.io/browse/ZP-302.
// Possible values: // Possible values:
// false - do not unset properties which are not sent during Sync (default) // false - do not unset properties which are not sent during Sync (default)
// true - unset properties which are not sent during Sync // true - unset properties which are not sent during Sync
@ -272,34 +227,47 @@
// NOTE: THIS IS AN EXPERIMENTAL FEATURE WHICH COULD PREVENT YOUR MOBILES FROM SYNCHRONIZING. // NOTE: THIS IS AN EXPERIMENTAL FEATURE WHICH COULD PREVENT YOUR MOBILES FROM SYNCHRONIZING.
define('USE_PARTIAL_FOLDERSYNC', false); define('USE_PARTIAL_FOLDERSYNC', false);
// The minimum accepted time in second that a ping command should last.
// It is strongly advised to keep this config to false. Some device
// might not be able to send a higher value than the one specificied here and thus
// unable to start a push connection.
// If set to false, there will be no lower bound to the ping lifetime.
// The minimum accepted value is 1 second. The maximum accepted value is 3540 seconds (59 minutes).
define('PING_LOWER_BOUND_LIFETIME', false);
// The maximum accepted time in second that a ping command should last.
// If set to false, there will be no higher bound to the ping lifetime.
// The minimum accepted value is 1 second. The maximum accepted value is 3540 seconds (59 minutes).
define('PING_HIGHER_BOUND_LIFETIME', false);
// Maximum response time
// Mobiles implement different timeouts to their TCP/IP connections. Android devices for example
// have a hard timeout of 30 seconds. If the server is not able to answer a request within this timeframe,
// the answer will not be recieved and the device will send a new one overloading the server.
// There are three categories
// - Short timeout - server has up within 30 seconds - is automatically applied for not categorized types
// - Medium timeout - server has up to 90 seconds to respond
// - Long timeout - server has up to 4 minutes to respond
// If a timeout is almost reached the server will break and sent the results it has until this
// point. You can add DeviceType strings to the categories.
// In general longer timeouts are better, because more data can be streamed at once.
define('SYNC_TIMEOUT_MEDIUM_DEVICETYPES', "SAMSUNGGTI");
define('SYNC_TIMEOUT_LONG_DEVICETYPES', "iPod, iPad, iPhone, WP, WindowsOutlook");
// Time in seconds the device should wait whenever the service is unavailable,
// e.g. when a backend service is unavailable.
// Z-Push sends a "Retry-After" header in the response with the here defined value.
// It is up to the device to respect or not this directive so even if this option is set,
// the device might not wait requested time frame.
// Number of seconds before retry, to disable set to: false
define('RETRY_AFTER_DELAY', 300);
/********************************************************************************** /**********************************************************************************
* Backend settings * Backend settings
*/ */
// the backend data provider // the backend data provider
define('BACKEND_PROVIDER', 'BACKENDTOCHANGE'); define('BACKEND_PROVIDER', 'BACKENDTOCHANGE');
// top collector backend class name
// Default is: TopCollector
// Options: ["TopCollector", "TopCollectorRedis"]
define('TOP_COLLECTOR_BACKEND', 'TopCollector');
// ping tracking backend class name
// Default is: PingTracking
// Options: ["PingTracking", "PingTrackingRedis"]
define('PING_TRACKING_BACKEND', 'PingTracking');
// loop detection backend class name
// Default is: LoopDetection
// Options: ["LoopDetection", "LoopDetectionRedis"]
define('LOOP_DETECTION_BACKEND', 'LoopDetection');
// If using the Redis backends (for top, ping and lookp) make sure to set this values as necessary
define('IPC_REDIS_IP', '127.0.0.1');
define('IPC_REDIS_PORT', 6379);
// Database name/index in Redis: 0 by default
// NOTE: this database must be exclusive for z-push, since its content will be ERASED. You are warned.
define('IPC_REDIS_DATABASE', 0);
/********************************************************************************** /**********************************************************************************
* Search provider settings * Search provider settings
* *
@ -316,6 +284,37 @@
// might result in timeout. Default is 10. // might result in timeout. Default is 10.
define('SEARCH_MAXRESULTS', 10); define('SEARCH_MAXRESULTS', 10);
/**********************************************************************************
* Kopano Outlook Extension - Settings
*
* The Kopano Outlook Extension (KOE) provides MS Outlook 2013 and newer with
* functionality not provided by ActiveSync or not implemented by Outlook.
* For more information, see: https://wiki.z-hub.io/x/z4Aa
*/
// Global Address Book functionality
define('KOE_CAPABILITY_GAB', false);
// Synchronize mail flags from the server to Outlook/KOE
define('KOE_CAPABILITY_RECEIVEFLAGS', false);
// Encode flags when sending from Outlook/KOE
define('KOE_CAPABILITY_SENDFLAGS', false);
// Out-of-office support
define('KOE_CAPABILITY_OOF', false);
// Out-of-office support with start & end times (superseeds KOE_CAPABILITY_OOF)
define('KOE_CAPABILITY_OOFTIMES', false);
// Notes support
define('KOE_CAPABILITY_NOTES', false);
// Shared folder support
define('KOE_CAPABILITY_SHAREDFOLDER', false);
// Send-As support for Outlook/KOE and mobiles
define('KOE_CAPABILITY_SENDAS', false);
// To synchronize the GAB KOE, the GAB store and folderid need to be specified.
// Use the gab-sync script to generate this data. The name needs to
// match the config of the gab-sync script.
// More information here: https://wiki.z-hub.io/x/z4Aa (GAB Sync Script)
define('KOE_GAB_STORE', 'SYSTEM');
define('KOE_GAB_FOLDERID', '');
define('KOE_GAB_NAME', 'Z-Push-KOE-GAB');
/********************************************************************************** /**********************************************************************************
* Synchronize additional folders to all mobiles * Synchronize additional folders to all mobiles
@ -325,11 +324,11 @@
* *
* This feature is supported only by certain devices, like iPhones. * This feature is supported only by certain devices, like iPhones.
* Check the compatibility list for supported devices: * Check the compatibility list for supported devices:
* http://z-push.sf.net/compatibility * http://z-push.org/compatibility
* *
* To synchronize a folder, add a section setting all parameters as below: * To synchronize a folder, add a section setting all parameters as below:
* store: the ressource where the folder is located. * store: the ressource where the folder is located.
* Zarafa users use 'SYSTEM' for the 'Public Folder' * Kopano users use 'SYSTEM' for the 'Public Folder'
* folderid: folder id of the folder to be synchronized * folderid: folder id of the folder to be synchronized
* name: name to be displayed on the mobile device * name: name to be displayed on the mobile device
* type: supported types are: * type: supported types are:
@ -337,13 +336,14 @@
* SYNC_FOLDER_TYPE_USER_APPOINTMENT * SYNC_FOLDER_TYPE_USER_APPOINTMENT
* SYNC_FOLDER_TYPE_USER_TASK * SYNC_FOLDER_TYPE_USER_TASK
* SYNC_FOLDER_TYPE_USER_MAIL * SYNC_FOLDER_TYPE_USER_MAIL
* SYNC_FOLDER_TYPE_USER_NOTE
* *
* Additional notes: * Additional notes:
* - on Zarafa systems use backend/zarafa/listfolders.php script to get a list * - on Kopano systems use backend/kopano/listfolders.php script to get a list
* of available folders * of available folders
* *
* - all Z-Push users must have full writing permissions (secretary rights) so * - all Z-Push users must have at least reading permissions so the configured
* the configured folders can be synchronized to the mobile * folders can be synchronized to the mobile. Else they are ignored.
* *
* - this feature is only partly suitable for multi-tenancy environments, * - this feature is only partly suitable for multi-tenancy environments,
* as ALL users from ALL tenents need access to the configured store & folder. * as ALL users from ALL tenents need access to the configured store & folder.

31
conf/logrotate Normal file
View file

@ -0,0 +1,31 @@
LOGTOCHANGE/*.log {
# Rotate if the logfile exceeds 100Mo
size 10M
# From https://stash.z-hub.io/projects/ZP/repos/z-push/browse/config/z-push.lr
create www-data www-data
# Keep 12 old log maximum
rotate 10
# Compress the logs with gzip
compress
# Compress the log at the next cycle. So keep always 2 non compressed logs
delaycompress
# Copy and truncate the log to allow to continue write on it. Instead of move the log.
copytruncate
# Do not do an error if the log is missing
missingok
# Not rotate if the log is empty
notifempty
# Keep old logs in the same dir
noolddir
}

View file

@ -19,6 +19,7 @@ source /usr/share/yunohost/helpers
path=$(ynh_app_setting_get $app path) path=$(ynh_app_setting_get $app path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
statedir=$(ynh_app_setting_get $app statedir)
final_logpath=$(ynh_app_setting_get $app final_logpath) final_logpath=$(ynh_app_setting_get $app final_logpath)
final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf)
final_phpconf=$(ynh_app_setting_get $app final_phpconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf)
@ -27,8 +28,12 @@ final_phpconf=$(ynh_app_setting_get $app final_phpconf)
# Note: the last argument is where to save this path, see the restore script. # Note: the last argument is where to save this path, see the restore script.
ynh_backup "$final_path" "sources" ynh_backup "$final_path" "sources"
# Backup statedir
ynh_backup "$statedir" "statedir"
# Backup logs # Backup logs
ynh_backup "$final_logpath" "logs" ynh_backup "$final_logpath" "logs"
ynh_backup "/etc/logrotate.d/$app" "logrotate"
# Copy NGINX configuration # Copy NGINX configuration
ynh_backup "$final_nginxconf" "nginx.conf" ynh_backup "$final_nginxconf" "nginx.conf"

View file

@ -79,11 +79,23 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déj
CHECK_FINALPATH CHECK_FINALPATH
statedir="/home/yunohost.app/$app"
CHECK_STATEDIRPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
if [ -e "$statedir" ]
then
echo "This path already contains a folder" >&2
false
fi
}
CHECK_STATEDIRPATH
# Define variables and Save app settings # Define variables and Save app settings
ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" final_path "$final_path" ynh_app_setting_set "$app" final_path "$final_path"
ynh_app_setting_set "$app" statedir "$statedir"
final_logpath="/var/log/$app" final_logpath="/var/log/$app"
ynh_app_setting_set "$app" final_logpath "$final_logpath" ynh_app_setting_set "$app" final_logpath "$final_logpath"
@ -98,18 +110,22 @@ ynh_app_setting_set "$app" final_phpconf "$final_phpconf"
sudo mkdir -p $final_path sudo mkdir -p $final_path
# We download the sources and check the md5sum # We download the sources and check the md5sum
SHA1=`sudo cat ../sources/source_sha1`; SFILE=`sudo cat ../sources/source_file`;
sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_url sudo wget -nv -i ../sources/source_url -O ${SFILE}.tar.gz
sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_md5
sudo wget -nv -i ../sources/source_url -O Z-Push-contrib-${SHA1}.zip
sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
sudo unzip Z-Push-contrib-${SHA1}.zip -d ../sources/ sudo tar xvf ${SFILE}.tar.gz -C ../sources/
sudo cp -R ../sources/Z-Push-contrib-${SHA1}/* $final_path sudo cp -R ../sources/$SFILE/* $final_path
# Configuration # Configuration
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php
sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate
# Storage of state_dir in /home/yunohost.app
# This contains the sync status in between device and z-push
sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php
sudo mkdir -p $statedir
sudo chown -R www-data:www-data $statedir
# Enable caldav carddav support # Enable caldav carddav support
if sudo yunohost app list --installed -f baikal | grep -q id ; then if sudo yunohost app list --installed -f baikal | grep -q id ; then
@ -153,6 +169,11 @@ sudo mkdir -p $final_logpath
sudo chmod 750 $final_logpath sudo chmod 750 $final_logpath
sudo chown www-data:www-data $final_logpath sudo chown www-data:www-data $final_logpath
# Activate logrotate
sudo cp ../conf/logrotate /etc/logrotate.d/$app
sudo chmod 644 /etc/logrotate.d/$app
sudo chown root:root /etc/logrotate.d/$app
#Copy XMLElement.php #Copy XMLElement.php
sudo ln -s /usr/share/awl/inc/XML* /var/www/$app/include/ sudo ln -s /usr/share/awl/inc/XML* /var/www/$app/include/

View file

@ -9,9 +9,11 @@ domain=$(ynh_app_setting_get $app domain)
# Cleaning # Cleaning
sudo rm -rf /var/www/$app sudo rm -rf /var/www/$app
sudo rm -rf /home/yunohost.app/$app
sudo rm -rf /var/log/$app sudo rm -rf /var/log/$app
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
sudo rm -f /etc/php5/fpm/pool.d/$app.conf sudo rm -f /etc/php5/fpm/pool.d/$app.conf
sudo rm -f /etc/logrotate.d/$app
# Restart of services # Restart of services
sudo service php5-fpm reload sudo service php5-fpm reload

View file

@ -9,20 +9,35 @@ source /usr/share/yunohost/helpers
path=$(ynh_app_setting_get $app path) path=$(ynh_app_setting_get $app path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
statedir=$(ynh_app_setting_get $app statedir)
final_logpath=$(ynh_app_setting_get $app final_logpath) final_logpath=$(ynh_app_setting_get $app final_logpath)
final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf)
final_phpconf=$(ynh_app_setting_get $app final_phpconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf)
# Prereqs
sudo apt-get update -y
sudo apt-get install php-soap php5-imap libawl-php php5-xsl
# Restore sources, data and permissions # Restore sources, data and permissions
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo cp -a ./sources/* $final_path/ sudo cp -a ./sources/* $final_path/
sudo chown -R www-data: $final_path sudo chown -R www-data: $final_path
# Restore statedir
sudo mkdir -p $statedir
sudo cp -a ./statedir/* $statedir/
sudo chown -R www-data:www-data $statedir
# Restore logs, data & permissions # Restore logs, data & permissions
sudo mkdir -p $final_logpath sudo mkdir -p $final_logpath
sudo cp -a ./logs/* $final_logpath/ sudo cp -a ./logs/* $final_logpath/
sudo chown -R www-data:www-data $final_logpath sudo chown -R www-data:www-data $final_logpath
# Restore logrotate
sudo cp -a ./logrotate /etc/logrotate.d/$app
sudo chmod 644 /etc/logrotate.d/$app
sudo chown root:root /etc/logrotate.d/$app
# Restore NGINX configuration # Restore NGINX configuration
sudo cp -a ./nginx.conf $final_nginxconf sudo cp -a ./nginx.conf $final_nginxconf

View file

@ -8,6 +8,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path) path=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
statedir=$(ynh_app_setting_get $app statedir)
final_logpath=$(ynh_app_setting_get $app final_logpath) final_logpath=$(ynh_app_setting_get $app final_logpath)
final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf)
final_phpconf=$(ynh_app_setting_get $app final_phpconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf)
@ -21,6 +22,14 @@ else
echo "${final_path} exists, we don't create it." echo "${final_path} exists, we don't create it."
fi fi
if [ -z "$statedir" ];
then
statedir="/home/yunohost.app/$app"
ynh_app_setting_set "$app" statedir "$statedir"
else
echo "${statedir} exists, we don't create it."
fi
if [ -z "$final_logpath" ]; if [ -z "$final_logpath" ];
then then
final_logpath="/var/log/$app" final_logpath="/var/log/$app"
@ -54,23 +63,29 @@ sudo rm -rf $final_path
sudo rm -rf $final_logpath sudo rm -rf $final_logpath
sudo rm -f $final_nginxconf sudo rm -f $final_nginxconf
sudo rm -f $final_phpconf sudo rm -f $final_phpconf
sudo rm -f /etc/logrotate.d/$app
# Copy files to the right place # Copy files to the right place
sudo mkdir -p $final_path sudo mkdir -p $final_path
# We download the sources and check the md5sum # We download the sources and check the md5sum
SHA1=`sudo cat ../sources/source_sha1`; SFILE=`sudo cat ../sources/source_file`;
sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_url sudo wget -nv -i ../sources/source_url -O ${SFILE}.tar.gz
sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_md5
sudo wget -nv -i ../sources/source_url -O Z-Push-contrib-${SHA1}.zip
sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
sudo unzip Z-Push-contrib-${SHA1}.zip -d ../sources/ sudo tar xvf ${SFILE}.tar.gz -C ../sources/
sudo cp -R ../sources/Z-Push-contrib-${SHA1}/* $final_path sudo cp -R ../sources/$SFILE/* $final_path
# Configuration # Configuration
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php
sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate
# Storage of state_dir in /home/yunohost.app
# This contains the sync status in between device and z-push
sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php
sudo mkdir -p $statedir
sudo chown -R www-data:www-data $statedir
# Note : there is a "fixstates actions done after the sources have been installed and configured
# Enable caldav carddav support # Enable caldav carddav support
if sudo yunohost app list --installed -f baikal | grep -q id ; then if sudo yunohost app list --installed -f baikal | grep -q id ; then
@ -114,6 +129,11 @@ sudo mkdir -p $final_logpath
sudo chmod 750 $final_logpath sudo chmod 750 $final_logpath
sudo chown www-data:www-data $final_logpath sudo chown www-data:www-data $final_logpath
# Activate logrotate
sudo cp ../conf/logrotate /etc/logrotate.d/$app
sudo chmod 644 /etc/logrotate.d/$app
sudo chown root:root /etc/logrotate.d/$app
#Copy XMLElement.php #Copy XMLElement.php
sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/ sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/
@ -128,6 +148,9 @@ sudo cp ../conf/php-fpm.conf $final_phpconf
sudo chown root: $final_phpconf sudo chown root: $final_phpconf
sudo chmod 644 $final_phpconf sudo chmod 644 $final_phpconf
# Fixstates to avoid full resync of devices after evrsion upgrades
sudo $final_path/z-push-admin.php -a fixstates
# Enable api for client and make the app public # Enable api for client and make the app public
ynh_app_setting_set $app skipped_uris "/" ynh_app_setting_set $app skipped_uris "/"

1
sources/source_file Normal file
View file

@ -0,0 +1 @@
z-push-2.3.4

View file

@ -1 +1 @@
66eafc26c5e0a23a28ee43871d2be7e1 Z-Push-contrib-SHA1TOCHANGE.zip 35416c418c6e029b98eea7581e297648 z-push-2.3.4.tar.gz

View file

@ -1 +0,0 @@
682f127b7e5dc77da95eef6956579215d376b0e5

View file

@ -1 +1 @@
https://github.com/fmbiete/Z-Push-contrib/archive/SHA1TOCHANGE.zip http://download.z-push.org/final/2.3/z-push-2.3.4.tar.gz