Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 82 lines (69 sloc) 3.35 kb
e6bb836 Thomas B. Create interactive update script with improved DB schema check; udated i...
thomascube authored
1 #!/usr/bin/env php
2 <?php
3 /*
4 +-----------------------------------------------------------------------+
5 | bin/installto.sh |
6 | |
7 | This file is part of the Roundcube Webmail client |
471d559 Thomas B. Update installto/update script to remove old default skins and copy all ...
thomascube authored
8 | Copyright (C) 2012, The Roundcube Dev Team |
7fe3811 Thomas B. Changed license to GNU GPLv3+ with exceptions for skins and plugins
thomascube authored
9 | |
10 | Licensed under the GNU General Public License version 3 or |
11 | any later version with exceptions for skins & plugins. |
12 | See the README file for a full license statement. |
e6bb836 Thomas B. Create interactive update script with improved DB schema check; udated i...
thomascube authored
13 | |
14 | PURPOSE: |
15 | Update an existing Roundcube installation with files from |
16 | this version |
17 +-----------------------------------------------------------------------+
18 | Author: Thomas Bruederli <roundcube@gmail.com> |
19 +-----------------------------------------------------------------------+
20 */
21
22 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
23
6cc3f58 Aleksander Machniak - Use clisetup.php where possible, remove redundant code
alecpl authored
24 require_once INSTALL_PATH . 'program/include/clisetup.php';
e6bb836 Thomas B. Create interactive update script with improved DB schema check; udated i...
thomascube authored
25
26 $target_dir = unslashify($_SERVER['argv'][1]);
27
28 if (empty($target_dir) || !is_dir(realpath($target_dir)))
29 die("Invalid target: not a directory\nUsage: installto.sh <TARGET>\n");
30
31 // read version from iniset.php
32 $iniset = @file_get_contents($target_dir . '/program/include/iniset.php');
33 if (!preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)/', $iniset, $m))
34 die("No valid Roundcube installation found at $target_dir\n");
35
36 $oldversion = $m[1];
37
38 if (version_compare($oldversion, RCMAIL_VERSION, '>='))
39 die("Installation at target location is up-to-date!\n");
40
41 echo "Upgrading from $oldversion. Do you want to continue? (y/N)\n";
42 $input = trim(fgets(STDIN));
43
44 if (strtolower($input) == 'y') {
45 $err = false;
46 echo "Copying files to target location...";
54d0746 Thomas B. Copy all skins in installto script (#1488376)
thomascube authored
47 foreach (array('program','installer','bin','SQL','plugins','skins') as $dir) {
373b112 Thomas B. Force files to be updated, even if newer (#1488117)
thomascube authored
48 if (!system("rsync -avC " . INSTALL_PATH . "$dir/* $target_dir/$dir/")) {
e6bb836 Thomas B. Create interactive update script with improved DB schema check; udated i...
thomascube authored
49 $err = true;
50 break;
51 }
52 }
471d559 Thomas B. Update installto/update script to remove old default skins and copy all ...
thomascube authored
53 foreach (array('index.php','.htaccess','config/main.inc.php.dist','config/db.inc.php.dist','CHANGELOG','README.md','UPGRADING','LICENSE') as $file) {
373b112 Thomas B. Force files to be updated, even if newer (#1488117)
thomascube authored
54 if (!system("rsync -av " . INSTALL_PATH . "$file $target_dir/$file")) {
e6bb836 Thomas B. Create interactive update script with improved DB schema check; udated i...
thomascube authored
55 $err = true;
56 break;
57 }
58 }
59 echo "done.\n\n";
471d559 Thomas B. Update installto/update script to remove old default skins and copy all ...
thomascube authored
60
61 if (is_dir("$target_dir/skins/default")) {
62 echo "Removing old default skin...";
a025cdd Thomas B. Fix default skin removal
thomascube authored
63 system("rm -rf $target_dir/skins/default $target_dir/plugins/jqueryui/themes/default");
471d559 Thomas B. Update installto/update script to remove old default skins and copy all ...
thomascube authored
64 foreach (glob(INSTALL_PATH . "plugins/*/skins") as $plugin_skin_dir) {
65 $plugin_skin_dir = preg_replace('!^.*' . INSTALL_PATH . '!', '', $plugin_skin_dir);
a025cdd Thomas B. Fix default skin removal
thomascube authored
66 if (is_dir("$target_dir/$plugin_skin_dir/classic"))
67 system("rm -rf $target_dir/$plugin_skin_dir/default");
471d559 Thomas B. Update installto/update script to remove old default skins and copy all ...
thomascube authored
68 }
69 echo "done.\n\n";
70 }
71
e6bb836 Thomas B. Create interactive update script with improved DB schema check; udated i...
thomascube authored
72 if (!$err) {
73 echo "Running update script at target...\n";
74 system("cd $target_dir && bin/update.sh --version=$oldversion");
75 echo "All done.\n";
76 }
77 }
78 else
79 echo "Update cancelled. See ya!\n";
80
81 ?>
Something went wrong with that request. Please try again.