remove kodexplorer

This commit is contained in:
YGAS 2021-11-17 15:59:25 +08:00
parent 4834779bb7
commit a4c2f9a31f
13 changed files with 2 additions and 846 deletions

View File

@ -9,8 +9,8 @@ on:
- 'applications/**'
env:
SDK_NAME: openwrt-sdk-19.07.7-realtek-rtd129x_gcc-7.5.0_musl.Linux-x86_64
SDK_URL: https://fw.koolcenter.com/binary/ars2/
SDK_NAME: openwrt-sdk-19.07.8-mvebu-cortexa53_gcc-7.5.0_musl.Linux-x86_64
SDK_URL: https://downloads.openwrt.org/releases/19.07.8/targets/mvebu/cortexa53/
TZ: Asia/Shanghai
jobs:

View File

@ -1,16 +0,0 @@
# Copyright (C) 2018-2020 Lienol <lawlienol@gmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for KodExplorer
LUCI_DEPENDS:=+nginx +unzip +zoneinfo-asia +php7 +php7-fpm +php7-mod-curl +php7-mod-gd +php7-mod-iconv +php7-mod-json +php7-mod-mbstring +php7-mod-opcache +php7-mod-session +php7-mod-zip +php7-mod-sqlite3 +php7-mod-pdo +php7-mod-pdo-sqlite +php7-mod-pdo-mysql +php7-cgi +php7-mod-dom
LUCI_PKGARCH:=all
PKG_VERSION:=13
PKG_DATE:=20210505
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -1,48 +0,0 @@
-- Copyright 2018-2020 Lienol <lawlienol@gmail.com>
module("luci.controller.kodexplorer", package.seeall)
local http = require "luci.http"
local api = require "luci.model.cbi.kodexplorer.api"
function index()
if not nixio.fs.access("/etc/config/kodexplorer") then
return
end
entry({"admin", "nas"}, firstchild(), "NAS", 44).dependent = false
entry({"admin", "nas", "kodexplorer"}, cbi("kodexplorer/settings"), _("KodExplorer"), 3).dependent = true
entry({"admin", "nas", "kodexplorer", "check"}, call("action_check")).leaf = true
entry({"admin", "nas", "kodexplorer", "download"}, call("action_download")).leaf = true
entry({"admin", "nas", "kodexplorer", "status"}, call("act_status")).leaf = true
end
local function http_write_json(content)
http.prepare_content("application/json")
http.write_json(content or {code = 1})
end
function act_status()
local e = {}
e.nginx_status = luci.sys.call("ps -w | grep nginx | grep kodexplorer | grep -v grep > /dev/null") == 0
e.php_status = luci.sys.call("ps -w | grep php | grep kodexplorer | grep -v grep > /dev/null") == 0
http_write_json(e)
end
function action_check()
local json = api.to_check()
http_write_json(json)
end
function action_download()
local json = nil
local task = http.formvalue("task")
if task == "extract" then
json = api.to_extract(http.formvalue("file"))
elseif task == "move" then
json = api.to_move(http.formvalue("file"))
else
json = api.to_download(http.formvalue("url"))
end
http_write_json(json)
end

View File

