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 @@
- +
diff --git a/owncloud/owncloud/extension-lib.inc b/owncloud/owncloud/extension-lib.inc index 7246b2b..490bc01 100644 --- a/owncloud/owncloud/extension-lib.inc +++ b/owncloud/owncloud/extension-lib.inc @@ -2,7 +2,7 @@ /* extension-lib.inc - Copyright (c) 2016 - 2018 Andreas Schmidhuber + Copyright (c) 2016 - 2019 Andreas Schmidhuber All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,9 +26,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -$extension_lib_version = "1.1"; +$extension_lib_version = "1.3"; /* Version history: - * 1.1 2017.02.28 save config in ext_remove_rc_commands and ext_create_rc_commands + * 1.3 2018.12.01 function ext_load_config: removed -> $config_data = utf8_encode($config_data); reason: wrong national character encoding + * 1.2 2018.08.13 function ext_check_version: append line break to the output message + * 1.1 2017.02.28 save config in ext_remove_rc_commands and ext_create_rc_commands * 1.0 2017.02.27 includes changes for PHP 7.1 */ @@ -162,7 +164,7 @@ if (!function_exists('ext_check_version')) { $return_val = mwexec("fetch -o {$test_filename} https://raw.github.com/crestAT/nas4free-{$extension_name}/master/{$extension_name}/version.txt", false); if ($return_val == 0) { $server_version = exec("cat {$test_filename}"); - if ($server_version != $current_version) return sprintf(gettext("New extension version %s available, push '%s' button to install the new version!"), $server_version, $button_name); + if ($server_version != $current_version) return sprintf(gettext("New extension version %s available, push '%s' button to install the new version!"), $server_version, $button_name)."
"; } else return false; } @@ -181,7 +183,6 @@ if (!function_exists('ext_load_config')) { function ext_load_config($config_file, $assoc = true, $depth = 512, $options = 0) { if (is_file($config_file)) { if (($config_data = file_get_contents($config_file)) === false) return false; - $config_data = utf8_encode($config_data); $config_data = json_decode($config_data, $assoc, $depth, $options); return $config_data; } diff --git a/owncloud/release_notes.txt b/owncloud/release_notes.txt index cff628c..19a495b 100644 --- a/owncloud/release_notes.txt +++ b/owncloud/release_notes.txt @@ -1,4 +1,7 @@ Version Date Description +0.3.5 2019.05.11 N: add memory_limit=512M to nextowncloud-php.ini + F: dynamical load appropriate smbclient PHP extension on system upgrades + 0.3.4 2018.11.29 N: add smbclient PHP extension for external storage support N: add to Webserver > Auxparam: setenv.set-response-header = ("Referrer-Policy"=>"no-referrer") diff --git a/owncloud/version.txt b/owncloud/version.txt index 448a0fa..09e9157 100644 --- a/owncloud/version.txt +++ b/owncloud/version.txt @@ -1 +1 @@ -0.3.4 \ No newline at end of file +0.3.5 \ No newline at end of file diff --git a/owncloud/z-nextowncloud-php.ini b/owncloud/z-nextowncloud-php.ini index 104f242..fecf12a 100644 --- a/owncloud/z-nextowncloud-php.ini +++ b/owncloud/z-nextowncloud-php.ini @@ -5,3 +5,4 @@ opcache.max_accelerated_files=10000 opcache.memory_consumption=128 opcache.save_comments=1 opcache.revalidate_freq=1 +memory_limit=512M