Skip to content

Commit 73c1f42

Browse files
author
Trevor Welsby
committed
Update to Ubuntu 16.04/Php7.0 and add af_newspapers and mercury_alltext plugins
1 parent 32e8a2b commit 73c1f42

File tree

4 files changed

+90
-13
lines changed

4 files changed

+90
-13
lines changed

Dockerfile

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM ubuntu:14.04
1+
FROM ubuntu:16.04
22
MAINTAINER Christian Lück <[email protected]>
33

4-
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
5-
git nginx supervisor php5-fpm php5-cli php5-curl php5-gd php5-json \
6-
php5-pgsql php5-ldap php5-mysql php5-mcrypt && apt-get clean && rm -rf /var/lib/apt/lists/*
4+
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y php7.0-mbstring \
5+
git nginx supervisor php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-json php-gettext php7.0-intl \
6+
php7.0-pgsql php7.0-ldap php7.0-mysql php7.0-mcrypt && apt-get clean && rm -rf /var/lib/apt/lists/*
77

88
# enable the mcrypt module
9-
RUN php5enmod mcrypt
9+
RUN phpenmod mcrypt
1010

1111
# add ttrss as the only nginx site
1212
ADD ttrss.nginx.conf /etc/nginx/sites-available/ttrss
@@ -20,10 +20,15 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl --n
2020
&& apt-get purge -y --auto-remove curl \
2121
&& chown www-data:www-data -R /var/www
2222

23-
RUN git clone https://github.com/hydrian/TTRSS-Auth-LDAP.git /TTRSS-Auth-LDAP && \
24-
cp -r /TTRSS-Auth-LDAP/plugins/auth_ldap plugins/ && \
25-
ls -la /var/www/plugins
26-
RUN cp config.php-dist config.php
23+
ADD af_newspapers /var/www/plugins/af_newspapers
24+
25+
RUN git clone https://github.com/hydrian/TTRSS-Auth-LDAP.git /TTRSS-Auth-LDAP \
26+
&& cp -r /TTRSS-Auth-LDAP/plugins/auth_ldap plugins/ \
27+
&& git clone https://github.com/HenryQW/mercury_fulltext.git /var/www/plugins/mercury_fulltext \
28+
&& ls -la /var/www/plugins
29+
30+
RUN cp config.php-dist config.php \
31+
&& mkdir -p /var/run/php
2732

2833
# expose only nginx HTTP port
2934
EXPOSE 80

af_newspapers/init.php

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/*
3+
* af_newspapers/init.php
4+
* Plugin for TT-RSS 1.7.9
5+
*
6+
* Retrieves full article text for feeds from Movable Type Enterprise sites (commonly
7+
* used by newspapers).
8+
*
9+
* CHANGELOG:
10+
* Version 1.2 by craywolf 2013-04-19 @ 14:00 GMT
11+
* - Added api_version() call
12+
* - Removed cruft
13+
* Version 1.1 by craywolf 2013-04-17 @ 15:22 GMT
14+
* - Added fix for removal of $this->link in 1.7.9
15+
* - Added "more info" link to about()
16+
* Version 1.0 by craywolf 2013-03-26 @ 16:17 GMT
17+
* - Initial release
18+
*/
19+
class Af_newspapers extends Plugin {
20+
private $host;
21+
22+
function about() {
23+
return array(1.2,
24+
"Turn newspaper feeds using Movable Type Enterprise (index.ssf in story link) into full-story feeds",
25+
"craywolf",
26+
"",
27+
"http://tt-rss.org/forum/viewtopic.php?f=22&t=1539");
28+
}
29+
30+
function api_version() {
31+
return 2;
32+
}
33+
34+
function init($host) {
35+
$this->host = $host;
36+
37+
$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
38+
}
39+
40+
function hook_article_filter($article) {
41+
$owner_uid = $article["owner_uid"];
42+
43+
if (strpos($article["link"], "/index.ssf/") !== FALSE) {
44+
if (strpos($article["plugin_data"], "newspapers-full,$owner_uid:") === FALSE) {
45+
46+
$doc = new DOMDocument();
47+
@$doc->loadHTML(fetch_file_contents($article["link"]));
48+
49+
$basenode = false;
50+
51+
if ($doc) {
52+
$xpath = new DOMXPath($doc);
53+
54+
$entries = $xpath->query('(//div[@class="entry-content"])');
55+
foreach ($entries as $entry) {
56+
$basenode = $entry;
57+
}
58+
59+
if ($basenode) {
60+
$article["content"] = $doc->saveXML($basenode); //, LIBXML_NOEMPTYTAG);
61+
$article["plugin_data"] = "newspapers-full,$owner_uid:" . $article["plugin_data"];
62+
}
63+
}
64+
} else if (isset($article["stored"]["content"])) {
65+
$article["content"] = $article["stored"]["content"];
66+
}
67+
}
68+
69+
return $article;
70+
}
71+
}
72+
?>

supervisord.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[supervisord]
22
nodaemon=true
33

4-
[program:php5-fpm]
5-
command=/usr/sbin/php5-fpm --nodaemonize
4+
[program:php-fpm7.0]
5+
command=/usr/sbin/php-fpm7.0 --nodaemonize
66

77
[program:nginx]
88
command=/usr/sbin/nginx -g "daemon off;"

ttrss.nginx.conf

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ server {
1010

1111
location ~ \.php$ {
1212
fastcgi_split_path_info ^(.+\.php)(/.+)$;
13-
fastcgi_pass unix:/var/run/php5-fpm.sock;
13+
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
1414
fastcgi_index index.php;
15-
include fastcgi_params;
15+
include fastcgi.conf;
1616
}
1717
}

0 commit comments

Comments
 (0)