1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00

Merge pull request #30 from YunoHost-Apps/feature/use-cli-interface

Feature/use cli interface
This commit is contained in:
Clément 2017-03-15 22:14:49 +01:00 committed by GitHub
commit 9c59e7e791
16 changed files with 208 additions and 285 deletions

View file

@ -4,6 +4,9 @@
* [YunoHost website](https://yunohost.org)
Changelog:
* Update to FreshRSS 1.6.3
* Complete package refactoring
* Update to FreshRSS 1.6.2
* Update to FreshRSS 1.5
* Refactoring of yunohost scripts
* Update to FreshRSS 1.4

34
check_process Normal file
View file

@ -0,0 +1,34 @@
;; Test complet
auto_remove=1
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="homer" (USER)
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=0
setup_public=0
upgrade=1
backup_restore=1
multi_instance=1
wrong_user=1
wrong_path=1
incorrect_path=1
corrupt_source=0
fail_download_source=0
port_already_use=0
final_path_already_use=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
Level 4=1
Level 5=1
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0

View file

@ -1,23 +0,0 @@
<?php
return array (
'environment' => 'production',
'salt' => 'yunosalt',
'title' => 'FreshRSS',
'default_user' => 'yunoadminuser',
'auth_type' => 'http_auth',
'db' =>
array (
'type' => 'mysql',
'host' => 'localhost',
'user' => 'yunouser',
'password' => 'yunopass',
'base' => 'yunobase',
'prefix' => false,
),
'allow_anonymous' => false,
'allow_anonymous_refresh' => false,
'unsafe_autologin_enabled' => false,
'api_enabled' => true,
'extensions_enabled' => array(),
);

View file

@ -0,0 +1,13 @@
Section: misc
Priority: optional
Homepage: https://github.com/FreshRSS/FreshRSS
Standards-Version: 3.9.2
Package: freshrss-deps
Version: 1.6.3
Depends: php5-cli, php5-gmp
Architecture: all
Description: meta package for freshrss dependencies
FreshRSS is a self-hosted RSS feed aggregator such as Leed or Kriss Feed.
.
This meta-package is only responsible of installing its dependencies.

1
conf/freshrss.cron Normal file
View file

@ -0,0 +1 @@
*/10 * * * * www-data /usr/bin/php #DESTDIR#/app/actualize_script.php >/tmp/FreshRSS.log 2>&1

View file

@ -1,51 +1,19 @@
#!/bin/bash
app=$1
app=$YNH_APP_INSTANCE_NAME
new_users=$2
app_path=/var/www/freshrss
app_path=/var/www/$app
# Source app helpers
. /usr/share/yunohost/helpers
if [[ "freshrss" = "$app" ]];
then
db_user=freshrss
db_name=freshrss
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
#check wallabag
if [[ $(sudo yunohost app list --installed -f wallabag2) -eq 0 ]]; then
echo "Detected wallabag V2"
wallabagPath=$(sudo yunohost app setting wallabag2 path)
wallabagUrl=$domain$wallabagPath
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabag',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
sharingEnable=1
elif [[ $(sudo yunohost app list --installed -f wallabag) -eq 0 ]]; then
echo "Detected wallabag"
wallabagPath=$(sudo yunohost app setting wallabag path)
wallabagUrl=$domain$wallabagPath
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabag',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
sharingEnable=1
fi
for myuser in $(echo "$new_users" | sed "s/,/ /g")
do
#copy sql
sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
#change username in sql
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
#create tables
ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \
< "/tmp/$myuser-install.sql"
#remove temp sql
sudo rm /tmp/$myuser-install.sql
#copy default conf
sudo cp -r $app_path/data/users/_ $app_path/data/users/$myuser/
sudo mv $app_path/data/users/$myuser/config.default.php $app_path/data/users/$myuser/config.php
#add wallabag sharing
if [[ $sharingEnable -eq 1 ]]; then
sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $app_path/data/users/$myuser/config.php
fi
user_token=$(ynh_string_random)
$app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds
sudo chown -R www-data: $app_path/data/users/$myuser/
done
fi

View file

@ -1,21 +1,12 @@
#!/bin/bash
db_user=freshrss
db_name=freshrss
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
app_path=/var/www/freshrss
app=$YNH_APP_INSTANCE_NAME
app_path=/var/www/$app
myuser=$1
#copy sql
sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
#change username in sql
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
#create tables
mysql -u $db_user -p$db_pwd $db_user < /tmp/$myuser-install.sql
#remove temp sql
sudo rm /tmp/$myuser-install.sql
#copy default conf
sudo cp -r $app_path/data/users/_ $app_path/data/users/$myuser/
sudo mv $app_path/data/users/$myuser/config.default.php $app_path/data/users/$myuser/config.php
# Source app helpers
. /usr/share/yunohost/helpers
user_token=$(ynh_string_random)
sudo $app_path/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds
sudo chown -R www-data: $app_path/data/users/$myuser/

6
hooks/post_user_delete Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
app=$YNH_APP_INSTANCE_NAME
app_path=/var/www/$app
myuser=$1
$app_path/cli/delete-user.php --user $myuser

View file

@ -1,6 +1,7 @@
{
"name": "FreshRSS",
"id": "freshrss",
"packaging_format": 1,
"description": {
"en": "FreshRSS is a selfhostable RSS reader",
"fr": "FreshRSS est un agrégateur de flux RSS à auto-héberger"
@ -11,7 +12,10 @@
"name": "plopoyop",
"email": "plopoyop@gmail.com"
},
"multi_instance": "false",
"requirements": {
"yunohost": ">= 2.4.0"
},
"multi_instance": true,
"services": [
"nginx",
"php5-fpm",
@ -41,9 +45,10 @@
{
"name": "admin",
"type": "user",
"optional": false,
"ask": {
"en": "Choose the default user (leave empty if none)",
"fr": "Choisissez l'utilisateur par defaut (laissez vide si aucun)"
"en": "Choose the default user",
"fr": "Choisissez l'utilisateur par defaut"
},
"example": "homer"
}

View file

@ -1,34 +1,41 @@
#
# Common variables
#
APPNAME="freshrss"
# FreshRSS version
VERSION="1.6.3"
# FreshRss version
VERSION="1.5.0"
# FreshRSS complete tarball checksum
FRESHRSS_SOURCE_SHA256="06bcdfbde53bd8f01b8376ee28a4f1f9630c3409d5dc12f02f74f2f7aff4a6f9"
# Roundcube complete tarball checksum
FRESHRSS_SOURCE_SHA256="72c3dcb3e58f4cf7d7e6a06ffec0cad8540ee5aeee9024e785b56e8d55656746"
# Remote URL to fetch Roundcube source tarball
FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.5.0.tar.gz"
# Remote URL to fetch FreshRSS source tarball
FRESHRSS_SOURCE_URL="https://github.com/FreshRSS/FreshRSS/archive/1.6.3.tar.gz"
PKGDIR=$(cd ../; pwd)
FINAL_PATH="/var/www/freshrss"
#apt dependencies
DEPS_PKG_NAME="freshrss-deps"
#
# Common helpers
#
# Download and extract FreshRss sources to the given directory
# Download and extract FreshRSS sources to the given directory
# usage: extract_freshrss DESTDIR
extract_freshrss() {
local DESTDIR=$1
# retrieve and extract FreshRss tarball
# retrieve and extract FreshRSS tarball
rc_tarball="${DESTDIR}/freshrss.tar.gz"
wget -q -O "$rc_tarball" "$FRESHRSS_SOURCE_URL" \
|| ynh_die "Unable to download FreshRss tarball"
|| ynh_die "Unable to download FreshRSS tarball"
echo "$FRESHRSS_SOURCE_SHA256 $rc_tarball" | sha256sum -c >/dev/null \
|| ynh_die "Invalid checksum of downloaded tarball"
tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \
|| ynh_die "Unable to extract FreshRss tarball"
rm "$rc_tarball"
sudo rm "$rc_tarball"
}
install_freshrss_dependencies() {
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|| ynh_die "Unable to install dependencies"
}

View file

@ -1,25 +1,21 @@
#!/bin/bash
set -e
set -eu
# The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1
# The parameter $2 is the id of the app instance ex: strut__2
APP=$2
# Source app helpers
. /usr/share/yunohost/helpers
# retrieve useful param
domain=$(sudo yunohost app setting ${APP} domain)
db_pwd=$(sudo yunohost app setting ${APP} mysqlpwd)
app=$YNH_APP_INSTANCE_NAME
path=/var/www/$app
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
domain=$(ynh_app_setting_get "$app" domain)
# Backup app files
sudo mkdir -p "${BACKUP_DIR}/www"
sudo cp -a /var/www/${APP}/. "${BACKUP_DIR}/www"
ynh_backup "$path" "www"
# Backup conf files
sudo mkdir -p "${BACKUP_DIR}/conf"
sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.conf"
sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf"
ynh_backup "/etc/cron.d/$app" "$app.cron"
# Backup mysql
mysqldump -u ${APP} -p$db_pwd ${APP} | sudo dd of=${BACKUP_DIR}/${APP}.dmp
ynh_mysql_dump_db $app > $app.dmp

View file

@ -3,125 +3,89 @@
# Exit on command errors and treat unset variables as an error
set -eu
# Retrieve arguments
domain=$1
path=$2
admin_user=$3
# Load common variables and helpers
. ./_common.sh
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path=${YNH_APP_ARG_PATH%/}
admin_user=$YNH_APP_ARG_ADMIN
# Setup variables
app=$YNH_APP_INSTANCE_NAME
db_user=$app
db_name=$app
FINAL_PATH="/var/www/$app"
# Source app helpers
. /usr/share/yunohost/helpers
# if path do not begin with / add a / at the begining
if [ "${path:0:1}" != "/" ]; then
path="/$path"
fi
# if path do not end with / add a / at the end
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
path="${path:0:${#path}-1}"
fi
# Check user parameter if not empty
if [[ $admin_user != '' ]]; then
sudo yunohost user list --json | grep -qi "\"username\": \"$admin_user\""
if [[ ! $? -eq 0 ]]; then
echo "Wrong user"
exit 1
fi
sudo yunohost app setting freshrss admin_user -v $admin_user
ynh_user_exists $admin_user || ynh_die "Wrong user"
ynh_app_setting_set $app admin_user $admin_user
fi
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a freshrss
if [[ ! $? -eq 0 ]]; then
exit 1
fi
sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation."
#install php5-cli
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|| ynh_die "Unable to install dependencies"
# Generate random DES key & password
deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
app_salt=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{40\}\).*/\1/p')
# Use 'freshrss' as database name and user
db_user=freshrss
db_name=freshrss
deskey=$(ynh_string_random)
db_pwd=$(ynh_string_random)
app_salt=$(ynh_string_random)
# Initialize database and store mysql password for upgrade
ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd"
sudo yunohost app setting freshrss mysqlpwd -v $db_pwd
ynh_app_setting_set "$app" mysqlpwd "$db_pwd"
# Copy files to the right place
TMPDIR=$(ynh_mkdir_tmp)
TMPDIR=$(mktemp -d)
sudo chmod 755 "$TMPDIR"
extract_freshrss "$TMPDIR"
sudo cp -a ../conf/config.php $TMPDIR/data
sudo cp ../sources/install_ynh.sql $TMPDIR/app/SQL/install_ynh.sql
# Change variables in freshrss configuration
sudo sed -i "s/yunouser/$db_user/g" $TMPDIR/data/config.php
sudo sed -i "s/yunopass/$db_pwd/g" $TMPDIR/data/config.php
sudo sed -i "s/yunobase/$db_user/g" $TMPDIR/data/config.php
sudo sed -i "s/yunosalt/$app_salt/g" $TMPDIR/data/config.php
sudo sed -i "s@yunopath@$path@g" $TMPDIR/data/config.php
if [[ $admin_user != '' ]]; then
sudo sed -i "s/yunoadminuser/$admin_user/g" $TMPDIR/data/config.php
else
sudo sed -i '/yunoadminuser/d' $TMPDIR/data/config.php
fi
$TMPDIR/cli/do-install.php --default_user $admin_user --auth_type http_auth --environment production --base_url $domain/$path --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_user --db-password $db_pwd --db-base $db_name
# Add users
#check wallabag
sharingEnable=0
if sudo yunohost app list --installed -f wallabag2 | grep -q id ; then
echo "Detected wallabag V2"
wallabagPath=$(sudo yunohost app setting wallabag2 path | sed 's#/*$##')
wallabagUrl=$domain$wallabagPath
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabagv2',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
sharingEnable=1
elif sudo yunohost app list --installed -f wallabag | grep -q id ; then
echo "Detected wallabag"
wallabagPath=$(sudo yunohost app setting wallabag path)
wallabagUrl=$domain$wallabagPath
sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabag',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t),"
sharingEnable=1
fi
freshrss_users=$(ldapsearch -h localhost -b ou=users,dc=yunohost,dc=org -x objectClass=mailAccount uid | grep uid: | sed 's/uid: //' | xargs)
for myuser in $freshrss_users
for myuser in $(ynh_user_list)
do
#copy sql
sudo cp ../sources/install_ynh.sql /tmp/$myuser-install.sql
#change username in sql
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
#create tables
ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" \
< "/tmp/$myuser-install.sql"
#remove temp sql
sudo rm /tmp/$myuser-install.sql
#copy default conf
sudo cp -r $TMPDIR/data/users/_/ $TMPDIR/data/users/$myuser
sudo mv $TMPDIR/data/users/$myuser/config.default.php $TMPDIR/data/users/$myuser/config.php
if [[ $sharingEnable -eq 1 ]]; then
sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $TMPDIR/data/users/$myuser/config.php
fi
user_token=$(ynh_string_random)
$TMPDIR/cli/create-user.php --user $myuser --language en --token $user_token --no-default-feeds
done
# Delete install directive
sudo rm $TMPDIR/data/do-install.txt
# Move temp dir to final dir
sudo mv $TMPDIR $FINAL_PATH
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$FINAL_PATH/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/freshrss.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
#install php5-cli
sudo apt-get update
sudo apt-get install -y php5-cli php5-gmp
#install update cron
echo "*/10 * * * * www-data /usr/bin/php $FINAL_PATH/app/actualize_script.php >/tmp/FreshRSS.log 2>&1" > /tmp/cronfreshrss
sudo mv /tmp/cronfreshrss /etc/cron.d/freshrss
sudo chown root /etc/cron.d/freshrss
# Add cron job
cron_path="/etc/cron.d/$app"
sed -i "s@#DESTDIR#@${FINAL_PATH}@g" ../conf/freshrss.cron
sudo cp ../conf/freshrss.cron "$cron_path"
sudo chmod 644 "$cron_path"
# Set permissions to freshrss directory
sudo chown -R root:root $FINAL_PATH
sudo chown -R www-data: $FINAL_PATH/data/
sudo chown -R www-data: $FINAL_PATH/extensions/
#skip api directory
sudo yunohost app setting freshrss skipped_uris -v /api/greader.php
ynh_app_setting_set "$app" skipped_uris /api/greader.php
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf

View file

@ -1,13 +1,23 @@
#!/bin/bash
db_user=freshrss
db_name=freshrss
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting freshrss domain)
# Exit on command errors and treat unset variables as an error
set -u
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
sudo rm -rf /var/www/freshrss
sudo rm -rf /etc/cron.d/freshrss
sudo rm -f /etc/nginx/conf.d/$domain.d/freshrss.conf
# Source app helpers
. /usr/share/yunohost/helpers
sudo service nginx reload
app=$YNH_APP_INSTANCE_NAME
db_user=$app
db_name=$app
domain=$(ynh_app_setting_get $app domain)
ynh_mysql_drop_db $db_name
ynh_mysql_drop_user $db_user
sudo rm -rf /var/www/$app
sudo rm -rf /etc/cron.d/$app
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
sudo service nginx reload
sudo yunohost app ssowatconf

View file

@ -1,26 +1,27 @@
#!/bin/bash
set -e
set -eu
# The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1
app=$YNH_APP_INSTANCE_NAME
db_user=$app
db_name=$app
# The parameter $2 is the id of the app instance ex: strut__2
APP=$2
# Source app helpers
. /usr/share/yunohost/helpers
# retrieve useful param
domain=$(sudo yunohost app setting ${APP} domain)
db_pwd=$(sudo yunohost app setting ${APP} mysqlpwd)
path=$(sudo yunohost app setting ${APP} path)
domain=$(ynh_app_setting_get $app domain)
path=$(ynh_app_setting_get $app path)
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a ${APP} \
|| (echo "Path not available: $domain$path" && exit 1)
sudo yunohost app checkurl $domain$path -a $app || ynh_die "The path ${domain}${path} is not available for app installation."
db_pass=$(ynh_app_setting_get $app mysqlpwd)
# Restore sources & data
final_path=/var/www/${APP}
sudo mkdir $final_path
sudo cp -a ${BACKUP_DIR}/www/. $final_path
final_path=/var/www/$app
ynh_backup "www" "$final_path"
# Restore permissions
sudo chown -R root:root $final_path
@ -28,11 +29,12 @@ sudo chown -R www-data: $final_path/data/
sudo chown -R www-data: $final_path/extensions/
# Restore conf files
sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.conf
sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP}
ynh_backup nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
ynh_backup $app.cron /etc/cron.d/$app
# Restore mysql dump
sudo su -c "mysql -u ${APP} -p$db_pwd ${APP} < ${BACKUP_DIR}/${APP}.dmp"
ynh_mysql_create_db "$db_name" "$db_user" "$db_pass"
ynh_mysql_connect_as "$db_user" "$db_pass" "$db_name" < "$app.dmp"
# Reload Nginx, and regenerate SSOwat conf
sudo service nginx reload

