Skip to content

Commit

Permalink
v0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
crestAT committed May 12, 2019
1 parent 9e12bdf commit 7f6dc82
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion owncloud/bin/ext-20-smbclient.ini

This file was deleted.

Binary file removed owncloud/bin/smbclient.so
Binary file not shown.
5 changes: 3 additions & 2 deletions owncloud/owncloud-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions owncloud/owncloud-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";

Expand All @@ -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}");
Expand Down
29 changes: 24 additions & 5 deletions owncloud/owncloud-start.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions owncloud/owncloud-update_extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -121,7 +121,7 @@
<tr>
<td class="listt">
<div>
<textarea style="width: 98%;" id="content" name="content" class="listcontent" cols="1" rows="25" readonly="readonly"><?php unset($lines); exec("/bin/cat {$configuration['rootfolder']}/release_notes.txt", $lines); foreach ($lines as $line) { echo $line."\n"; }?></textarea>
<textarea id="content" name="content" class="listcontent" cols="1" rows="25" readonly="readonly"><?php unset($lines); exec("/bin/cat {$configuration['rootfolder']}/release_notes.txt", $lines); foreach ($lines as $line) { echo $line."\n"; }?></textarea>
</div>
</td>
</tr>
Expand Down
11 changes: 6 additions & 5 deletions owncloud/owncloud/extension-lib.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
*/

Expand Down Expand Up @@ -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)."<br />";
}
else return false;
}
Expand All @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions owncloud/release_notes.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion owncloud/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.4
0.3.5
1 change: 1 addition & 0 deletions owncloud/z-nextowncloud-php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
memory_limit=512M

0 comments on commit 7f6dc82

Please sign in to comment.