Permalink
Browse files

Merge branch 'dev-remove-js-deps'

2 parents 9d45ef2 + d28a96e commit 25de39d444c9a61a562c695b8bcb7f2e73738d46 @alecpl alecpl committed Dec 30, 2016
Showing with 409 additions and 28,489 deletions.
  1. +10 −7 INSTALL
  2. +308 −0 bin/install-jsdeps.sh
  3. +87 −0 jsdeps.json
  4. +0 −8 plugins/enigma/openpgp.min.js
  5. +0 −74 plugins/managesieve/codemirror/addon/selection/active-line.js
  6. +0 −341 plugins/managesieve/codemirror/lib/codemirror.css
  7. +0 −9,096 plugins/managesieve/codemirror/lib/codemirror.js
  8. +0 −193 plugins/managesieve/codemirror/mode/sieve/sieve.js
  9. +1 −1 program/include/rcmail.php
  10. +3 −3 program/js/editor.js
  11. +0 −36 program/js/jquery.min.js
  12. +0 −35 program/js/jstz.min.js
  13. +0 −487 program/js/publickey.js
  14. +0 −220 program/js/tinymce/langs/ar.js
  15. +0 −194 program/js/tinymce/langs/ar_SA.js
  16. +0 −197 program/js/tinymce/langs/az.js
  17. +0 −219 program/js/tinymce/langs/be.js
  18. +0 −219 program/js/tinymce/langs/bg_BG.js
  19. +0 −179 program/js/tinymce/langs/bn_BD.js
  20. +0 −197 program/js/tinymce/langs/bs.js
  21. +0 −219 program/js/tinymce/langs/ca.js
  22. +0 −219 program/js/tinymce/langs/cs.js
  23. +0 −213 program/js/tinymce/langs/cs_CZ.js
  24. +0 −179 program/js/tinymce/langs/cy.js
  25. +0 −219 program/js/tinymce/langs/da.js
  26. +0 −219 program/js/tinymce/langs/de.js
  27. +0 −219 program/js/tinymce/langs/de_AT.js
  28. +0 −192 program/js/tinymce/langs/dv.js
  29. +0 −219 program/js/tinymce/langs/el.js
  30. +0 −219 program/js/tinymce/langs/en_CA.js
  31. +0 −179 program/js/tinymce/langs/en_GB.js
  32. +0 −219 program/js/tinymce/langs/eo.js
  33. +0 −219 program/js/tinymce/langs/es.js
  34. +0 −219 program/js/tinymce/langs/es_MX.js
  35. +0 −219 program/js/tinymce/langs/et.js
  36. +0 −200 program/js/tinymce/langs/eu.js
  37. +0 −187 program/js/tinymce/langs/fa.js
  38. +0 −220 program/js/tinymce/langs/fa_IR.js
  39. +0 −219 program/js/tinymce/langs/fi.js
  40. +0 −219 program/js/tinymce/langs/fo.js
  41. +0 −219 program/js/tinymce/langs/fr_CH.js
  42. +0 −219 program/js/tinymce/langs/fr_FR.js
  43. +0 −219 program/js/tinymce/langs/ga.js
  44. +0 −219 program/js/tinymce/langs/gd.js
  45. +0 −191 program/js/tinymce/langs/gl.js
  46. +0 −220 program/js/tinymce/langs/he_IL.js
  47. +0 −219 program/js/tinymce/langs/hi_IN.js
  48. +0 −219 program/js/tinymce/langs/hr.js
  49. +0 −219 program/js/tinymce/langs/hu_HU.js
  50. +0 −200 program/js/tinymce/langs/hy.js
  51. +0 −219 program/js/tinymce/langs/id.js
  52. +0 −200 program/js/tinymce/langs/is_IS.js
  53. +0 −219 program/js/tinymce/langs/it.js
  54. +0 −219 program/js/tinymce/langs/ja.js
  55. +0 −219 program/js/tinymce/langs/ka_GE.js
  56. +0 −219 program/js/tinymce/langs/kab.js
  57. +0 −179 program/js/tinymce/langs/kk.js
  58. +0 −219 program/js/tinymce/langs/km_KH.js
  59. +0 −219 program/js/tinymce/langs/ko.js
  60. +0 −219 program/js/tinymce/langs/ko_KR.js
  61. +0 −197 program/js/tinymce/langs/ku.js
  62. +0 −200 program/js/tinymce/langs/ku_IQ.js
  63. +0 −200 program/js/tinymce/langs/lb.js
  64. +0 −219 program/js/tinymce/langs/lt.js
  65. +0 −200 program/js/tinymce/langs/lv.js
  66. +0 −219 program/js/tinymce/langs/mk_MK.js
  67. +0 −179 program/js/tinymce/langs/ml.js
  68. +0 −179 program/js/tinymce/langs/ml_IN.js
  69. +0 −179 program/js/tinymce/langs/mn_MN.js
  70. +0 −219 program/js/tinymce/langs/nb_NO.js
  71. +0 −219 program/js/tinymce/langs/nl.js
  72. +0 −219 program/js/tinymce/langs/pl.js
  73. +0 −219 program/js/tinymce/langs/pt_BR.js
  74. +0 −219 program/js/tinymce/langs/pt_PT.js
  75. +0 −219 program/js/tinymce/langs/ro.js
  76. +0 −54 program/js/tinymce/langs/ru_RU.js
  77. +0 −179 program/js/tinymce/langs/si_LK.js
  78. +0 −219 program/js/tinymce/langs/sk.js
  79. +0 −197 program/js/tinymce/langs/sl_SI.js
  80. +0 −8 program/js/tinymce/langs/sq.js
  81. +0 −179 program/js/tinymce/langs/sr.js
  82. +0 −219 program/js/tinymce/langs/sv_SE.js
  83. +0 −219 program/js/tinymce/langs/ta.js
  84. +0 −219 program/js/tinymce/langs/ta_IN.js
  85. +0 −197 program/js/tinymce/langs/tg.js
  86. +0 −197 program/js/tinymce/langs/th_TH.js
  87. +0 −219 program/js/tinymce/langs/tr.js
  88. +0 −200 program/js/tinymce/langs/tr_TR.js
  89. +0 −200 program/js/tinymce/langs/tt.js
  90. +0 −189 program/js/tinymce/langs/ug.js
  91. +0 −219 program/js/tinymce/langs/uk.js
  92. +0 −219 program/js/tinymce/langs/uk_UA.js
  93. +0 −219 program/js/tinymce/langs/vi.js
  94. +0 −219 program/js/tinymce/langs/vi_VN.js
  95. +0 −197 program/js/tinymce/langs/zh_CN.js
  96. +0 −219 program/js/tinymce/langs/zh_TW.js
  97. +0 −504 program/js/tinymce/license.txt
  98. +0 −1 program/js/tinymce/plugins/advlist/plugin.min.js
  99. +0 −1 program/js/tinymce/plugins/anchor/plugin.min.js
  100. +0 −1 program/js/tinymce/plugins/autolink/plugin.min.js
  101. +0 −1 program/js/tinymce/plugins/autoresize/plugin.min.js
  102. +0 −1 program/js/tinymce/plugins/autosave/plugin.min.js
  103. +0 −1 program/js/tinymce/plugins/bbcode/plugin.min.js
  104. +0 −1 program/js/tinymce/plugins/charmap/plugin.min.js
  105. +0 −1 program/js/tinymce/plugins/code/plugin.min.js
  106. +0 −1 program/js/tinymce/plugins/colorpicker/plugin.min.js
  107. +0 −1 program/js/tinymce/plugins/contextmenu/plugin.min.js
  108. +0 −1 program/js/tinymce/plugins/directionality/plugin.min.js
  109. BIN program/js/tinymce/plugins/emoticons/img/smiley-cool.gif
  110. BIN program/js/tinymce/plugins/emoticons/img/smiley-cry.gif
  111. BIN program/js/tinymce/plugins/emoticons/img/smiley-embarassed.gif
  112. BIN program/js/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif
  113. BIN program/js/tinymce/plugins/emoticons/img/smiley-frown.gif
  114. BIN program/js/tinymce/plugins/emoticons/img/smiley-innocent.gif
  115. BIN program/js/tinymce/plugins/emoticons/img/smiley-kiss.gif
  116. BIN program/js/tinymce/plugins/emoticons/img/smiley-laughing.gif
  117. BIN program/js/tinymce/plugins/emoticons/img/smiley-money-mouth.gif
  118. BIN program/js/tinymce/plugins/emoticons/img/smiley-sealed.gif
  119. BIN program/js/tinymce/plugins/emoticons/img/smiley-smile.gif
  120. BIN program/js/tinymce/plugins/emoticons/img/smiley-surprised.gif
  121. BIN program/js/tinymce/plugins/emoticons/img/smiley-tongue-out.gif
  122. BIN program/js/tinymce/plugins/emoticons/img/smiley-undecided.gif
  123. BIN program/js/tinymce/plugins/emoticons/img/smiley-wink.gif
  124. BIN program/js/tinymce/plugins/emoticons/img/smiley-yell.gif
  125. +0 −1 program/js/tinymce/plugins/emoticons/plugin.min.js
  126. +0 −1 program/js/tinymce/plugins/fullpage/plugin.min.js
  127. +0 −1 program/js/tinymce/plugins/fullscreen/plugin.min.js
  128. +0 −1 program/js/tinymce/plugins/hr/plugin.min.js
  129. +0 −1 program/js/tinymce/plugins/image/plugin.min.js
  130. +0 −1 program/js/tinymce/plugins/importcss/plugin.min.js
  131. +0 −1 program/js/tinymce/plugins/insertdatetime/plugin.min.js
  132. +0 −1 program/js/tinymce/plugins/layer/plugin.min.js
  133. +0 −1 program/js/tinymce/plugins/legacyoutput/plugin.min.js
  134. +0 −1 program/js/tinymce/plugins/link/plugin.min.js
  135. +0 −1 program/js/tinymce/plugins/lists/plugin.min.js
  136. +0 −1 program/js/tinymce/plugins/media/plugin.min.js
  137. +0 −1 program/js/tinymce/plugins/nonbreaking/plugin.min.js
  138. +0 −1 program/js/tinymce/plugins/noneditable/plugin.min.js
  139. +0 −1 program/js/tinymce/plugins/pagebreak/plugin.min.js
  140. +0 −1 program/js/tinymce/plugins/paste/plugin.min.js
  141. +0 −1 program/js/tinymce/plugins/preview/plugin.min.js
  142. +0 −1 program/js/tinymce/plugins/print/plugin.min.js
  143. +0 −1 program/js/tinymce/plugins/save/plugin.min.js
  144. +0 −1 program/js/tinymce/plugins/searchreplace/plugin.min.js
  145. +0 −1 program/js/tinymce/plugins/spellchecker/plugin.min.js
  146. +0 −1 program/js/tinymce/plugins/tabfocus/plugin.min.js
  147. +0 −2 program/js/tinymce/plugins/table/plugin.min.js
  148. +0 −1 program/js/tinymce/plugins/template/plugin.min.js
  149. +0 −1 program/js/tinymce/plugins/textcolor/plugin.min.js
  150. +0 −135 program/js/tinymce/plugins/visualblocks/css/visualblocks.css
  151. +0 −1 program/js/tinymce/plugins/visualblocks/plugin.min.js
  152. +0 −1 program/js/tinymce/plugins/visualchars/plugin.min.js
  153. +0 −1 program/js/tinymce/plugins/wordcount/plugin.min.js
  154. +0 −1 program/js/tinymce/skins/lightgray/content.inline.min.css
  155. +0 −1 program/js/tinymce/skins/lightgray/content.min.css
  156. +0 −1 program/js/tinymce/skins/lightgray/fonts/readme.md
  157. +0 −175 program/js/tinymce/skins/lightgray/fonts/tinymce-small.dev.svg
  158. BIN program/js/tinymce/skins/lightgray/fonts/tinymce-small.eot
  159. +0 −63 program/js/tinymce/skins/lightgray/fonts/tinymce-small.svg
  160. BIN program/js/tinymce/skins/lightgray/fonts/tinymce-small.ttf
  161. BIN program/js/tinymce/skins/lightgray/fonts/tinymce-small.woff
  162. +0 −153 program/js/tinymce/skins/lightgray/fonts/tinymce.dev.svg
  163. BIN program/js/tinymce/skins/lightgray/fonts/tinymce.eot
  164. +0 −129 program/js/tinymce/skins/lightgray/fonts/tinymce.svg
  165. BIN program/js/tinymce/skins/lightgray/fonts/tinymce.ttf
  166. BIN program/js/tinymce/skins/lightgray/fonts/tinymce.woff
  167. BIN program/js/tinymce/skins/lightgray/img/anchor.gif
  168. BIN program/js/tinymce/skins/lightgray/img/loader.gif
  169. BIN program/js/tinymce/skins/lightgray/img/object.gif
  170. BIN program/js/tinymce/skins/lightgray/img/trans.gif
  171. +0 −1 program/js/tinymce/skins/lightgray/skin.ie7.min.css
  172. +0 −1 program/js/tinymce/skins/lightgray/skin.min.css
  173. +0 −1 program/js/tinymce/themes/modern/theme.min.js
  174. +0 −13 program/js/tinymce/tinymce.min.js
  175. 0 program/{js/tinymce/roundcube → resources/tinymce}/browser.css
  176. 0 program/{js/tinymce/roundcube → resources/tinymce}/content.css
  177. BIN program/{js/tinymce/roundcube → resources/tinymce}/video.png
