Bug 20428: Make upload_tmp a more general tmp directory
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
8ffaa7b8a3
commit
fdb5d0ca1a
|
|
@ -168,7 +168,10 @@ Returns root directory for temporary storage
|
|||
|
||||
sub temporary_directory {
|
||||
my ( $class ) = @_;
|
||||
return C4::Context->config('upload_tmp_path') || File::Spec->tmpdir;
|
||||
my $temporary_directory = ( C4::Context->config('tmp_path') )
|
||||
? C4::Context->config('tmp_path') . '/uploads'
|
||||
: File::Spec->tmpdir;
|
||||
return $temporary_directory;
|
||||
}
|
||||
|
||||
=head3 _type
|
||||
|
|
|
|||
7
about.pl
7
about.pl
|
|
@ -24,6 +24,7 @@ use Modern::Perl;
|
|||
|
||||
use CGI qw ( -utf8 );
|
||||
use DateTime::TimeZone;
|
||||
use File::Spec;
|
||||
use List::MoreUtils qw/ any /;
|
||||
use LWP::Simple;
|
||||
use Module::Load::Conditional qw(can_load);
|
||||
|
|
@ -261,10 +262,10 @@ if ( ! defined C4::Context->config('upload_path') ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! defined C4::Context->config('upload_tmp_path') ) {
|
||||
if ( ! defined C4::Context->config('tmp_path') ) {
|
||||
push @xml_config_warnings, {
|
||||
error => 'uploadtmppath_entry_missing',
|
||||
effective_upload_tmp_dir => Koha::UploadedFile->temporary_directory
|
||||
error => 'tmp_path_entry_missing',
|
||||
effective_tmp_dir => File::Spec->tmpdir
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<arg><option>--template-cache-dir</option> directory</arg>
|
||||
<arg><option>--timezone</option> time/zone</arg>
|
||||
<arg><option>--upload-path</option> directory</arg>
|
||||
<arg><option>--upload-tmp-path</option> directory</arg>
|
||||
<arg><option>--tmp-path</option> directory</arg>
|
||||
<arg><option>--letsencrypt</option></arg>
|
||||
<arg><option>--help</option>|<option>-h</option></arg>
|
||||
|
||||
|
|
@ -203,10 +203,10 @@
|
|||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--upload-tmp-path</option></term>
|
||||
<term><option>--tmp-path</option></term>
|
||||
<listitem>
|
||||
<para>Specify a <option>directory</option> for storing the temporarily uploaded files of the instance.
|
||||
It defaults to <filename>/var/lib/koha/instance/uploads_tmp</filename>.</para>
|
||||
<para>Specify a <option>directory</option> for storing the temporary files. For example temporarily
|
||||
uploaded files of the instance. It defaults to <filename>/var/lib/koha/instance/tmp</filename>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ Options:
|
|||
--timezone time/zone Specify a timezone. e.g. America/Argentina
|
||||
--upload-path dir Set a user defined upload_path. It defaults to
|
||||
/var/lib/koha/<instance>/uploads
|
||||
--upload-tmp-path dir Set a user defined upload_tmp_path. It defaults to
|
||||
/var/lib/koha/<instance>/uploads_tmp
|
||||
--tmp-path dir Set a user defined tmp_path. It defaults to
|
||||
/var/lib/koha/<instance>/tmp
|
||||
--letsencrypt Set up a https-only site with letsencrypt certificates
|
||||
--help,-h Show this help.
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ generate_config_file() {
|
|||
-e "s#__TEMPLATE_CACHE_DIR__#$TEMPLATE_CACHE_DIR#g" \
|
||||
-e "s#__TIMEZONE__#$TIMEZONE#g" \
|
||||
-e "s#__UPLOAD_PATH__#$UPLOAD_PATH#g" \
|
||||
-e "s#__UPLOAD_TMP_PATH__#$UPLOAD_TMP_PATH#g" \
|
||||
-e "s#__TMP_PATH__#$TMP_PATH#g" \
|
||||
-e "s/__LOG_DIR__/\/var\/log\/koha\/$name/g" \
|
||||
-e "s/__PLUGINS_DIR__/\/var\/lib\/koha\/$name\/plugins/g" \
|
||||
-e "s/__MEMCACHED_NAMESPACE__/$MEMCACHED_NAMESPACE/g" \
|
||||
|
|
@ -328,18 +328,18 @@ set_upload_path()
|
|||
if [ "$CLO_UPLOAD_PATH" != "" ]; then
|
||||
UPLOAD_PATH=$CLO_UPLOAD_PATH
|
||||
else
|
||||
UPLOAD_PATH="$UPLOAD_PATH_BASE/$instance/$UPLOAD_DIR"
|
||||
UPLOAD_PATH="$INSTANCE_PATH_BASE/$instance/$UPLOAD_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
set_upload_tmp_path()
|
||||
set_tmp_path()
|
||||
{
|
||||
local instance="$1"
|
||||
|
||||
if [ "$CLO_UPLOAD_TMP_PATH" != "" ]; then
|
||||
UPLOAD_TMP_PATH=$CLO_UPLOAD_TMP_PATH
|
||||
if [ "$CLO_TMP_PATH" != "" ]; then
|
||||
TMP_PATH=$CLO_TMP_PATH
|
||||
else
|
||||
UPLOAD_TMP_PATH="$UPLOAD_PATH_BASE/$instance/$UPLOAD_TMP_DIR"
|
||||
TMP_PATH="$INSTANCE_PATH_BASE/$instance/$TMP_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -425,15 +425,15 @@ MEMCACHED_PREFIX=""
|
|||
# hardcoded memcached defaults
|
||||
DEFAULT_MEMCACHED_SERVERS="127.0.0.1:11211"
|
||||
DEFAULT_MEMCACHED_PREFIX="koha_"
|
||||
# hardcoded upload_path
|
||||
UPLOAD_PATH_BASE="/var/lib/koha"
|
||||
# hardcoded instance base path
|
||||
INSTANCE_PATH_BASE="/var/lib/koha"
|
||||
UPLOAD_DIR="uploads"
|
||||
UPLOAD_PATH=""
|
||||
# timezone defaults to empty
|
||||
TIMEZONE=""
|
||||
# hardcoded upload_tmp_path
|
||||
UPLOAD_TMP_DIR="uploads_tmp"
|
||||
UPLOAD_TMP_PATH=""
|
||||
TMP_DIR="tmp"
|
||||
TMP_PATH=""
|
||||
# cache base dir
|
||||
CACHE_DIR_BASE="/var/cache/koha"
|
||||
# Generate a randomizaed API secret
|
||||
|
|
@ -464,7 +464,7 @@ fi
|
|||
|
||||
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" )
|
||||
|
||||
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,upload-tmp-path:,letsencrypt, \
|
||||
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,dbhost:,database:,adminuser:,memcached-servers:,memcached-prefix:,template-cache-dir:,timezone:,upload-path:,tmp-path:,letsencrypt, \
|
||||
-n "$0" -- "$@"`
|
||||
|
||||
# Note the quotes around `$TEMP': they are essential!
|
||||
|
|
@ -480,7 +480,7 @@ CLO_AUTHORITIES_INDEXING_MODE=""
|
|||
CLO_MEMCACHED_SERVERS=""
|
||||
CLO_MEMCACHED_PREFIX=""
|
||||
CLO_UPLOAD_PATH=""
|
||||
CLO_UPLOAD_TMP_PATH=""
|
||||
CLO_TMP_PATH=""
|
||||
CLO_LETSENCRYPT=""
|
||||
CLO_TEMPLATE_CACHE_DIR=""
|
||||
CLO_TIMEZONE=""
|
||||
|
|
@ -529,8 +529,8 @@ while true ; do
|
|||
CLO_TIMEZONE="$2" ; shift 2 ;;
|
||||
--upload-path)
|
||||
CLO_UPLOAD_PATH="$2" ; shift 2 ;;
|
||||
--upload-tmp-path)
|
||||
CLO_UPLOAD_TMP_PATH="$2" ; shift 2 ;;
|
||||
--tmp-path)
|
||||
CLO_TMP_PATH="$2" ; shift 2 ;;
|
||||
--letsencrypt)
|
||||
CLO_LETSENCRYPT="yes" ; shift ;;
|
||||
-h|--help)
|
||||
|
|
@ -600,7 +600,7 @@ set_authorities_indexing_mode $AUTHORITIES_INDEXING_MODE $ZEBRA_MARC_FORMAT
|
|||
name="$1"
|
||||
|
||||
set_upload_path $name
|
||||
set_upload_tmp_path $name
|
||||
set_tmp_path $name
|
||||
|
||||
if [ "$op" = use ] && [ "$CLO_DATABASE" = "" ] &&
|
||||
( [ ! -f "$PASSWDFILE" ] || [ ! `cat $PASSWDFILE | grep "^$name:"` ] )
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ do
|
|||
userdir "$name" "/var/lib/koha/$name/biblios/tmp"
|
||||
userdir "$name" "/var/lib/koha/$name/plugins"
|
||||
userdir "$name" "/var/lib/koha/$name/uploads"
|
||||
userdir "$name" "/var/lib/koha/$name/uploads_tmp"
|
||||
userdir "$name" "/var/lib/koha/$name/tmp"
|
||||
userdir "$name" "/var/lib/koha/$name/tmp/uploads"
|
||||
userdir "$name" "/var/lock/koha/$name"
|
||||
userdir "$name" "/var/lock/koha/$name/authorities"
|
||||
userdir "$name" "/var/lock/koha/$name/biblios"
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ __END_SRU_PUBLICSERVER__
|
|||
<pluginsdir>__PLUGINS_DIR__</pluginsdir> <!-- This entry can be repeated to use multiple directories -->
|
||||
<enable_plugins>0</enable_plugins>
|
||||
<upload_path>__UPLOAD_PATH__</upload_path>
|
||||
<upload_tmp_path>__UPLOAD_TMP_PATH__</upload_tmp_path>
|
||||
<tmp_path>__TMP_PATH__</tmp_path>
|
||||
<intranetdir>/usr/share/koha/intranet/cgi-bin</intranetdir>
|
||||
<opacdir>/usr/share/koha/opac/cgi-bin/opac</opacdir>
|
||||
<opachtdocs>/usr/share/koha/opac/htdocs/opac-tmpl</opachtdocs>
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ __PAZPAR2_TOGGLE_XML_POST__
|
|||
<pluginsdir>__PLUGINS_DIR__</pluginsdir> <!-- This entry can be repeated to use multiple directories -->
|
||||
<enable_plugins>0</enable_plugins>
|
||||
<upload_path></upload_path>
|
||||
<upload_tmp_path></upload_tmp_path>
|
||||
<tmp_path></tmp_path>
|
||||
<intranetdir>__INTRANET_CGI_DIR__</intranetdir>
|
||||
<opacdir>__OPAC_CGI_DIR__/opac</opacdir>
|
||||
<opachtdocs>__OPAC_TMPL_DIR__</opachtdocs>
|
||||
|
|
|
|||
|
|
@ -414,12 +414,12 @@
|
|||
Also note that you need to properly set the OPACBaseURL preference for the file upload plugin to work.
|
||||
</td>
|
||||
</tr>
|
||||
[% ELSIF config_entry.error == 'uploadtmppath_entry_missing' %]
|
||||
[% ELSIF config_entry.error == 'tmp_path_entry_missing' %]
|
||||
<tr>
|
||||
<th scope="row"><b>Warning</b></th>
|
||||
<td>You are missing the <upload_tmp_path> entry in your koha-conf.xml file. Please
|
||||
add it, pointing to the configured temporary file upload directory for your Koha instance.
|
||||
The effective temporary file upload directory is '[% config_entry.effective_upload_tmp_dir %]'
|
||||
<td>You are missing the <tmp_path> entry in your koha-conf.xml file. Please
|
||||
add it, pointing to the configured temporary directory for your Koha instance.
|
||||
The effective temporary directory is '[% config_entry.effective_tmp_dir %]'.
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue