1+ <?php
2+
3+ /*
4+ Copyright (c) 2009, Till Brehm, projektfarm Gmbh
5+ All rights reserved.
6+
7+ Redistribution and use in source and binary forms, with or without modification,
8+ are permitted provided that the following conditions are met:
9+
10+ * Redistributions of source code must retain the above copyright notice,
11+ this list of conditions and the following disclaimer.
12+ * Redistributions in binary form must reproduce the above copyright notice,
13+ this list of conditions and the following disclaimer in the documentation
14+ and/or other materials provided with the distribution.
15+ * Neither the name of ISPConfig nor the names of its contributors
16+ may be used to endorse or promote products derived from this software without
17+ specific prior written permission.
18+
19+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22+ IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+ */
30+
31+ function simple_query ($ query , $ answers , $ default )
32+ {
33+ $ finished = false ;
34+ do {
35+ $ answers_str = implode (', ' , $ answers );
36+ swrite ($ this ->lng ($ query ).' ( ' .$ answers_str .') [ ' .$ default .']: ' );
37+ $ input = sread ();
38+
39+ //* Stop the installation
40+ if ($ input == 'quit ' ) {
41+ swriteln ($ this ->lng ("Installation terminated by user. \n" ));
42+ die ();
43+ }
44+
45+ //* Select the default
46+ if ($ input == '' ) {
47+ $ answer = $ default ;
48+ $ finished = true ;
49+ }
50+
51+ //* Set answer id valid
52+ if (in_array ($ input , $ answers )) {
53+ $ answer = $ input ;
54+ $ finished = true ;
55+ }
56+
57+ } while ($ finished == false );
58+ swriteln ();
59+ return $ answer ;
60+ }
61+
62+ require_once ('/usr/local/ispconfig/server/lib/config.inc.php ' );
63+
64+
65+ echo "\n\n" .str_repeat ('- ' ,80 )."\n" ;
66+ echo " _____ ___________ _____ __ _
67+ |_ _/ ___| ___ \ / __ \ / _(_)
68+ | | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _
69+ | | `--. \ __/ | | / _ \| '_ \| _| |/ _` |
70+ _| |_/\__/ / | | \__/\ (_) | | | | | | | (_| |
71+ \___/\____/\_| \____/\___/|_| |_|_| |_|\__, |
72+ __/ |
73+ |___/ " ;
74+ echo "\n" .str_repeat ('- ' ,80 )."\n" ;
75+ echo "\n\n>> Update \n\n" ;
76+ echo "Please choose the update method. For production systems select 'stable'. \nThe update from svn is only for development systems and may break your current setup. \n\n" ;
77+
78+ $ method = $ inst ->simple_query ('Select update method ' , array ('stable ' ,'svn ' ), 'stable ' );
79+
80+ if ($ method == 'stable ' ) {
81+ $ new_version = file_get_contents ('http://www.ispconfig.org/downloads/ispconfig3_version.txt ' ) or die ('Unable to retrieve version file. ' );
82+ $ new_version = trim ($ new_version );
83+ if ($ new_version != ISPC_APP_VERSION ) {
84+ exec ('/usr/local/ispconfig/server/scripts/update_from_tgz.sh ' )
85+ } else {
86+ echo "There are no updates available. \n" ;
87+ }
88+ } else {
89+ exec ('/usr/local/ispconfig/server/scripts/update_from_svn.sh ' );
90+ }
91+
92+
93+
94+ ?>
0 commit comments