@ -1,170 +0,0 @@
local fs = require "nixio.fs"
local sys = require "luci.sys"
local uci = require"luci.model.uci".cursor()
local util = require "luci.util"
local i18n = require "luci.i18n"
module("luci.model.cbi.kodexplorer.api", package.seeall)
local appname = "kodexplorer"
local api_url = "https://api.kodcloud.com/?app/version"
local wget = "/usr/bin/wget"
local wget_args = { "--no-check-certificate", "--quiet", "--timeout=10", "--tries=2" }
local command_timeout = 300
local function _unpack(t, i)
i = i or 1
if t[i] ~= nil then return t[i], _unpack(t, i + 1) end
end
local function exec(cmd, args, writer, timeout)
local os = require "os"
local nixio = require "nixio"
local fdi, fdo = nixio.pipe()
local pid = nixio.fork()
if pid > 0 then
fdo:close()
if writer or timeout then
local starttime = os.time()
while true do
if timeout and os.difftime(os.time(), starttime) >= timeout then
nixio.kill(pid, nixio.const.SIGTERM)
return 1
end
if writer then
local buffer = fdi:read(2048)
if buffer and #buffer > 0 then
writer(buffer)
end
end
local wpid, stat, code = nixio.waitpid(pid, "nohang")
if wpid and stat == "exited" then return code end
if not writer and timeout then nixio.nanosleep(1) end
end
else
local wpid, stat, code = nixio.waitpid(pid)
return wpid and stat == "exited" and code
end
elseif pid == 0 then
nixio.dup(fdo, nixio.stdout)
fdi:close()
fdo:close()
nixio.exece(cmd, args, nil)
nixio.stdout:close()
os.exit(1)
end
end
function get_project_directory()
return uci:get(appname, "@global[0]", "project_directory") or "/tmp/kodcloud"
end
function get_version()
local version = get_project_directory() .. "/config/version.php"
return sys.exec(string.format("echo -n $(cat %s 2>/dev/null | grep \"'KOD_VERSION'\" | cut -d \"'\" -f 4)", version))
end
local function compare_versions(ver1, comp, ver2)
local table = table
local av1 = util.split(ver1, "[%.%-]", nil, true)
local av2 = util.split(ver2, "[%.%-]", nil, true)
local max = table.getn(av1)
local n2 = table.getn(av2)
if (max < n2) then max = n2 end
for i = 1, max, 1 do
local s1 = av1[i] or ""
local s2 = av2[i] or ""
if comp == "~=" and (s1 ~= s2) then return true end
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
if (comp == ">" or comp == ">=") and (s1 > s2) then return true end
if (s1 ~= s2) then return false end
end
return not (comp == "<" or comp == ">")
end
local function get_api_json(url)
local jsonc = require "luci.jsonc"
local output = {}
-- exec(wget, { "-O-", url, _unpack(wget_args) },
-- function(chunk) output[#output + 1] = chunk end)
-- local json_content = util.trim(table.concat(output))
local json_content = sys.exec(wget .. " --no-check-certificate --timeout=10 -t 1 -O- " .. url)
if json_content == "" then return {} end
return jsonc.parse(json_content) or {}
end
function to_check()
local json = get_api_json(api_url)
return json
end
function to_download(url)
if not url or url == "" then
return {code = 1, error = i18n.translate("Download url is required.")}
end
sys.call("/bin/rm -f /tmp/kodcloud_download.*")
local tmp_file = util.trim(util.exec("mktemp -u -t kodcloud_download.XXXXXX"))
local result = exec(wget, {"-O", tmp_file, url, _unpack(wget_args)}, nil, command_timeout) == 0
if not result then
exec("/bin/rm", {"-f", tmp_file})
return {
code = 1,
error = i18n.translatef("File download failed or timed out: %s", url)
}
end
return {code = 0, file = tmp_file}
end
function to_extract(file)
if not file or file == "" or not fs.access(file) then
return {code = 1, error = i18n.translate("File path required.")}
end
sys.call("/bin/rm -rf /tmp/kodcloud_extract.*")
local tmp_dir = util.trim(util.exec("mktemp -d -t kodcloud_extract.XXXXXX"))
local output = {}
exec("/usr/bin/unzip", {"-o", file, "-d", tmp_dir}, function(chunk) output[#output + 1] = chunk end)
local files = util.split(table.concat(output))
exec("/bin/rm", {"-f", file})
return {code = 0, file = tmp_dir}
end
function to_move(file)
if not file or file == "" or not fs.access(file) then
sys.call("/bin/rm -rf /tmp/kodcloud_extract.*")
return {code = 1, error = i18n.translate("Client file is required.")}
end
local client_file = get_project_directory()
sys.call("mkdir -p " .. client_file)
sys.call("cp -R " .. file .. "/* " .. client_file)
sys.call("/bin/rm -rf /tmp/kodcloud_extract.*")
return {code = 0}
end

View File

@ -1,56 +0,0 @@
m = Map("kodexplorer", translate("KodExplorer"), translate(
"KodExplorer is a fast and efficient private cloud and online document management system that provides secure, controllable, easy-to-use and highly customizable private cloud products for personal websites, enterprise private cloud deployment, network storage, online document management, and online office. With Windows style interface and operation habits, it can be used quickly without adaptation. It supports online preview of hundreds of common file formats and is extensible and easy to customize."))
m:append(Template("kodexplorer/status"))
s = m:section(TypedSection, "global", translate("Global Settings"))
s.anonymous = true
s.addremove = false
o = s:option(Flag, "enable", translate("Enable"))
o.rmempty = false
o = s:option(Value, "port", translate("Nginx Port"))
o.datatype = "port"
o.default = 8081
o.rmempty = false
o = s:option(Value, "memory_limit", translate("Maximum memory usage"),
translate(
"If your device has a lot of memory, you can increase it."))
o.default = "8M"
o.rmempty = false
o = s:option(Value, "post_max_size", translate("Maximum POST capacity"),
translate(
"This value cannot be greater than the maximum memory usage"))
o.default = "12M"
o.rmempty = false
o = s:option(Value, "upload_max_filesize",
translate("Maximum memory usage for uploading files"), translate(
"This value cannot be greater than the POST maximum capacity"))
o.default = "12M"
o.rmempty = false
o = s:option(Value, "storage_device_path", translate("Storage device path"),
translate(
"It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/"))
o.default = "/mnt/sda1/"
o.rmempty = false
o = s:option(Value, "project_directory", translate("Project directory"),
translate(
"It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/kodexplorer"))
o.default = "/mnt/sda1/kodexplorer"
o.rmempty = false
s:append(Template("kodexplorer/version"))
o = s:option(Button, "_download", translate("Manually update"), translate(
"Make sure you have enough space.<br /><font style='color:red'>Be sure to fill out the device path and store path for the first run, and then save the application. Then manually download, otherwise can not use!</font>"))
o.template = "kodexplorer/download"
o.inputstyle = "apply"
o.btnclick = "downloadClick(this);"
o.id = "download_btn"
return m

View File

@ -1,175 +0,0 @@
<script type="text/javascript">
//<![CDATA[
var msgInfo;
var tokenStr = '<%=token%>';
var clickToDownloadText = '<%:Click to update%>';
var inProgressText = '<%:Updating...%>';
var downloadInProgressNotice = '<%:Updating, are you sure to close?%>';
var downloadSuccessText = '<%:Update successful%>';
var unexpectedErrorText = '<%:Unexpected error%>';
var downloadingText = '<%:Downloading...%>';
var decompressioningText = '<%:Unpacking...%>';
var movingText = '<%:Moving...%>';
var latestVersionText = '<%:The latest version:%>';
function addPageNotice() {
window.onbeforeunload = function (e) {
e.returnValue = downloadInProgressNotice;
return downloadInProgressNotice;
};
}
function removePageNotice() {
window.onbeforeunload = undefined;
}
function onUpdateSuccess(btn) {
alert(downloadSuccessText);
if (btn) {
btn.value = downloadSuccessText;
btn.placeholder = downloadSuccessText;
btn.disabled = true;
}
window.setTimeout(function () {
window.location.reload();
}, 1000);
}
function onRequestError(btn, errorMessage) {
btn.disabled = false;
btn.value = btn.placeholder;
if (errorMessage) {
alert(errorMessage);
}
}
function doAjaxGet(url, data, onResult) {
new XHR().get(url, data, function (_, json) {
var resultJson = json || {
'code': 1,
'error': unexpectedErrorText
};
if (typeof onResult === 'function') {
onResult(resultJson);
}
})
}
function downloadClick(btn) {
if (msgInfo === undefined) {
checkUpdate(btn);
} else {
doDownload(btn);
}
}
function checkUpdate(btn) {
var text = btn.value;
btn.disabled = true;
btn.value = inProgressText;
addPageNotice();
var ckeckDetailElm = document.getElementById(btn.id + '-detail');
doAjaxGet('<%=url([[admin]], [[nas]], [[kodexplorer]], [[check]])%>', {
token: tokenStr
}, function (json) {
removePageNotice();
if (json.code && json.data.server) {
var server = json.data.server;
eval('Info = json');
btn.disabled = false;
btn.value = clickToDownloadText;
btn.placeholder = clickToDownloadText;
if (ckeckDetailElm) {
var urlNode = '';
if (server.version) {
urlNode = '<em style="color:red;">' + latestVersionText + server.version + '</em>';
var html_url = 'https://kodcloud.com/download/';
if (html_url) {
urlNode = '<a href="' + html_url + '" target="_blank">' + urlNode + '</a>';
}
}
ckeckDetailElm.innerHTML = urlNode;
}
msgInfo = server;
} else {
removePageNotice();
btn.disabled = false;
btn.value = text;
alert(unexpectedErrorText);
}
});
}
function doDownload(btn) {
btn.disabled = true;
btn.value = downloadingText;
addPageNotice();
var UpdateUrl = '<%=url([[admin]], [[nas]], [[kodexplorer]], [[download]])%>';
// Download file
doAjaxGet(UpdateUrl, {
token: tokenStr,
url: msgInfo ? msgInfo.link : ''
}, function (json) {
if (json.code) {
removePageNotice();
onRequestError(btn, json.error);
} else {
btn.value = decompressioningText;
// Extract file
doAjaxGet(UpdateUrl, {
token: tokenStr,
task: 'extract',
file: json.file
}, function (json) {
if (json.code) {
removePageNotice();
onRequestError(btn, json.error);
} else {
btn.value = movingText;
// Move file to target dir
doAjaxGet(UpdateUrl, {
token: tokenStr,
task: 'move',
file: json.file
}, function (json) {
removePageNotice();
if (json.code) {
onRequestError(btn, json.error);
} else {
onUpdateSuccess(btn);
}
})
}
})
}
})
}
//]]>
</script>
<%+cbi/valueheader%>
<% if self:cfgvalue(section) ~= false then %>
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" type="button"<%=
attr("name", cbid) ..
attr("id", self.id or cbid) ..
attr("value", self.inputtitle or self.title) ..
ifattr(self.btnclick, "onclick", self.btnclick) ..
ifattr(self.placeholder, "placeholder")
%> />
<span id="<%=self.id or cbid%>-detail"></span>
<% else %>
-
<% end %>
<%+cbi/valuefooter%>

View File

@ -1,38 +0,0 @@
<%
local dsp = require "luci.dispatcher"
-%>
<fieldset class="cbi-section">
<legend><%:Running Status%></legend>
<fieldset class="cbi-section">
<div class="cbi-value">
<label class="cbi-value-title">Nginx <%:Status%></label>
<div class="cbi-value-field" id="_nginx_status"><%:Collecting data...%></div>
</div>
<div class="cbi-value">
<label class="cbi-value-title">PHP <%:Status%></label>
<div class="cbi-value-field" id="_php_status"><%:Collecting data...%></div>
</div>
</fieldset>
</fieldset>
<script type="text/javascript">//<![CDATA[
var nginx_status = document.getElementById('_nginx_status');
var php_status = document.getElementById('_php_status');
XHR.poll(3,'<%=dsp.build_url("admin/nas/kodexplorer/status")%>', null,
function(x, json) {
if (x && x.status == 200) {
if (nginx_status) {
nginx_status.innerHTML = json.nginx_status ? '<font color="green"><%:RUNNING%> ✓</font><input type="button" class="cbi-button cbi-input-apply" value="<%:Enter interface%>" onclick="openwebui()" />' : '<font color="red"><%:NOT RUNNING%> X</font>';
}
if (php_status) {
php_status.innerHTML = json.php_status ? '<font color="green"><%:RUNNING%> ✓</font>' : '<font color="red"><%:NOT RUNNING%> X</font>';
}
}
}
);
function openwebui(){
var url = window.location.host+":<%=luci.sys.exec("uci -q get kodexplorer.@global[0].port"):gsub("^%s*(.-)%s*$", "%1")%>";
window.open('http://'+url,'target','');
}
//]]></script>

View File

@ -1,17 +0,0 @@
<%
local api = require "luci.model.cbi.kodexplorer.api"
local app_version = api.get_version()
-%>
<% if app_version and app_version ~= "" then %>
<div class="cbi-value">
<label class="cbi-value-title">
<%:Version%>
</label>
<div class="cbi-value-field">
<div class="cbi-value-description">
<span><%=app_version%> 】</span>
</div>
</div>
</div>
<% end %>

View File

@ -1,120 +0,0 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: dingpengyu <dingpengyu06@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"X-Generator: Poedit 2.3.1\n"
msgid "KodExplorer"
msgstr "可道云"
msgid "Global Settings"
msgstr "全局设置"
msgid "KodExplorer is a fast and efficient private cloud and online document management system that provides secure, controllable, easy-to-use and highly customizable private cloud products for personal websites, enterprise private cloud deployment, network storage, online document management, and online office. With Windows style interface and operation habits, it can be used quickly without adaptation. It supports online preview of hundreds of common file formats and is extensible and easy to customize."
msgstr "KodExplorer是一款快捷高效的私有云和在线文档管理系统为个人网站、企业私有云部署、网络存储、在线文档管理、在线办公等提供安全可控简便易用、可高度定制的私有云产品。采用windows风格界面、操作习惯无需适应即可快速上手支持几百种常用文件格式的在线预览可扩展易定制。"
msgid "Nginx Port"
msgstr "Nginx监听端口"
msgid "Maximum memory usage"
msgstr "内存最大使用"
msgid "If your device has a lot of memory, you can increase it."
msgstr "如果你的设备内存较大的话,可以适当增加。"
msgid "Maximum POST capacity"
msgstr "POST最大容量"
msgid "This value cannot be greater than the maximum memory usage"
msgstr "该值不能大于 内存最大使用"
msgid "Maximum memory usage for uploading files"
msgstr "上传文件最大使用内存"
msgid "This value cannot be greater than the POST maximum capacity"
msgstr "该值不能大于 POST最大容量"
msgid "Storage device path"
msgstr "存储设备路径"
msgid "It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/"
msgstr "建议插入U盘或硬盘然后输入路径。例如/mnt/sda1/"
msgid "Project directory"
msgstr "项目存放目录"
msgid "It is recommended to insert a usb flash drive or hard disk and enter the path. For example, /mnt/sda1/kodexplorer"
msgstr "建议插入U盘或硬盘然后输入路径。例如/mnt/sda1/kodexplorer"
msgid "Make sure you have enough space.<br /><font style='color:red'>Be sure to fill out the device path and store path for the first run, and then save the application. Then manually download, otherwise can not use!</font>"
msgstr "请确保具有足够的空间。<br /><font style='color:red'>第一次运行务必填好设备路径和存放路径,然后保存应用。再手动下载,否则无法使用!</font>"
msgid "Manually update"
msgstr "手动更新"
msgid "It is the latest version"
msgstr "已是最新版本"
msgid "Update successful"
msgstr "更新成功"
msgid "Click to update"
msgstr "点击更新"
msgid "Updating..."
msgstr "更新中..."
msgid "Unexpected error"
msgstr "意外错误"
msgid "Updating, are you sure to close?"
msgstr "正在更新,你确认要关闭吗?"
msgid "Downloading..."
msgstr "下载中..."
msgid "Unpacking..."
msgstr "解压中..."
msgid "Moving..."
msgstr "移动中..."
msgid "The latest version:"
msgstr "最新版本:"
msgid "Can't determine ARCH, or ARCH not supported."
msgstr "无法确认ARCH架构或是不支持。"
msgid "Get remote version info failed."
msgstr "获取远程版本信息失败。"
msgid "New version found, but failed to get new version download url."
msgstr "发现新版本,但未能获得新版本的下载地址。"
msgid "Download url is required."
msgstr "请指定下载地址。"
msgid "File download failed or timed out: %s"
msgstr "文件下载失败或超时:%s"
msgid "File path required."
msgstr "请指定文件路径。"
msgid "Can't find client in file: %s"
msgstr "无法在文件中找到客户端:%s"
msgid "Client file is required."
msgstr "请指定客户端文件。"
msgid "The client file is not suitable for current device."
msgstr "客户端文件不适合当前设备。"
msgid "Can't move new file to path: %s"
msgstr "无法移动新文件到:%s"

View File

@ -1,10 +0,0 @@
config global
option port '8080'
option storage_device_path '/opt/kodexplorer/'
option project_directory '/opt/kodexplorer'
option enable '0'
option memory_limit '120M'
option post_max_size '100M'
option upload_max_filesize '100M'

View File

@ -1,171 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2018-2020 Lienol <lawlienol@gmail.com>
START=99
CONFIG="kodexplorer"
TEMP_PATH="/var/etc/kodexplorer"
NGINX_CONFIG="$TEMP_PATH/nginx.conf"
PHP_FPM_CONFIG="$TEMP_PATH/php-fpm.conf"
PHP_CONFIG="/etc/php.ini"
PHP_BACKUP_CONFIG="/etc/php.ini.backup"
config_t_get() {
local index=0
[ -n "$4" ] && index=$4
local ret=$(uci get $CONFIG.@$1[$index].$2 2>/dev/null)
echo ${ret:=$3}
}
gen_nginx_config() {
port=$(config_t_get global port)
project_directory=$(config_t_get global project_directory)
cat <<-EOF > $1
user root root;
worker_processes 1;
pid /var/run/nginx_kodexplorer.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
sendfile on;
keepalive_timeout 65;
server {
listen $port;
listen [::]:$port;
server_name localhost;
location / {
root $project_directory;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php(.*)$ {
root $project_directory;
try_files \$uri = 404; # PHP 文件不存在返回404
fastcgi_pass unix:/var/run/php7-fpm.sock; # 通过 Unix 套接字执行 PHP
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; # 修复 Nginx fastcgi 漏洞
fastcgi_param PATH_INFO \$fastcgi_path_info;
include /etc/nginx/fastcgi_params;
}
}
}
EOF
}
gen_php_config() {
storage_device_path=$(config_t_get global storage_device_path)
memory_limit=$(config_t_get global memory_limit)
post_max_size=$(config_t_get global post_max_size)
upload_max_filesize=$(config_t_get global upload_max_filesize)
cp $PHP_CONFIG $PHP_BACKUP_CONFIG
cat <<-EOF >$PHP_CONFIG
[PHP]
zend.ze1_compatibility_mode = Off
engine = On
precision = 12
y2k_compliance = On
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100
open_basedir = $storage_device_path:/tmp/:/proc/:/usr/bin/
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = $memory_limit
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
display_errors = On
display_startup_errors = Off
log_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = "EGPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = On
auto_globals_jit = On
post_max_size = $post_max_size
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
;doc_root = "/www"
user_dir =
extension_dir = "/usr/lib/php"
enable_dl = On
cgi.fix_pathinfo=1
file_uploads = On
upload_tmp_dir = "/tmp"
upload_max_filesize = $upload_max_filesize
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
EOF
cat <<-EOF >$PHP_FPM_CONFIG
[global]
pid = /var/run/kodexplorer_php7-fpm.pid
error_log = /var/log/kodexplorer_php7-fpm.log
[www]
user = root
listen = /var/run/php7-fpm.sock
listen.mode = 0666
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
EOF
}
start() {
ENABLED=$(config_t_get global enable 0)
[ "$ENABLED" = "0" ] && return 0
mkdir -p $TEMP_PATH /var/log/nginx /var/lib/nginx
gen_php_config
/usr/bin/php-fpm -R -y $PHP_FPM_CONFIG -g "/var/run/php7-fpm.pid"
gen_nginx_config $NGINX_CONFIG
/usr/sbin/nginx -c $NGINX_CONFIG >/dev/null 2>&1 &
}
stop() {
/usr/sbin/nginx -c $NGINX_CONFIG -s stop >/dev/null 2>&1 &
killall -9 php-fpm >/dev/null 2>&1 &
rm -f /var/run/kodexplorer_php7-fpm.pid
rm -f /var/log/kodexplorer_php7-fpm.log
rm -f /var/run/php7-fpm.sock
[ -f "$PHP_BACKUP_CONFIG" -a -f "$PHP_CONFIG" ] && {
rm -f $PHP_CONFIG
cp $PHP_BACKUP_CONFIG $PHP_CONFIG
rm -f $PHP_BACKUP_CONFIG
}
}
restart() {
stop
start
}

View File

@ -1,12 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@kodexplorer[-1]
add ucitrack kodexplorer
set ucitrack.@kodexplorer[-1].init=kodexplorer
commit ucitrack
EOF
/etc/init.d/php7-fpm disable && /etc/init.d/php7-fpm stop
rm -rf /tmp/luci-*cache
exit 0

View File

@ -1,11 +0,0 @@
{
"luci-app-kodexplorer": {
"description": "Grant UCI access for luci-app-kodexplorer",
"read": {
"uci": [ "kodexplorer" ]
},
"write": {
"uci": [ "kodexplorer" ]
}
}
}