From 0b9937332c9231ecd8c119c34445c2889bb7246c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 5 Apr 2016 16:51:43 +0000 Subject: [PATCH] some more setup fix, 16.1 updates now 1.8, 14.x and installs itself new --- setup/config.php | 2 +- setup/inc/class.setup.inc.php | 29 +++++++++--------------- setup/inc/class.setup_cmd_config.inc.php | 22 ++++++++++-------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/setup/config.php b/setup/config.php index 8296425df3..d06fe02bce 100644 --- a/setup/config.php +++ b/setup/config.php @@ -87,7 +87,7 @@ if(@get_var('submit',Array('POST')) && @$newsettings) { $GLOBALS['egw_setup']->db->transaction_commit(); // unset cached config, as this is the primary source for configuration now - Api\Cache::unsetInstance('config', 'configs'); + Api\Cache::unsetInstance('config', 'configs'); Header('Location: index.php'); exit; diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index 4395270ba9..1c94551d43 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -30,13 +30,6 @@ class setup var $oProc; var $cookie_domain; - /** - * Instance of the hooks class - * - * @var hooks - */ - var $hooks; - /** * @var setup_detection */ @@ -149,7 +142,7 @@ class setup } } } - catch (egw_exception_db $e) { + catch (Api\Db\Exception $e) { // table might not be created at that stage } } @@ -249,7 +242,7 @@ class setup $ok = @session_start(); // suppress notice if session already started or warning in CLI // need to decrypt session, in case session encryption is switched on in header.inc.php - egw_session::decrypt(); + Api\Session::decrypt(); //error_log(__METHOD__."() returning ".array2string($ok).' _SESSION='.array2string($_SESSION)); return $ok; } @@ -375,7 +368,7 @@ class setup { $hash = '{plain}'.$hash; } - $ret = auth::compare_password($pw, $hash, 'md5'); + $ret = Api\Auth::compare_password($pw, $hash, 'md5'); } //error_log(__METHOD__."('$user', '$pw', '$conf_user', '$hash') returning ".array2string($ret)); return $ret; @@ -709,7 +702,7 @@ class setup } } // store default/forced preferences, if any found - $preferences = new preferences(); + $preferences = new Api\Preferences(); $preferences->read_repository(false); foreach(array( 'default' => $default, @@ -735,7 +728,7 @@ class setup * @param $location hook location - required * @param $appname application name - optional */ - function hook($location, $appname='') + static function hook($location, $appname='') { return Api\Hooks::single($location,$appname,True,True); } @@ -940,7 +933,7 @@ class setup return false; } if (!isset($GLOBALS['egw']->accounts)) $GLOBALS['egw']->accounts = $this->accounts; - accounts::cache_invalidate(); // the cache is shared for all instances of the class + Api\Accounts::cache_invalidate(); // the cache is shared for all instances of the class } return true; } @@ -974,7 +967,7 @@ class setup if ($username == 'anonymous') { - if (!isset($this->anonpw)) $this->anonpw = auth::randomstring(16); + if (!isset($this->anonpw)) $this->anonpw = Api\Auth::randomstring(16); $passwd = $anonpw = $this->anonpw; } @@ -1002,7 +995,7 @@ class setup elseif($passwd && $passwd != '*unchanged*') { try { - $auth = new auth; + $auth = new Api\Auth; $pw_changed = $auth->change_password(null, $passwd, $accountid); } catch (Exception $e) @@ -1016,19 +1009,19 @@ class setup return false; } } - // call vfs_home_hooks::add{account|group} hook to create the vfs-home-dirs + // call Api\Vfs\Hooks::add{account|group} hook to create the vfs-home-dirs // calling general add{account|group} hook fails, as we are only in setup // --> setup_cmd_admin execs "admin/admin-cli.php --edit-user" to run them if ($primary_group) { - vfs_home_hooks::addAccount(array( + Api\Vfs\Hooks::addAccount(array( 'account_id' => $accountid, 'account_lid' => $username, )); } else { - vfs_home_hooks::addGroup(array( + Api\Vfs\Hooks::addGroup(array( 'account_id' => $accountid, 'account_lid' => $username, )); diff --git a/setup/inc/class.setup_cmd_config.inc.php b/setup/inc/class.setup_cmd_config.inc.php index b82e4963e1..a5d12f7c72 100644 --- a/setup/inc/class.setup_cmd_config.inc.php +++ b/setup/inc/class.setup_cmd_config.inc.php @@ -5,11 +5,13 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package setup - * @copyright (c) 2007-14 by Ralf Becker + * @copyright (c) 2007-16 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ +use EGroupware\Api; + /** * setup command: create / change eGW configuration */ @@ -99,7 +101,7 @@ class setup_cmd_config extends setup_cmd if ($save_mail_account) $this->_save_mail_account($values); // flush instance cache, so above config get read from database not cache - egw_cache::flush(); + Api\Cache::flush(); $this->restore_db(); @@ -286,7 +288,7 @@ class setup_cmd_config extends setup_cmd { if (!isset(self::$options[$arg])) { - throw new egw_exception_wrong_userinput(lang("Unknown option '%1' !!!",$arg),90); + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$arg),90); } $options = is_array(self::$options[$arg]) ? explode(',',array_shift($args)) : array(array_shift($args)); @@ -330,7 +332,7 @@ class setup_cmd_config extends setup_cmd if (isset($name['allowed']) && !in_array($value,$name['allowed'])) { - throw new egw_exception_wrong_userinput(lang("'%1' is not allowed as %2. arguments of option %3 !!!",$value,1+$n,$arg)." ($name[name])",91); + throw new Api\Exception\WrongUserinput(lang("'%1' is not allowed as %2. arguments of option %3 !!!",$value,1+$n,$arg)." ($name[name])",91); } $name = $name['name']; } @@ -346,15 +348,15 @@ class setup_cmd_config extends setup_cmd */ function _save_mail_account(array $data) { - // convert ssl textual values to nummerical ones used in emailadmin_account + // convert ssl textual values to nummerical ones used in Api\Mail\Account foreach(array('acc_imap_ssl', 'acc_sieve_ssl', 'acc_smtp_ssl') as $name) { switch(strtolower($data[$name])) { - case 'no': $data[$name] = emailadmin_account::SSL_NONE; break; - case 'starttls': $data[$name] = emailadmin_account::SSL_STARTTLS; break; - case 'ssl': $data[$name] = emailadmin_account::SSL_SSL; break; - case 'tls': $data[$name] = emailadmin_account::SSL_TLS; break; + case 'no': $data[$name] = Api\Mail\Account::SSL_NONE; break; + case 'starttls': $data[$name] = Api\Mail\Account::SSL_STARTTLS; break; + case 'ssl': $data[$name] = Api\Mail\Account::SSL_SSL; break; + case 'tls': $data[$name] = Api\Mail\Account::SSL_TLS; break; } } // convert 'yes', 'no' to boolean @@ -375,7 +377,7 @@ class setup_cmd_config extends setup_cmd $data['acc_name'] = 'Created by setup'; $data['account_id'] = 0; // 0 = valid for all users - emailadmin_account::write($data); + Api\Mail\Account::write($data); if ($this->verbose) {