slackbuilds/n/nextcloud-server/nextcloud-news-updater.rb
Gwenhael Le Moine 16e5beba46
nextcloud news updater script
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
2018-03-14 14:35:32 +01:00

20 lines
431 B
Ruby

#!/usr/bin/env ruby
require "json"
require "thwait"
NC_ROOT="/srv/www/vhosts/nextcloud-server/htdocs"
def occ( command )
`php -f #{NC_ROOT}/occ #{command}`
end
occ( 'news:updater:before-update' )
ThreadsWait.all_waits( JSON.parse( occ( 'news:updater:all-feeds' ) )["feeds"]
.map do |feed|
Thread.new do
occ( "news:updater:update-feed #{feed['id']} #{feed['userId']}" )
end
end )
occ( 'news:updater:after-update' )