summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--mysqlnd_qc.ini75
-rw-r--r--php-pecl-mysqlnd-qc.spec236
3 files changed, 315 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1e65467
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../common/Makefile
+
diff --git a/mysqlnd_qc.ini b/mysqlnd_qc.ini
new file mode 100644
index 0000000..dddeade
--- /dev/null
+++ b/mysqlnd_qc.ini
@@ -0,0 +1,75 @@
+; Enable mysqlnd_qc extension module
+extension=mysqlnd_qc.so
+
+; Configuration documentation
+http://www.php.net/manual/en/mysqlnd-qc.configuration.php
+
+
+; Enables or disables the plugin. If disabled the extension will not
+; plug into mysqlnd to proxy internal mysqlnd C API calls.
+;mysqlnd_qc.enable_qc = 1
+
+; Default Time-to-Live (TTL) for cache entries in seconds.
+;mysqlnd_qc.ttl = 30
+
+; Cache all queries regardless if they begin with the SQL hint that enables
+; caching of a query or not. Storage handler cannot overrule the setting.
+; It is evaluated by the core of the plugin.
+;mysqlnd_qc.cache_by_default = 0
+
+; Cache queries with no table name in any of columns meta data of their
+; result set, e.g. SELECT SLEEP(1)?
+;mysqlnd_qc.cache_no_table = 0
+
+; Use PHP global request time to avoid gettimeofday() system calls? If using APC
+; storage handler it should be set to the value of apc.use_request_time,
+; if not warnings will be generated.
+;mysqlnd_qc.use_request_time = 0
+
+; Collect run time and store time statistics using gettimeofday() system call?
+; Data will be collected only if you also set mysqlnd_qc.collect_statistics = 1,
+;mysqlnd_qc.time_statistics = 1
+
+; Collect statistics for mysqlnd_qc_get_core_stats()? Does not influence storage handler
+; statistics! Handler statistics can be an integral part of the handler internal
+; storage format. Thereofore, collection of some handler statistics cannot be disabled.
+;mysqlnd_qc.collect_statistics = 0
+
+; If mysqlnd_qc.collect_statistics and mysqlnd_qc.collect_statistics_log_file are set,
+; the plugin will dump statistics into the specified log file at every 10th web request
+; during PHP request shutdown. The log file needs to be writeable by the web server user.
+;mysqlnd_qc.collect_statistics-log-file = "/tmp/mysqlnd_qc.stats"
+
+; Collect query back traces?
+;mysqlnd_qc.collect_query_trace = 0
+
+; Maximum depth/level of a query code backtrace.
+;mysqlnd_qc.query_trace_bt_depth = 3
+
+; Whether to remove SQL comments from a query string before hashing it to generate a cache key.
+; Disable if you do not want two statemts such as SELECT /*my_source_ip=123*/ id FROM test;
+; and SELECT /*my_source_ip=456*/ id FROM test to refer to the same cache entry.
+;mysqlnd_qc.ignore_sql_comments = 1
+
+; Activates handler based slam defense if available.
+;mysqlnd_qc.slam_defense = 0
+
+; TTL for stale cache entries which are served while another client updates the entries.
+; Supported by APC storage handler.
+;mysqlnd_qc.slam_defense_ttl = 30
+
+; Collect aggregated normalized query traces? The setting has no effect by default.
+; You compile the extension using the define NORM_QUERY_TRACE_LOG to make use of the setting.
+;mysqlnd_qc.collect_normalized_query_trace = 0
+
+; Default storage handler: copy cached wire data? EXPERIMENTAL – use default setting!
+;mysqlnd_qc.std_data_copy = 0
+
+; MEMCACHE storage handler: memcache server host.
+;mysqlnd_qc.memc_server = "127.0.0.1"
+
+; MEMCACHE storage handler: memcached server port.
+;mysqlnd_qc.memc_port = 11211
+
+; sqlite storage handler: data file. Any setting but :memory: may be of little practical value.
+;mysqlnd_qc.sqlite_data_file = ":memory:"
diff --git a/php-pecl-mysqlnd-qc.spec b/php-pecl-mysqlnd-qc.spec
new file mode 100644
index 0000000..5f9eace
--- /dev/null
+++ b/php-pecl-mysqlnd-qc.spec
@@ -0,0 +1,236 @@
+%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+
+%global pecl_name mysqlnd_qc
+%global prever alpha
+
+%if 0%{?fedora} >= 9 || 0%{?rhel} >= 6
+%global withsqlite 1
+%else
+%global withsqlite 0
+%endif
+
+Summary: A query cache plugin for mysqlnd
+Name: php-pecl-mysqlnd-qc
+Version: 1.1.1
+Release: 2%{?dist}
+Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+License: PHP
+Group: Development/Languages
+URL: http://pecl.php.net/package/mysqlnd_qc
+
+
+# From http://www.php.net/manual/en/mysqlnd-qc.configuration.php
+Source1: mysqlnd_qc.ini
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: php-devel >= 5.3.4
+BuildRequires: php-mysqlnd
+BuildRequires: php-pear
+BuildRequires: libmemcached-devel >= 0.38
+%if %{withsqlite}
+BuildRequires: sqlite-devel >= 3.5.9
+%endif
+
+Requires(post): %{__pecl}
+Requires(postun): %{__pecl}
+
+Requires: php-mysqlnd%{?_isa}
+Requires: php-sqlite3%{?_isa}
+Requires: php(zend-abi) = %{php_zend_api}
+Requires: php(api) = %{php_core_api}
+
+Provides: php-pecl(%{pecl_name}) = %{version}-%{release}
+Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}-%{release}
+
+# RPM 4.8
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+# RPM 4.9
+%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{_libdir}/.*\\.so$
+
+
+%description
+The mysqlnd query result cache plugin is a mysqlnd plugin.
+It adds basic client side result set caching to all PHP MySQL extensions
+(ext/mysql, ext/mysqli, PDO_MySQL). if they are compiled to use mysqlnd.
+It does not change the API of the MySQL extensions and thus it operates
+virtually transparent for applications.
+
+Documentation : http://www.php.net/mysqlnd_qc
+
+%package devel
+Summary: Mysqlnd_qc developer files (header)
+Group: Development/Libraries
+Requires: php-pecl-mysqlnd-qc%{?_isa} = %{version}-%{release}
+Requires: php-devel
+
+%description devel
+These are the files needed to compile programs using mysqlnd_qc extension.
+
+
+%prep
+%setup -c -q
+
+# Fix version
+sed -i -e '/MYSQLND_QC_VERSION_STR/s/1.1.0/1.1.1/' %{pecl_name}-*/php_mysqlnd_qc.h
+
+# Check version (often broken)
+extver=$(sed -n '/#define MYSQLND_QC_VERSION_STR/{s/.* "//;s/".*$//;p}' %{pecl_name}-*/php_mysqlnd_qc.h)
+if test "x${extver}" != "x%{version}%{?prever:-}%{?prever}"; then
+ : Error: Upstream %{pecl_name} version is now ${extver}, expecting %{version}%{?prever}.
+ : Update the pdover macro and rebuild.
+ exit 1
+fi
+
+cp %{SOURCE1} %{pecl_name}.ini
+
+cp -r %{pecl_name}-%{version} %{pecl_name}-zts
+
+
+%build
+cd %{pecl_name}-%{version}
+
+%{_bindir}/phpize
+
+# don't use --enable-mysqlnd-qc-apc because:
+# APC is onlysupported if both APC and MySQL Query Cache are compiled statically
+%configure \
+ --with-libdir=%{_lib} \
+ --enable-mysqlnd-qc \
+ --enable-mysqlnd-qc-memcache \
+%if %{withsqlite}
+ --enable-mysqlnd-qc-sqlite \
+ --with-sqlite-dir=%{_prefix} \
+%endif
+ --with-php-config=%{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if 0%{?__ztsphp:1}
+cd ../%{pecl_name}-zts
+%{_bindir}/zts-phpize
+%configure \
+ --with-libdir=%{_lib} \
+ --enable-mysqlnd-qc \
+ --enable-mysqlnd-qc-memcache \
+%if %{withsqlite}
+ --enable-mysqlnd-qc-sqlite \
+ --with-sqlite-dir=%{_prefix} \
+%endif
+ --with-php-config=%{_bindir}/zts-php-config
+make %{?_smp_mflags}
+%endif
+
+
+%install
+rm -rf %{buildroot}
+# for short-circuit
+rm -f %{pecl_name}-*/modules/{sqlite3,mysqlnd}.so
+
+make install -C %{pecl_name}-%{version} INSTALL_ROOT=%{buildroot}
+
+%if 0%{?__ztsphp:1}
+make install -C %{pecl_name}-zts INSTALL_ROOT=%{buildroot}
+
+# Drop in the bit of configuration
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
+%endif
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{_sysconfdir}/php.d/%{pecl_name}.ini
+
+# Install XML package description
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%post
+%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+
+
+%postun
+if [ $1 -eq 0 ] ; then
+ %{pecl_uninstall} %{pecl_name} >/dev/null || :
+fi
+
+
+%check
+cd %{pecl_name}-%{version}
+ln -s %{php_extdir}/mysqlnd.so modules/
+%if %{withsqlite}
+ln -s %{php_extdir}/sqlite3.so modules/
+%endif
+
+# only check if build extension can be loaded
+php -n -q \
+ -d extension_dir=modules \
+ -d extension=mysqlnd.so \
+%if %{withsqlite}
+ -d extension=sqlite3.so \
+%endif
+ -d extension=%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+
+%if 0%{?__ztsphp:1}
+cd ../%{pecl_name}-zts
+ln -s %{php_ztsextdir}/mysqlnd.so modules/
+%if %{withsqlite}
+ln -s %{php_ztsextdir}/sqlite3.so modules/
+%endif
+
+# only check if build extension can be loaded
+zts-php -n -q \
+ -d extension_dir=modules \
+ -d extension=mysqlnd.so \
+%if %{withsqlite}
+ -d extension=sqlite3.so \
+%endif
+ -d extension=%{pecl_name}.so \
+ --modules | grep %{pecl_name}
+%endif
+
+
+%files
+%defattr(-, root, root, -)
+%doc %{pecl_name}-%{version}/{CHANGES,CREDITS,LICENSE,README}
+%doc %{pecl_name}-%{version}/web
+%config(noreplace) %{_sysconfdir}/php.d/%{pecl_name}.ini
+%{php_extdir}/%{pecl_name}.so
+%{pecl_xmldir}/%{name}.xml
+
+%if 0%{?__ztsphp:1}
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/php/ext/%{pecl_name}
+
+%if 0%{?__ztsphp:1}
+%{php_ztsincldir}/ext/%{pecl_name}
+%endif
+
+
+%changelog
+* Mon Apr 30 2012 Remi Collet <remi@fedoraproject.org> - 1.1.1-2
+- rebuild for EL and PHP 5.4
+
+* Mon Apr 30 2012 Remi Collet <remi@fedoraproject.org> - 1.1.1-1
+- update to 1.1.1-alpha
+- add devel sub-package
+- update configuration file provided
+ add collect_statistics-log-file and ignore_sql_comments
+ remove apc_prefix (not supported in this build)
+
+* Mon Jan 30 2012 Remi Collet <remi@fedoraproject.org> - 1.1.0-0.1.svn322926
+- new snapshot, update to 1.1.0-alpha
+
+* Mon Nov 21 2011 Remi Collet <remi@fedoraproject.org> - 1.0.1-3.svn322926
+- fix from svn, build against php 5.4
+
+* Sun Sep 18 2011 Remi Collet <remi@fedoraproject.org> - 1.0.1-2
+- build zts extension
+
+* Sun Sep 18 2011 Remi Collet <remi@fedoraproject.org> - 1.0.1-1
+- Initial RPM