]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/BasicActions.cc
2 * DEBUG: section 16 Cache Manager API
7 #include "base/TextException.h"
8 #include "CacheManager.h"
9 #include "mgr/ActionCreator.h"
10 #include "mgr/ActionProfile.h"
11 #include "mgr/BasicActions.h"
12 #include "mgr/Registration.h"
14 #include "SquidConfig.h"
17 Mgr::IndexAction::Pointer
18 Mgr::IndexAction::Create(const Command::Pointer
&cmd
)
20 return new IndexAction(cmd
);
23 Mgr::IndexAction::IndexAction(const Command::Pointer
&aCmd
): Action(aCmd
)
29 Mgr::IndexAction::dump(StoreEntry
* entry
)
34 Mgr::MenuAction::Pointer
35 Mgr::MenuAction::Create(const Command::Pointer
&cmd
)
37 return new MenuAction(cmd
);
40 Mgr::MenuAction::MenuAction(const Command::Pointer
&aCmd
): Action(aCmd
)
46 Mgr::MenuAction::dump(StoreEntry
* entry
)
51 typedef CacheManager::Menu::const_iterator Iterator
;
52 const CacheManager::Menu
& menu
= CacheManager::GetInstance()->menu();
54 for (Iterator a
= menu
.begin(); a
!= menu
.end(); ++a
) {
55 storeAppendPrintf(entry
, " %-22s\t%-32s\t%s\n",
56 (*a
)->name
, (*a
)->desc
,
57 CacheManager::GetInstance()->ActionProtection(*a
));
61 Mgr::ShutdownAction::Pointer
62 Mgr::ShutdownAction::Create(const Command::Pointer
&cmd
)
64 return new ShutdownAction(cmd
);
67 Mgr::ShutdownAction::ShutdownAction(const Command::Pointer
&aCmd
): Action(aCmd
)
73 Mgr::ShutdownAction::dump(StoreEntry
* entry
)
75 debugs(16, DBG_CRITICAL
, "Shutdown by Cache Manager command.");
79 Mgr::ReconfigureAction::Pointer
80 Mgr::ReconfigureAction::Create(const Command::Pointer
&cmd
)
82 return new ReconfigureAction(cmd
);
85 Mgr::ReconfigureAction::ReconfigureAction(const Command::Pointer
&aCmd
):
92 Mgr::ReconfigureAction::dump(StoreEntry
* entry
)
94 debugs(16, DBG_IMPORTANT
, "Reconfigure by Cache Manager command.");
95 storeAppendPrintf(entry
, "Reconfiguring Squid Process ....");
99 Mgr::RotateAction::Pointer
100 Mgr::RotateAction::Create(const Command::Pointer
&cmd
)
102 return new RotateAction(cmd
);
105 Mgr::RotateAction::RotateAction(const Command::Pointer
&aCmd
): Action(aCmd
)
111 Mgr::RotateAction::dump(StoreEntry
* entry
)
113 debugs(16, DBG_IMPORTANT
, "Rotate Logs by Cache Manager command.");
114 storeAppendPrintf(entry
, "Rotating Squid Process Logs ....");
115 #if defined(_SQUID_LINUX_THREADS_)
116 rotate_logs(SIGQUIT
);
118 rotate_logs(SIGUSR1
);
122 Mgr::OfflineToggleAction::Pointer
123 Mgr::OfflineToggleAction::Create(const Command::Pointer
&cmd
)
125 return new OfflineToggleAction(cmd
);
128 Mgr::OfflineToggleAction::OfflineToggleAction(const Command::Pointer
&aCmd
):
135 Mgr::OfflineToggleAction::dump(StoreEntry
* entry
)
137 Config
.onoff
.offline
= !Config
.onoff
.offline
;
138 debugs(16, DBG_IMPORTANT
, "offline_mode now " << (Config
.onoff
.offline
? "ON" : "OFF") << " by Cache Manager request.");
140 storeAppendPrintf(entry
, "offline_mode is now %s\n",
141 Config
.onoff
.offline
? "ON" : "OFF");
145 Mgr::RegisterBasics()
147 RegisterAction("index", "Cache Manager Interface", &Mgr::IndexAction::Create
, 0, 1);
148 RegisterAction("menu", "Cache Manager Menu", &Mgr::MenuAction::Create
, 0, 1);
149 RegisterAction("offline_toggle", "Toggle offline_mode setting", &Mgr::OfflineToggleAction::Create
, 1, 1);
150 RegisterAction("shutdown", "Shut Down the Squid Process", &Mgr::ShutdownAction::Create
, 1, 1);
151 RegisterAction("reconfigure", "Reconfigure Squid", &Mgr::ReconfigureAction::Create
, 1, 1);
152 RegisterAction("rotate", "Rotate Squid Logs", &Mgr::RotateAction::Create
, 1, 1);