当前位置: 首页 > 无线与硬件 > 正文

[分享]OpenWRT 添加 释放内存 按钮

*2013-12-25更新

修改 modules/admin-full/luasrc/controller/admin/index.lua 文件

–[[
LuCI – Lua Configuration Interface

Copyright 2008 Steven Barth <steven@midlink.org>

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

$Id: index.lua 7789 2011-10-26 03:04:18Z jow $
]]–

module(“luci.controller.admin.index”, package.seeall)

function index()
local root = node()
if not root.target then
root.target = alias(“admin”)
root.index = true
end

local page = node(“admin”)
page.target = firstchild()
page.title = _(“Administration”)
page.order = 10
page.sysauth = “root”
page.sysauth_authenticator = “htmlauth”
page.ucidata = true
page.index = true

— Empty services menu to be populated by addons
entry({“admin”, “services”}, firstchild(), _(“Services”), 40).index = true

entry({“admin”, “Free_Memory”}, call(“Free_Memory”), _(“Free Memory”), 89)
entry({“admin”, “logout”}, call(“action_logout”), _(“Logout”), 90)
end

function action_logout()
local dsp = require “luci.dispatcher”
local sauth = require “luci.sauth”
if dsp.context.authsession then
sauth.kill(dsp.context.authsession)
dsp.context.urltoken.stok = nil
end

luci.http.header(“Set-Cookie”, “sysauth=; path=” .. dsp.build_url())
luci.http.redirect(luci.dispatcher.build_url())
end
function Free_Memory()
luci.util.exec(“echo 3 > /proc/sys/vm/drop_caches”)
luci.http.redirect(luci.dispatcher.build_url(“admin”, “status”, “overview”))
end

 

黑色加粗部分。

 

另在 luci/trunk/luci/luci/po/zh_CN/base.po 最底部添加

msgid “Free_Memory”
msgstr “释放内存”

这样使用中文的时候便能显示中文。

本文固定链接: https://blog.ich8.com/post/3948 | 霸王硬上弓's Blog

avatar
该日志由 霸王硬上弓 于2013年07月04日发表在 无线与硬件 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: [分享]OpenWRT 添加 释放内存 按钮 | 霸王硬上弓's Blog

[分享]OpenWRT 添加 释放内存 按钮:目前有1 条留言

发表评论

您必须 [ 登录 ] 才能发表留言!