View file

@ -8,36 +8,39 @@ set -eu
# Source app helpers
. /usr/share/yunohost/helpers
#old version cleanup
if [ -f $FINAL_PATH/data/user.php.dist ]; then
sudo rm $FINAL_PATH/data/user.php.dist
fi
app=$YNH_APP_INSTANCE_NAME
FINAL_PATH="/var/www/$app"
#install extention for api if necessary
ynh_package_install_from_equivs ../conf/${DEPS_PKG_NAME}.control \
|| ynh_die "Unable to install dependencies"
# Check destination directory
[[ ! -d $FINAL_PATH ]] && ynh_die \
"The destination directory '$FINAL_PATH' does not exist.\
The app is not correctly installed, you should remove it first."
#old version cleanup
if [ -f $FINAL_PATH/data/user.php.dist ]; then
sudo rm $FINAL_PATH/data/user.php.dist
fi
# Create tmp directory and install app inside
TMPDIR=$(ynh_mkdir_tmp)
TMPDIR=$(mktemp -d)
sudo chmod 755 "$TMPDIR"
extract_freshrss "$TMPDIR"
# Restore config
sudo rm $TMPDIR/data/do-install.txt
sudo cp $FINAL_PATH/data/config.php $TMPDIR/data/config.php
sudo cp -r $FINAL_PATH/data/users/. $TMPDIR/data/users/
sudo cp -r $FINAL_PATH/extensions/. $TMPDIR/extensions/
# Set permissions to freshrss directory
sudo chown -R root:root $TMPDIR
sudo chown -R www-data: $TMPDIR/data/
sudo chown -R www-data: $TMPDIR/extensions/
# Clean up existing files and copy new files to the right place
sudo rm -rf "$FINAL_PATH"
sudo cp -rp "$TMPDIR" "$FINAL_PATH"
#install extention for api if necessary
if ! dpkg -s php5-gmp | grep "installed" > /dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y php5-gmp
fi

