|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * ownCloud - user_sql |
| 5 | + * |
| 6 | + * @author Andreas Böhler and contributors |
| 7 | + * @copyright 2012-2015 Andreas Böhler <dev (at) aboehler (dot) at> |
| 8 | + * |
| 9 | + * This library is free software; you can redistribute it and/or |
| 10 | + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
| 11 | + * License as published by the Free Software Foundation; either |
| 12 | + * version 3 of the License, or any later version. |
| 13 | + * |
| 14 | + * This library is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Affero General Public |
| 20 | + * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 21 | + * |
| 22 | + */ |
| 23 | + |
| 24 | +$installedVersion = \OC::$server->getConfig()->getAppValue('user_sql', 'installed_version'); |
| 25 | + |
| 26 | +$params = array('sql_host' => 'sql_hostname', |
| 27 | + 'sql_user' => 'sql_username', |
| 28 | + 'sql_database' => 'sql_database', |
| 29 | + 'sql_password' => 'sql_password', |
| 30 | + 'sql_table' => 'sql_table', |
| 31 | + 'sql_column_username' => 'col_username', |
| 32 | + 'sql_column_password' => 'col_password', |
| 33 | + 'sql_type' => 'sql_driver', |
| 34 | + 'sql_column_active' => 'col_active', |
| 35 | + 'sql_column_supervisor' => 'supervisor', |
| 36 | + 'sql_supervisor' => 'set_supervisor', |
| 37 | + 'strip_domain' => 'set_strip_domain', |
| 38 | + 'default_domain' => 'set_default_domain', |
| 39 | + 'crypt_type' => 'set_crypt_type', |
| 40 | + 'sql_column_displayname' => 'col_displayname', |
| 41 | + 'allow_password_change' => 'set_allow_pwchange', |
| 42 | + 'sql_column_active_invert' => 'set_active_invert', |
| 43 | + 'sql_column_email' => 'col_email', |
| 44 | + 'mail_sync_mode' => 'set_mail_sync_mode' |
| 45 | + ); |
| 46 | + |
| 47 | +$delParams = array('domain_settings', |
| 48 | + 'map_array', |
| 49 | + 'domain_array' |
| 50 | + ); |
| 51 | + |
| 52 | +if(version_compare($installedVersion, '1.99', '<')) |
| 53 | +{ |
| 54 | + foreach($params as $oldPar => $newPar) |
| 55 | + { |
| 56 | + $val = \OC::$server->getConfig()->getAppValue('user_sql', $oldPar); |
| 57 | + if(($oldPar === 'strip_domain') || ($oldPar === 'allow_password_change') || ($oldPar === 'sql_column_active_invert')) |
| 58 | + { |
| 59 | + if($val) |
| 60 | + $val = 'true'; |
| 61 | + else |
| 62 | + $val = 'false'; |
| 63 | + } |
| 64 | + if($val) |
| 65 | + \OC::$server->getConfig()->setAppValue('user_sql', $newPar.'_default', $val); |
| 66 | + \OC::$server->getConfig()->deleteAppValue('user_sql', $oldPar); |
| 67 | + } |
| 68 | + |
| 69 | + foreach($delParams as $param) |
| 70 | + { |
| 71 | + \OC::$server->getConfig()->deleteAppValue('user_sql', $param); |
| 72 | + } |
| 73 | +} |
0 commit comments