Bugzilla – Attachment 41557 Details for
Bug 14321
Merge UploadedFile and UploadedFiles into Koha::Upload
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14321: Add public column to uploaded_files
Bug-14321-Add-public-column-to-uploadedfiles.patch (text/plain), 3.17 KB, created by
Marcel de Rooy
on 2015-08-17 13:18:35 UTC
(
hide
)
Description:
Bug 14321: Add public column to uploaded_files
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-08-17 13:18:35 UTC
Size:
3.17 KB
patch
obsolete
>From 60e35d22736de33f0ef9cb9c12b20035b1e60808 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 6 Aug 2015 15:34:57 +0200 >Subject: [PATCH] Bug 14321: Add public column to uploaded_files >Content-Type: text/plain; charset=utf-8 > >This patch adds uploaded_files.public. This column will be used to >mark uploaded files as available via opac-retrieve. >The db rev sets this flag for current records having a category (as >uploaded via the BZ 6874 plugin: so public). >A followup patch will adjust the plugin to use Koha::Upload. > >Test plan: >[1] Run the dbrev. >[2] Add a record (upload a file) via stage-marc-import. >[3] Check that public is null in the new record. (This is a temporary file > without category.) >--- > Koha/Upload.pm | 5 ++++- > installer/data/mysql/atomicupdate/14321a_public.sql | 2 ++ > installer/data/mysql/kohastructure.sql | 1 + > 3 files changed, 7 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/14321a_public.sql > >diff --git a/Koha/Upload.pm b/Koha/Upload.pm >index 5b1ca8b..d382699 100644 >--- a/Koha/Upload.pm >+++ b/Koha/Upload.pm >@@ -169,6 +169,7 @@ sub _init { > } > $self->{files} = {}; > $self->{uid} = C4::Context->userenv->{number} if C4::Context->userenv; >+ $self->{public} = $params->{public}? 1: undef; > } > > sub _fh { >@@ -251,13 +252,14 @@ sub _register { > my ( $self, $filename, $size ) = @_; > my $dbh= C4::Context->dbh; > my $sql= "INSERT INTO uploaded_files (hashvalue, filename, dir, filesize, >- owner, categorycode) VALUES (?,?,?,?,?,?)"; >+ owner, categorycode, public) VALUES (?,?,?,?,?,?,?)"; > my @pars= ( $self->{files}->{$filename}->{hash}, > $filename, > $self->{temporary}? KOHA_UPLOAD: $self->{category}, > $size, > $self->{uid}, > $self->{category}, >+ $self->{category}? $self->{public}: undef, > ); > $dbh->do( $sql, undef, @pars ); > my $i = $dbh->last_insert_id(undef, undef, 'uploaded_files', undef); >@@ -274,6 +276,7 @@ sub _lookup { > } else { > $sql.= "WHERE hashvalue=?"; > } >+ $sql.= $self->{public}? " AND public=1": ''; > my $temp= $dbh->selectall_arrayref( $sql, { Slice => {} }, > ( $params->{id} // $params->{hashvalue} // 0 ) ); > return $temp; >diff --git a/installer/data/mysql/atomicupdate/14321a_public.sql b/installer/data/mysql/atomicupdate/14321a_public.sql >new file mode 100644 >index 0000000..ba3e816 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/14321a_public.sql >@@ -0,0 +1,2 @@ >+ALTER TABLE uploaded_files ADD COLUMN public tinyint; >+UPDATE uploaded_files SET public=1 WHERE categorycode IS NOT NULL; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 13b6a6a..aca8aec 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3374,6 +3374,7 @@ CREATE TABLE uploaded_files ( > dtcreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > categorycode tinytext, > owner int(11), >+ public tinyint, > PRIMARY KEY (id) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14321
:
41498
|
41499
|
41500
|
41501
|
41555
|
41556
|
41557
|
41558
|
41559
|
41560
|
41561
|
41562
|
41665
|
41666
|
41667
|
41668
|
41669
|
41677
|
41873
|
41874
|
41875
|
41876
|
41877
|
41878
|
41879
|
41880
|
41881
|
42411
|
42412
|
42413
|
42414
|
42558
|
42559
|
42560
|
42561
|
42584
|
42587
|
42588
|
42589
|
42590
|
42591
|
42660
|
42661
|
42662
|
42663
|
42664
|
42665
|
42666
|
42707
|
42726
|
42727
|
42728
|
42729
|
42730
|
42731
|
42732
|
42889
|
42890