/** * Show system information summary. * @param $args array * @param $request PKPRequest */ function systemInfo($args, $request) { $this->setupTemplate($request, true); $versionDao = DAORegistry::getDAO('VersionDAO'); $currentVersion = $versionDao->getCurrentVersion(); $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('currentVersion', $currentVersion); if ($request->getUserVar('versionCheck')) { $latestVersionInfo = VersionCheck::getLatestVersion(); $latestVersionInfo['patch'] = VersionCheck::getPatch($latestVersionInfo); $templateMgr->assign('latestVersionInfo', $latestVersionInfo); } $templateMgr->display('admin/systemInfo.tpl'); }
/** * Show system information summary. */ function systemInfo() { $this->validate(); $this->setupTemplate(true); $configData =& Config::getData(); $dbconn =& DBConnection::getConn(); $dbServerInfo = $dbconn->ServerInfo(); $versionDao =& DAORegistry::getDAO('VersionDAO'); $currentVersion =& $versionDao->getCurrentVersion(); $versionHistory =& $versionDao->getVersionHistory(); $serverInfo = array('admin.server.platform' => Core::serverPHPOS(), 'admin.server.phpVersion' => Core::serverPHPVersion(), 'admin.server.apacheVersion' => function_exists('apache_get_version') ? apache_get_version() : Locale::translate('common.notAvailable'), 'admin.server.dbDriver' => Config::getVar('database', 'driver'), 'admin.server.dbVersion' => empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description']); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('currentVersion', $currentVersion); $templateMgr->assign_by_ref('versionHistory', $versionHistory); $templateMgr->assign_by_ref('configData', $configData); $templateMgr->assign_by_ref('serverInfo', $serverInfo); if (Request::getUserVar('versionCheck')) { $latestVersionInfo =& VersionCheck::getLatestVersion(); $latestVersionInfo['patch'] = VersionCheck::getPatch($latestVersionInfo); $templateMgr->assign_by_ref('latestVersionInfo', $latestVersionInfo); } $templateMgr->display('admin/systemInfo.tpl'); }
/** * Download latest package/patch. */ function download() { $versionInfo = VersionCheck::getLatestVersion(); if (!$versionInfo) { $application =& PKPApplication::getApplication(); printf("Failed to load version info from %s\n", $application->getVersionDescriptorUrl()); exit(1); } $type = isset($this->argv[1]) && $this->argv[1] == 'patch' ? 'patch' : 'package'; if ($type == 'package') { $download = $versionInfo['package']; } else { $download = VersionCheck::getPatch($versionInfo); } if (!isset($download)) { printf("No applicable download available\n"); return; } $outFile = basename($download); printf("Download %s: %s\n", $type, $download); printf("File will be saved to: %s\n", $outFile); if (!$this->promptContinue()) { exit(0); } $out = fopen($outFile, 'wb'); if (!$out) { printf("Failed to open %s for writing\n", $outFile); exit(1); } $in = fopen($download, 'rb'); if (!$in) { printf("Failed to open %s for reading\n", $download); fclose($out); exit(1); } printf('Downloading file...'); while (($data = fread($in, 4096)) !== '') { printf('.'); fwrite($out, $data); } printf("done\n"); fclose($in); fclose($out); }
/** * Checks the application's version against the latest version * on the PKP servers. * @return string or false if no newer version */ function checkIfNewVersionExists() { $versionInfo =& VersionCheck::getLatestVersion(); $latestVersion = $versionInfo['release']; $currentVersion =& VersionCheck::getCurrentDBVersion(); if ($currentVersion->compare($latestVersion) < 0) { return $latestVersion; } else { return false; } }
/** * Download latest package. */ function download() { $versionInfo = VersionCheck::getLatestVersion(); if (!$versionInfo) { $application = PKPApplication::getApplication(); printf("Failed to load version info from %s\n", $application->getVersionDescriptorUrl()); exit(1); } $download = $versionInfo['package']; $outFile = basename($download); printf("Download %s: %s\n", $type, $download); printf("File will be saved to: %s\n", $outFile); if (!$this->promptContinue()) { exit(0); } $out = fopen($outFile, 'wb'); if (!$out) { printf("Failed to open %s for writing\n", $outFile); exit(1); } $in = fopen($download, 'rb'); if (!$in) { printf("Failed to open %s for reading\n", $download); fclose($out); exit(1); } printf('Downloading file...'); while (($data = fread($in, 4096)) !== '') { printf('.'); fwrite($out, $data); } printf("done\n"); fclose($in); fclose($out); }