Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
AdminFunctionsHandler.inc.php
1 <?php
2 
16 import('lib.pkp.classes.site.Version');
17 import('lib.pkp.classes.site.VersionDAO');
18 import('lib.pkp.classes.site.VersionCheck');
19 import('lib.pkp.pages.admin.AdminHandler');
20 
25  function AdminFunctionsHandler() {
26  parent::AdminHandler();
27 
28  $this->addRoleAssignment(
29  array(ROLE_ID_SITE_ADMIN),
30  array(
31  'systemInfo', 'editSystemConfig', 'saveSystemConfig', 'phpinfo',
32  'expireSessions', 'clearTemplateCache', 'clearDataCache'
33  )
34  );
35  }
36 
42  function systemInfo($args, $request) {
43  $this->setupTemplate($request, true);
44 
45  $versionDao = DAORegistry::getDAO('VersionDAO');
46  $currentVersion = $versionDao->getCurrentVersion();
47 
48  $templateMgr = TemplateManager::getManager($request);
49  $templateMgr->assign('currentVersion', $currentVersion);
50  if ($request->getUserVar('versionCheck')) {
51  $latestVersionInfo = VersionCheck::getLatestVersion();
52  $latestVersionInfo['patch'] = VersionCheck::getPatch($latestVersionInfo);
53  $templateMgr->assign('latestVersionInfo', $latestVersionInfo);
54  }
55  $templateMgr->display('admin/systemInfo.tpl');
56  }
57 
61  function phpinfo() {
62  phpinfo();
63  }
64 
70  function expireSessions($args, $request) {
71  $sessionDao = DAORegistry::getDAO('SessionDAO');
72  $sessionDao->deleteAllSessions();
73  $request->redirect(null, 'admin');
74  }
75 
81  function clearTemplateCache($args, $request) {
82  $templateMgr = TemplateManager::getManager($request);
83  $templateMgr->clearTemplateCache();
84  $request->redirect(null, 'admin');
85  }
86 
92  function clearDataCache($args, $request) {
93  // Clear the CacheManager's caches
94  $cacheManager = CacheManager::getManager();
95  $cacheManager->flush();
96 
97  // Clear ADODB's cache
98  $userDao = DAORegistry::getDAO('UserDAO'); // As good as any
99  $userDao->flushCache();
100 
101  $request->redirect(null, 'admin');
102  }
103 }
104 
105 ?>
static & getDAO($name, $dbconn=null)
setupTemplate($request)
Handle requests for site administration functions.
addRoleAssignment($roleIds, $operations)
Handle requests for site administrative/maintenance functions.
getPatch(&$versionInfo, $codeVersion=null)