View
@@ -41,13 +41,16 @@ INSTALLATION
============
1. Decompress and put this folder somewhere inside your document root
-2. Install dependencies using composer:
- - get composer from https://getcomposer.org/download/
- - rename the composer.json-dist file into composer.json
- - if you want to use LDAP address books, enable the LDAP libraries in your
- composer.json file by moving the items from "suggest" to the "require"
- section (remove the explanation texts after the version!).
- - run `php composer.phar install --no-dev`
+2. In case you don't use the so-called "complete" release package,
+ you have to install PHP and javascript dependencies.
+ 2.1. Install PHP dependencies using composer:
+ - get composer from https://getcomposer.org/download/
+ - rename the composer.json-dist file into composer.json
+ - if you want to use LDAP address books, enable the LDAP libraries in your
+ composer.json file by moving the items from "suggest" to the "require"
+ section (remove the explanation texts after the version!).
+ - run `php composer.phar install --no-dev`
+ 2.2. Install Javascript dependencies by executing `bin/install-jsdeps.sh` script.
3. Make sure that the following directories (and the files within)
are writable by the webserver
- /temp
View
@@ -0,0 +1,308 @@
+#!/usr/bin/env php
+<?php
+/*
+ +-----------------------------------------------------------------------+
+ | bin/install-jsdeps.sh |
+ | |
+ | This file is part of the Roundcube Webmail client |
+ | Copyright (C) 2016, The Roundcube Dev Team |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ | PURPOSE: |
+ | Utility script to fetch and install all 3rd party javascript |
+ | libraries unsed in Roundcube from source. |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <thomas@roundcube.net> |
+ +-----------------------------------------------------------------------+
+*/
+
+define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
+
+require_once INSTALL_PATH . 'program/include/clisetup.php';
+
+$SOURCES = json_decode(file_get_contents(INSTALL_PATH . 'jsdeps.json'), true);
+
+if (empty($SOURCES['dependencies'])) {
+ die("ERROR: Failed to read sources from " . INSTALL_PATH . "jsdeps.json\n");
+}
+
+$CURL = trim(`which curl`);
+$WGET = trim(`which wget`);
+$UNZIP = trim(`which unzip`);
+$FILEINFO = trim(`which file`);
+
+$CACHEDIR = sys_get_temp_dir();
+
+if (is_writeable(INSTALL_PATH . 'temp/js_cache') || mkdir(INSTALL_PATH . 'temp/js_cache', 0774, true)) {
+ $CACHEDIR = INSTALL_PATH . 'temp/js_cache';
+}
+
+
+//////////////// License definitions
+
+$LICENSES = array();
+$LICENSES['MIT'] = <<<EOM
+ * Licensed under the MIT licenses
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+EOM;
+
+$LICENSES['GPLv3'] = <<<EOG
+ * The JavaScript code in this page is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GNU GPL) as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option)
+ * any later version. The code is distributed WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+ *
+ * As additional permission under GNU GPL version 3 section 7, you
+ * may distribute non-source (e.g., minimized or compacted) forms of
+ * that code without the copy of the GNU GPL normally required by
+ * section 4, provided you include this license notice and a URL
+ * through which recipients can access the Corresponding Source.
+
+EOG;
+
+$LICENSES['LGPL'] = <<<EOL
+ * The JavaScript code in this page is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option)
+ * any later version.
+
+EOL;
+
+
+//////////////// Functions
+
+/**
+ * Fetch package file from source
+ */
+function fetch_from_source($package, $useCache = true, &$filetype = null)
+{
+ global $CURL, $WGET, $FILEINFO, $CACHEDIR;
+
+ $filetype = pathinfo($package['url'], PATHINFO_EXTENSION) ?: 'tmp';
+ $cache_file = $CACHEDIR . '/' . $package['lib'] . '-' . $package['version'] . '.' . $filetype;
+
+ if (!is_readable($cache_file) || !$useCache) {
+ echo "Fetching $package[url]\n";
+
+ if ($CURL)
+ exec(sprintf('%s -s %s -o %s', $CURL, escapeshellarg($package['url']), $cache_file), $out, $retval);
+ else
+ exec(sprintf('%s -q %s -O %s', $WGET, escapeshellarg($package['url']), $cache_file), $out, $retval);
+
+ if ($retval !== 0) {
+ die("ERROR: Failed to download source file from " . $package['url'] . "\n");
+ }
+ }
+
+ if (!empty($package['sha1']) && ($sum = sha1_file($cache_file)) !== $package['sha1']) {
+ die("ERROR: Incorrect sha1 sum of $cache_file. Expected: $package[sha1], got: $sum\n");
+ }
+
+ // detect downloaded/cached file type
+ exec(sprintf('%s -b %s', $FILEINFO, $cache_file), $out);
+ if (stripos($out[0], 'zip') === 0) {
+ $filetype = 'zip';
+ }
+
+ return $cache_file;
+}
+
+/**
+ * Create a destination javascript file with copyright and license header
+ */
+function compose_destfile($package, $srcfile)
+{
+ global $LICENSES;
+
+ $header = sprintf("/**\n * %s - v%s\n *\n", $package['name'], $package['version']);
+
+ if (!empty($package['source'])) {
+ $header .= " * @source " . $package['source'] . "\n";
+ $header .= " *\n";
+ }
+
+ if (!empty($package['license']) && isset($LICENSES[$package['license']])) {
+ $header .= " * @licstart The following is the entire license notice for the\n";
+ $header .= " * JavaScript code in this file.\n";
+ $header .= " *\n";
+ if (!empty($package['copyright'])) {
+ $header .= " * " . $package['copyright'] . "\n";
+ $header .= " *\n";
+ }
+
+ $header .= $LICENSES[$package['license']];
+ $header .= " *\n";
+ $header .= " * @licend The above is the entire license notice\n";
+ $header .= " * for the JavaScript code in this file.\n";
+ }
+
+ $header .= " */\n";
+
+ if (file_put_contents(INSTALL_PATH . $package['dest'], $header . file_get_contents($srcfile))) {
+ echo "Wrote file " . INSTALL_PATH . $package['dest'] . "\n";
+ }
+ else {
+ die("ERROR: Failed to write destination file " . INSTALL_PATH . $package['dest'] . "\n");
+ }
+}
+
+/**
+ * Extract a Zip archive into the destination specified by the package config
+ */
+function extract_zipfile($package, $srcfile)
+{
+ global $UNZIP, $CACHEDIR;
+
+ $destdir = INSTALL_PATH . $package['dest'];
+ if (!is_dir($destdir)) {
+ mkdir($destdir, 0774, true);
+ }
+
+ if (!is_writeable($destdir)) {
+ die("ERROR: Cannot write to destination directory $destdir\n");
+ }
+
+ // pick files from zip archive
+ if (!empty($package['pick'])) {
+ foreach ($package['pick'] as $pattern) {
+ echo "Extracting files $pattern into $destdir\n";
+ exec(sprintf('%s -o %s %s -d %s', $UNZIP, escapeshellarg($srcfile), escapeshellarg($pattern), $destdir), $out, $retval);
+ if ($retval !== 0) {
+ echo "ERROR: Failed to unpack $pattern; " . join('; ' . $out) . "\n";
+ }
+ }
+ }
+ // unzip the archive and map source to dest files/directories
+ else if (!empty($package['map'])) {
+ $extract = $CACHEDIR . '/' . $package['lib'] . '-extract';
+ exec(sprintf('%s -o %s -d %s', $UNZIP, escapeshellarg($srcfile), $extract), $out, $retval);
+
+ foreach ($package['map'] as $src => $dest) {
+ echo "Installing files $extract/$src into $destdir/$dest\n";
+
+ // make sure the destination's parent directory exists
+ if (strpos($dest, '/') !== false) {
+ $parentdir = dirname($destdir . '/' . $dest);
+ if (!is_dir($parentdir)) {
+ mkdir($parentdir, 0774, true);
+ }
+ }
+
+ // avoid copying source directory as a child into destination
+ if (is_dir($extract . '/' . $src) && is_dir($destdir . '/' . $dest)) {
+ exec(sprintf('rm -rf %s/%s', $destdir, $dest));
+ }
+
+ exec(sprintf('mv -f %s/%s %s/%s', $extract, $src, $destdir, $dest), $out, $retval);
+ if ($retval !== 0) {
+ echo "ERROR: Failed to move $src into $destdir/$dest; " . join('; ' . $out) . "\n";
+ }
+ }
+
+ // remove temp extraction dir
+ exec('rm -rf ' . $extract);
+ }
+ // extract the archive into the destination directory
+ else {
+ echo "Extracting zip archive into $destdir\n";
+ exec(sprintf('%s -o %s -d %s', $UNZIP, escapeshellarg($srcfile), $destdir), $out, $retval);
+ if ($retval !== 0) {
+ echo "ERROR: Failed to unzip $srcfile; " . join('; ' . $out) . "\n";
+ }
+ }
+
+ // remove some files from the destination
+ if (!empty($package['omit'])) {
+ foreach ((array)$package['omit'] as $glob) {
+ exec(sprintf('rm -rf %s/%s', $destdir, escapeshellarg($glob)));
+ }
+ }
+
+ // prepend license header to extracted files
+ if (!empty($package['addlicense'])) {
+ foreach ((array)$package['addlicense'] as $filename) {
+ $pkg = $package;
+ $pkg['dest'] = $package['dest'] . '/' . $filename;
+ compose_destfile($pkg, $destdir . '/' . $filename);
+ }
+ }
+}
+
+/**
+ * Delete the package destination file/dir
+ */
+function delete_destfile($package)
+{
+ $destdir = INSTALL_PATH . ($package['rm'] ?: $package['dest']);
+
+ if (file_exists($destdir)) {
+ if (PHP_OS === 'Windows') {
+ exec(sprintf("rd /s /q %s", escapeshellarg($destdir)));
+ }
+ else {
+ exec(sprintf("rm -rf %s", escapeshellarg($destdir)));
+ }
+ }
+}
+
+
+//////////////// Execution
+
+$args = rcube_utils::get_opt(array('f' => 'force:bool', 'd' => 'delete:bool'))
+ + array('force' => false, 'delete' => false);
+$WHAT = $args[0];
+
+foreach ($SOURCES['dependencies'] as $package) {
+ if (!isset($package['name'])) {
+ $package['name'] = $package['lib'];
+ }
+
+ if ($WHAT && $package['lib'] !== $WHAT) {
+ continue;
+ }
+
+ if ($args['delete']) {
+ delete_destfile($package);
+ continue;
+ }
+
+ echo "Installing $package[name]...\n";
+
+ $srcfile = fetch_from_source($package, !$args['force'], $filetype);
+
+ if ($filetype === 'zip') {
+ extract_zipfile($package, $srcfile);
+ }
+ else {
+ compose_destfile($package, $srcfile);
+ }
+
+ echo "Done.\n\n";
+}
+
Oops, something went wrong.

0 comments on commit 25de39d

Please sign in to comment.