2 %define php_min_version 5.0.0
3 %include /usr/lib/rpm/macros.php
4 Summary: DokuWiki Structured Data Plugin
5 Name: dokuwiki-plugin-%{plugin}
9 Group: Applications/WWW
10 #Source0: http://github.com/splitbrain/dokuwiki-plugin-%{plugin}/tarball/master#/%{plugin}-%{version}.tgz
11 Source0: https://github.com/Klap-in/dokuwiki-plugin-data/tarball/pdo#/%{plugin}-pdo-%{version}.tgz
12 # Source0-md5: 49cfa6206cdf138593905d3622cb1a4a
13 URL: http://wiki.splitbrain.org/plugin:data
14 Patch2: separator-style.patch
15 Patch3: separate-rpmdb.patch
16 Patch4: cache-enable.patch
17 BuildRequires: rpm-php-pearprov
18 BuildRequires: rpmbuild(macros) >= 1.520
19 Requires: php(core) >= %{php_min_version}
20 Requires(triggerun): sqlite
21 Requires(triggerun): sqlite3
22 Requires: dokuwiki >= 20090214b-5
23 Requires: dokuwiki-plugin-sqlite >= 20120619
26 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28 %define dokuconf /etc/webapps/dokuwiki
29 %define dokudir /usr/share/dokuwiki
30 %define metadir /var/lib/dokuwiki/meta
31 %define plugindir %{dokudir}/lib/plugins/%{plugin}
32 %define find_lang %{_usrlibrpm}/dokuwiki-find-lang.sh %{buildroot}
35 %define _noautopear pear
37 # sqlite is dokuwiki-plugin-sqlite dep, not ours
38 %define _noautophp php-sqlite
40 # put it together for rpmbuild
41 %define _noautoreq %{?_noautophp} %{?_noautopear}
44 This plugin allows you to add structured data to any DokuWiki page.
45 Think about this data as additional named attributes. Those attributes
46 can then be queried and aggregated. The plugin is similar to what was
47 done here for the repository plugin but its internals are very
48 different to the repository plugin.
57 version=$(awk '/date/{print $2}' plugin.info.txt)
58 if [ $(echo "$version" | tr -d -) != %{version} ]; then
59 : %%{version} mismatch
63 # nothing to do with tests
66 # cleanup backups after patching
67 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
70 rm -rf $RPM_BUILD_ROOT
71 install -d $RPM_BUILD_ROOT{%{plugindir},%{metadir}}
72 cp -a . $RPM_BUILD_ROOT%{plugindir}
73 %{__rm} $RPM_BUILD_ROOT%{plugindir}/README
75 touch $RPM_BUILD_ROOT%{metadir}/data.sqlite
76 # sqlite3: php-pdo-sqlite
77 touch $RPM_BUILD_ROOT%{metadir}/data.sqlite3
80 %find_lang %{name}.lang
83 rm -rf $RPM_BUILD_ROOT
86 # force css cache refresh
87 if [ -f %{dokuconf}/local.php ]; then
88 touch %{dokuconf}/local.php
91 %triggerun -- %{name} < 20100322-0.5
92 # move to new location
93 mv /var/lib/dokuwiki/cache/dataplugin.sqlite %{metadir}/data.sqlite
95 # perform new indexes add manually
96 sqlite %{metadir}/data.sqlite <<'EOF'
97 CREATE TABLE opts (opt,val);
98 CREATE UNIQUE INDEX idx_opt ON opts(opt);
99 INSERT INTO opts VALUES ('dbversion', 1);
101 chown root:http %{metadir}/data.sqlite
102 chmod 660 %{metadir}/data.sqlite
104 %triggerun -- %{name} < 20120716-3
105 if [ -f %{metadir}/data.sqlite3 ]; then
109 # perform sqlite2 -> sqlite3 migration of both tools present
110 if [ ! -x /usr/bin/sqlite ] || [ ! -x /usr/bin/sqlite3 ]; then
111 echo >&2 "data plugin: To migrate db from sqlite2 to sqlite3 you need to install 'sqlite' and 'sqlite3' packages"
115 sqlite %{metadir}/data.sqlite .dump > %{metadir}/data.dump
116 sqlite3 %{metadir}/data.dump.new < %{metadir}/data.dump
117 mv %{metadir}/data.sqlite3{.new,}
118 chown root:http %{metadir}/data.sqlite3
119 chmod 660 %{metadir}/data.sqlite3
121 %files -f %{name}.lang
122 %defattr(644,root,root,755)
133 %attr(660,http,http) %ghost %{metadir}/data.sqlite
134 %attr(660,http,http) %ghost %{metadir}/data.sqlite3