# HG changeset patch # User Charlie Root # Date 1546601936 18000 # Node ID 0c9c57d9d4dd7a75f80cc4ec87dcd04a3e0857f8 # Parent bf99236cc5cda9da13a5d1a7ffaab3d408957f26 maybe stragglers from 1.3.3, after another mistaken apt-get install of 1.2.3 diff -r bf99236cc5cd -r 0c9c57d9d4dd bin/initdb.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/initdb.sh Fri Jan 04 06:38:56 2019 -0500 @@ -0,0 +1,42 @@ +#!/usr/bin/env php + | + +-----------------------------------------------------------------------+ +*/ + +define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' ); + +require_once INSTALL_PATH . 'program/include/clisetup.php'; + +// get arguments +$opts = rcube_utils::get_opt(array( + 'd' => 'dir', +)); + +if (empty($opts['dir'])) { + rcube::raise_error("Database schema directory not specified (--dir).", false, true); +} + +// Check if directory exists +if (!file_exists($opts['dir'])) { + rcube::raise_error("Specified database schema directory doesn't exist.", false, true); +} + +rcmail_utils::db_init($opts['dir']); + +?> diff -r bf99236cc5cd -r 0c9c57d9d4dd bin/install-jsdeps.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/install-jsdeps.sh Fri Jan 04 06:38:56 2019 -0500 @@ -0,0 +1,328 @@ +#!/usr/bin/env php + | + +-----------------------------------------------------------------------+ +*/ + +define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' ); + +require_once INSTALL_PATH . 'program/include/clisetup.php'; + +if (!function_exists('exec')) { + die("PHP exec() function is required. Check disable_functions in php.ini\n"); +} + +$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`); + +if (empty($UNZIP)) { + die("ERROR: Required program 'unzip' not found\n"); +} +if (empty($FILEINFO)) { + die("ERROR: Required program 'file' not found\n"); +} +if (empty($CURL) && empty($WGET)) { + die("ERROR: Required program 'wget' or 'curl' not found\n"); +} + +$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'] = << $dest) { + echo "Installing files $sourcedir/$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($sourcedir . '/' . $src) && is_dir($destdir . '/' . $dest)) { + exec(sprintf('rm -rf %s/%s', $destdir, $dest)); + } + + exec(sprintf('mv -f %s/%s %s/%s', $sourcedir, $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"; +} diff -r bf99236cc5cd -r 0c9c57d9d4dd jsdeps.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jsdeps.json Fri Jan 04 06:38:56 2019 -0500 @@ -0,0 +1,87 @@ +{ + "dependencies": [ + { + "lib": "jquery", + "name": "jQuery", + "version": "3.2.1", + "url": "https://code.jquery.com/jquery-3.2.1.min.js", + "dest": "program/js/jquery.min.js", + "sha1": "1055018c28ab41087ef9ccefe411606893dabea2", + "license": "MIT", + "copyright": "Copyright 2005, 2015 jQuery Foundation, Inc.", + "source": "https://github.com/jquery/jquery/tree/3.2.1" + }, + { + "lib": "jstz", + "name": "jsTimezoneDetect", + "version": "1.0.6", + "url": "https://bitbucket.org/pellepim/jstimezonedetect/raw/6c427658686c664da52c6a87cd62ec910baab276/dist/jstz.min.js", + "dest": "program/js/jstz.min.js", + "sha1": "4291cd3b259d2060460c2a6ab99f428d3c0c9537", + "license": "MIT", + "copyright": "Copyright (c) Jon Nylander", + "source": "https://bitbucket.org/pellepim/jstimezonedetect/raw/6c427658686c664da52c6a87cd62ec910baab276/dist/jstz.js" + }, + { + "lib": "publickey", + "name": "PublicKey.js", + "version": "0e011cb", + "url": "https://raw.githubusercontent.com/diafygi/publickeyjs/0e011cb18907a1adc0313aa92e69cd8858e1ef66/publickey.js", + "dest": "program/js/publickey.js", + "sha1": "d0920e190754e024c4be76ad5bbc7e76b2e37a4d", + "license": "GPLv3", + "copyright": "Copyright (c) 2015 Daniel Roesler", + "source": "https://github.com/diafygi/publickeyjs/blob/master/publickey.js" + }, + { + "lib": "tinymce", + "version": "4.5.8", + "url": "http://download.ephox.com/tinymce/community/tinymce_4.5.8.zip", + "dest": "program/js", + "sha1": "08b0757264adb86066940bbafb7aa9ec0c7c6685", + "license": "LGPL", + "copyright": "Copyright (c) 1999-2015 Ephox Corp. All rights reserved", + "rm": "program/js/tinymce", + "map": { + "js/tinymce": "tinymce" + }, + "omit": [ + "tinymce/license.txt", + "tinymce/jquery.tinymce.min.js" + ], + "addlicense": [ + "tinymce/tinymce.min.js" + ] + }, + { + "lib": "tinymce-langs", + "version": "4.5.8", + "url": "https://tinymce-services.azurewebsites.net/1/i18n/download?langs=ar,hy,az,eu,be,bs,bg_BG,ca,zh_CN,zh_TW,hr,cs,cs_CZ,da,nl,en_CA,en_GB,eo,et,fo,fi,fr_FR,fr_CH,gd,gl,ka_GE,de,de_AT,el,he_IL,hi_IN,hu_HU,is_IS,id,ga,it,ja,kab,km_KH,ko_KR,ku,ku_IQ,lv,lt,lb,mk_MK,ml_IN,nb_NO,oc,fa,fa_IR,pl,pt_BR,pt_PT,ro,ru,sk,sl_SI,es,es_MX,sv_SE,tg,ta,ta_IN,tt,th_TH,tr,tr_TR,ug,uk,uk_UA,vi,vi_VN,cy", + "dest": "program/js/tinymce" + }, + { + "lib": "openpgp", + "name": "OpenPGP.js", + "version": "1.6.2", + "url": "https://raw.githubusercontent.com/openpgpjs/openpgpjs/v1.6.2/dist/openpgp.min.js", + "dest": "plugins/enigma/openpgp.min.js", + "sha1": "de75af6883019f490f69211e506377c84f49a85b", + "license": "LGPL", + "copyright": "Copyright (c) OpenPGP Development Team", + "source": "https://github.com/openpgpjs/openpgpjs/blob/v1.6.2/dist/openpgp.js" + }, + { + "lib": "codemirror", + "version": "5.21.0", + "url": "http://codemirror.net/codemirror-5.21.0.zip", + "dest": "plugins/managesieve/codemirror", + "sha1": "3b767c2e3acd6796e54ed19ed2ac0755fcf87984", + "license": "MIT", + "map": { + "lib": "lib", + "addon/selection": "addon/selection", + "mode/sieve": "mode/sieve" + } + } + ] +} \ No newline at end of file