diff --git a/LICENSE.txt b/LICENSE.txt index a23e24e..53c17b4 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ BSD 2-Clause License -Copyright (c) 2015 - 2018 Andreas Schmidhuber +Copyright (c) 2015 - 2019 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/owncloud/bin/ext-20-smbclient.ini b/owncloud/bin/ext-20-smbclient.ini deleted file mode 100644 index f93fe4a..0000000 --- a/owncloud/bin/ext-20-smbclient.ini +++ /dev/null @@ -1 +0,0 @@ -extension=smbclient.so diff --git a/owncloud/bin/smbclient.so b/owncloud/bin/smbclient.so deleted file mode 100644 index bb3eb12..0000000 Binary files a/owncloud/bin/smbclient.so and /dev/null differ diff --git a/owncloud/owncloud-config.php b/owncloud/owncloud-config.php index 6ce71c5..ff09310 100644 --- a/owncloud/owncloud-config.php +++ b/owncloud/owncloud-config.php @@ -2,7 +2,7 @@ /* owncloud-config.php - Copyright (c) 2015 - 2018 Andreas Schmidhuber + Copyright (c) 2015 - 2019 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -181,7 +181,8 @@ function change_perms($dir) { } if (is_array($config['websrv'])) { // Prepare Webserver for additional settings to prevent warnings from NC/OC - $rc_param_count = count($config['websrv']['auxparam']); + if (is_array($config['websrv']['auxparam'])) $rc_param_count = count($config['websrv']['auxparam']); + else $rc_param_count = 0; // check for Strict-Transport-Security $rc_param_found = 0; for ($i = 0; $i < $rc_param_count; $i++) if (preg_match("/Strict-Transport-Security/", $config['websrv']['auxparam'][$i])) $rc_param_found = 1; diff --git a/owncloud/owncloud-install.php b/owncloud/owncloud-install.php index b024f3e..445e550 100644 --- a/owncloud/owncloud-install.php +++ b/owncloud/owncloud-install.php @@ -2,7 +2,7 @@ /* owncloud-install.php - Copyright (c) 2015 - 2018 Andreas Schmidhuber + Copyright (c) 2015 - 2019 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -$version = "v0.3.4"; // extension version +$version = "v0.3.5"; // extension version $appname = "NextOwnCloud"; // extension name $config_name = "owncloud"; @@ -52,7 +52,7 @@ // fetch release archive $return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}/master.zip https://github.com/crestAT/nas4free-{$config_name}/releases/download/{$version}/{$config_name}-{$version_striped}.zip", false); if ($return_val == 0) { - $return_val = mwexec("tar -xf {$install_dir}/master.zip -C {$install_dir}/ --exclude='.git*' --strip-components 2", true); + $return_val = mwexec("LC_ALL=en_US.UTF-8 tar -xf {$install_dir}/master.zip -C {$install_dir}/ --exclude='.git*' --strip-components 2", true); if ($return_val == 0) { exec("rm {$install_dir}/master.zip"); exec("chmod -R 775 {$install_dir}"); diff --git a/owncloud/owncloud-start.php b/owncloud/owncloud-start.php index 2ccb9fa..4140637 100644 --- a/owncloud/owncloud-start.php +++ b/owncloud/owncloud-start.php @@ -2,7 +2,7 @@ /* owncloud-start.php - Copyright (c) 2015 - 2018 Andreas Schmidhuber + Copyright (c) 2015 - 2019 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -27,19 +27,38 @@ */ require_once("config.inc"); $rootfolder = dirname(__FILE__); +require_once("{$rootfolder}/owncloud/extension-lib.inc"); unlink_if_exists("/usr/local/www/ext/owncloud"); // prevent nested symlinks $return_val = 0; +// required for external storage inclusion -> PHP-smbclient +$pkgName = "smbclient"; +$pkgFileNameNeeded = "php".PHP_MAJOR_VERSION.PHP_MINOR_VERSION."-pecl-{$pkgName}"; // needed file PHP version based +if (($manifest = ext_load_config("{$rootfolder}/bin/+MANIFEST")) !== false) $pkgManifestFileName = $manifest['name']; // currently installed pkg +if ($pkgFileNameNeeded != $pkgManifestFileName) { // if manifest not exists or PHP version changed ... + $pkgNeeded = exec("pkg search {$pkgName} | awk '/{$pkgFileNameNeeded}/ {print $1}'", $execOutput, $return_val); // retrieve available packages + $pkgFile = "{$rootfolder}/bin/All/{$pkgNeeded}.txz"; // create package file name + if (!is_file($pkgFile)) exec("pkg fetch -y -o {$rootfolder}/bin {$pkgNeeded}", $execOutput, $return_val); // fetch necessary package + $return_val += mwexec("LC_ALL=en_US.UTF-8 tar -xzf {$pkgFile} -C {$rootfolder}/bin", true); // extract package + $manifest = ext_load_config("{$rootfolder}/bin/+MANIFEST"); +} +$return_val += mwexec("mkdir -p ".PHP_EXTENSION_DIR, true); // create dir if not exist +foreach ($manifest['files'] as $mFKey => $mFValue) { + if (strpos($mFKey, "{$pkgName}.so") > 0) { // get lib path for copying + $libPath = "{$rootfolder}/bin{$mFKey}"; + $return_val += mwexec("cp {$libPath} ".PHP_EXTENSION_DIR, true); + } + if (strpos($mFKey, "{$pkgName}.ini") > 0) { // get ini path for copying + $libPath = "{$rootfolder}/bin{$mFKey}"; + $return_val += mwexec("cp {$libPath} {$mFKey}", true); + } +} // create links to extension files $return_val += mwexec("ln -sf {$rootfolder}/locale-owncloud /usr/local/share/", true); $return_val += mwexec("ln -sf {$rootfolder}/owncloud-config.php /usr/local/www/owncloud-config.php", true); $return_val += mwexec("ln -sf {$rootfolder}/owncloud-update_extension.php /usr/local/www/owncloud-update_extension.php", true); $return_val += mwexec("mkdir -p /usr/local/www/ext", true); $return_val += mwexec("ln -sf {$rootfolder}/owncloud /usr/local/www/ext/owncloud", true); -// required for external storage inclusion -> PHP-smbclient -$return_val += mwexec("mkdir -p /usr/local/lib/php/extensions/no-debug-non-zts-20170718", true); -$return_val += mwexec("cp {$rootfolder}/bin/smbclient.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718/smbclient.so", true); -$return_val += mwexec("cp {$rootfolder}/bin/ext-20-smbclient.ini /usr/local/etc/php/ext-20-smbclient.ini", true); // override system defaults => opcache.max_accelerated_files=10000 and opcache.revalidate_freq=1 etc $return_val += mwexec("cp {$rootfolder}/z-nextowncloud-php.ini /usr/local/etc/php/", true); $return_val += mwexec("echo upload_tmp_dir={$config['websrv']['uploaddir']} >> /usr/local/etc/php/z-nextowncloud-php.ini", true); diff --git a/owncloud/owncloud-update_extension.php b/owncloud/owncloud-update_extension.php index 8b1589c..f213621 100644 --- a/owncloud/owncloud-update_extension.php +++ b/owncloud/owncloud-update_extension.php @@ -2,7 +2,7 @@ /* owncloud-update_extension.php - Copyright (c) 2015 - 2018 Andreas Schmidhuber + Copyright (c) 2015 - 2019 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -58,7 +58,7 @@ if (is_link("/usr/local/www/owncloud-update_extension.php")) unlink("/usr/local/www/owncloud-update_extension.php"); if (is_link("/usr/local/www/ext/owncloud")) unlink("/usr/local/www/ext/owncloud"); mwexec("rmdir -p /usr/local/www/ext"); - if (is_file("/usr/local/lib/php/extensions/no-debug-non-zts-20170718/smbclient.so")) unlink("/usr/local/lib/php/extensions/no-debug-non-zts-20170718/smbclient.so"); + if (is_file(PHP_EXTENSION_DIR."/smbclient.so")) unlink(PHP_EXTENSION_DIR."/smbclient.so"); if (is_file("/usr/local/etc/php/ext-20-smbclient.ini")) unlink("/usr/local/etc/php/ext-20-smbclient.ini"); write_config(); mwexec("rm /usr/local/etc/php/z-nextowncloud-php.ini && service websrv restart"); @@ -121,7 +121,7 @@