]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/BasicActions.cc
7ed43318f685a71251ec1559a37101a13ac9e93c
4 * DEBUG: section 16 Cache Manager API
9 #include "base/TextException.h"
10 #include "CacheManager.h"
11 #include "mgr/ActionCreator.h"
12 #include "mgr/ActionProfile.h"
13 #include "mgr/BasicActions.h"
14 #include "mgr/Registration.h"
18 Mgr::IndexAction::Pointer
19 Mgr::IndexAction::Create(const Command::Pointer
&cmd
)
21 return new IndexAction(cmd
);
24 Mgr::IndexAction::IndexAction(const Command::Pointer
&cmd
): Action(cmd
)
30 Mgr::IndexAction::dump(StoreEntry
* entry
)
35 Mgr::MenuAction::Pointer
36 Mgr::MenuAction::Create(const Command::Pointer
&cmd
)
38 return new MenuAction(cmd
);
41 Mgr::MenuAction::MenuAction(const Command::Pointer
&cmd
): Action(cmd
)
47 Mgr::MenuAction::dump(StoreEntry
* entry
)
52 typedef CacheManager::Menu::const_iterator Iterator
;
53 const CacheManager::Menu
& menu
= CacheManager::GetInstance()->menu();
55 for (Iterator a
= menu
.begin(); a
!= menu
.end(); ++a
) {
56 storeAppendPrintf(entry
, " %-22s\t%-32s\t%s\n",
57 (*a
)->name
, (*a
)->desc
,
58 CacheManager::GetInstance()->ActionProtection(*a
));
62 Mgr::ShutdownAction::Pointer
63 Mgr::ShutdownAction::Create(const Command::Pointer
&cmd
)
65 return new ShutdownAction(cmd
);
68 Mgr::ShutdownAction::ShutdownAction(const Command::Pointer
&cmd
): Action(cmd
)
74 Mgr::ShutdownAction::dump(StoreEntry
* entry
)
76 debugs(16, DBG_CRITICAL
, "Shutdown by Cache Manager command.");
80 Mgr::ReconfigureAction::Pointer
81 Mgr::ReconfigureAction::Create(const Command::Pointer
&cmd
)
83 return new ReconfigureAction(cmd
);
86 Mgr::ReconfigureAction::ReconfigureAction(const Command::Pointer
&cmd
):
93 Mgr::ReconfigureAction::dump(StoreEntry
* entry
)
95 debugs(16, DBG_IMPORTANT
, "Reconfigure by Cache Manager command.");
96 storeAppendPrintf(entry
, "Reconfiguring Squid Process ....");
100 Mgr::RotateAction::Pointer
101 Mgr::RotateAction::Create(const Command::Pointer
&cmd
)
103 return new RotateAction(cmd
);
106 Mgr::RotateAction::RotateAction(const Command::Pointer
&cmd
): Action(cmd
)
112 Mgr::RotateAction::dump(StoreEntry
* entry
)
114 debugs(16, DBG_IMPORTANT
, "Rotate Logs by Cache Manager command.");
115 storeAppendPrintf(entry
, "Rotating Squid Process Logs ....");
116 #if defined(_SQUID_LINUX_THREADS_)
117 rotate_logs(SIGQUIT
);
119 rotate_logs(SIGUSR1
);
123 Mgr::OfflineToggleAction::Pointer
124 Mgr::OfflineToggleAction::Create(const Command::Pointer
&cmd
)
126 return new OfflineToggleAction(cmd
);
129 Mgr::OfflineToggleAction::OfflineToggleAction(const Command::Pointer
&cmd
):
136 Mgr::OfflineToggleAction::dump(StoreEntry
* entry
)
138 Config
.onoff
.offline
= !Config
.onoff
.offline
;
139 debugs(16, DBG_IMPORTANT
, "offline_mode now " << (Config
.onoff
.offline
? "ON" : "OFF") << " by Cache Manager request.");
141 storeAppendPrintf(entry
, "offline_mode is now %s\n",
142 Config
.onoff
.offline
? "ON" : "OFF");
146 Mgr::RegisterBasics()
148 RegisterAction("index", "Cache Manager Interface", &Mgr::IndexAction::Create
, 0, 1);
149 RegisterAction("menu", "Cache Manager Menu", &Mgr::MenuAction::Create
, 0, 1);
150 RegisterAction("offline_toggle", "Toggle offline_mode setting", &Mgr::OfflineToggleAction::Create
, 1, 1);
151 RegisterAction("shutdown", "Shut Down the Squid Process", &Mgr::ShutdownAction::Create
, 1, 1);
152 RegisterAction("reconfigure", "Reconfigure Squid", &Mgr::ReconfigureAction::Create
, 1, 1);
153 RegisterAction("rotate", "Rotate Squid Logs", &Mgr::RotateAction::Create
, 1, 1);