View file

@ -1,57 +0,0 @@
CREATE TABLE IF NOT EXISTS `YnoUser_category` (
`id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`name`) -- v0.7
) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS `YnoUser_feed` (
`id` SMALLINT NOT NULL AUTO_INCREMENT, -- v0.7
`url` varchar(511) CHARACTER SET latin1 NOT NULL,
`category` SMALLINT DEFAULT 0, -- v0.7
`name` varchar(255) NOT NULL,
`website` varchar(255) CHARACTER SET latin1,
`description` text,
`lastUpdate` int(11) DEFAULT 0, -- Until year 2038
`priority` tinyint(2) NOT NULL DEFAULT 10,
`pathEntries` varchar(511) DEFAULT NULL,
`httpAuth` varchar(511) DEFAULT NULL,
`error` boolean DEFAULT 0,
`keep_history` MEDIUMINT NOT NULL DEFAULT -2, -- v0.7
`ttl` INT NOT NULL DEFAULT -2, -- v0.7.3
`cache_nbEntries` int DEFAULT 0, -- v0.7
`cache_nbUnreads` int DEFAULT 0, -- v0.7
PRIMARY KEY (`id`),
FOREIGN KEY (`category`) REFERENCES `YnoUser_category`(`id`) ON DELETE SET NULL ON UPDATE CASCADE,
UNIQUE KEY (`url`), -- v0.7
INDEX (`name`), -- v0.7
INDEX (`priority`), -- v0.7
INDEX (`keep_history`) -- v0.7
) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
ENGINE = INNODB;
CREATE TABLE IF NOT EXISTS `YnoUser_entry` (
`id` bigint NOT NULL, -- v0.7
`guid` varchar(760) CHARACTER SET latin1 NOT NULL, -- Maximum for UNIQUE is 767B
`title` varchar(255) NOT NULL,
`author` varchar(255),
`content_bin` blob, -- v0.7
`link` varchar(1023) CHARACTER SET latin1 NOT NULL,
`date` int(11), -- Until year 2038
`lastSeen` INT(11) DEFAULT 0, -- v1.1.1, Until year 2038
`hash` BINARY(16), -- v1.1.1
`is_read` boolean NOT NULL DEFAULT 0,
`is_favorite` boolean NOT NULL DEFAULT 0,
`id_feed` SMALLINT, -- v0.7
`tags` varchar(1023),
PRIMARY KEY (`id`),
FOREIGN KEY (`id_feed`) REFERENCES `YnoUser_feed`(`id`) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE KEY (`id_feed`,`guid`), -- v0.7
INDEX (`is_favorite`), -- v0.7
INDEX (`is_read`), -- v0.7
INDEX `entry_lastSeen_index` (`lastSeen`) -- v1.1.1
) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
ENGINE = INNODB;
INSERT IGNORE INTO `YnoUser_category` (id, name) VALUES(1, "Uncategorized");