add version check to acp. Now no longer directly displayed at the acp index but accessible through the System tab and viewable by any admin (no special permisison needed).

git-svn-id: file:///svn/phpbb/trunk@6347 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-09-02 13:39:21 +00:00
parent 49a94efe1f
commit f3b545bb59
3 changed files with 138 additions and 0 deletions

View file

@ -0,0 +1,40 @@
<!-- INCLUDE overall_header.html -->
<a name="maincontent"></a>
<!-- IF S_VERSION_CHECK -->
<h1>{L_VERSION_CHECK}</h1>
<p>{L_VERSION_CHECK_EXPLAIN}</p>
<!-- IF S_UP_TO_DATE -->
<div class="successbox">
<p>{L_VERSION_UP_TO_DATE_ACP}</p>
</div>
<!-- ELSE -->
<div class="errorbox">
<p>{L_VERSION_NOT_UP_TO_DATE_ACP}</p>
</div>
<!-- ENDIF -->
<fieldset>
<legend></legend>
<dl>
<dt><label>{L_CURRENT_VERSION}</label></dt>
<dd><b>{CURRENT_VERSION}</b></dd>
</dl>
<dl>
<dt><label>{L_LATEST_VERSION}</label></dt>
<dd><b>{LATEST_VERSION}</b></dd>
</dl>
</fieldset>
<!-- IF not S_UP_TO_DATE -->
{UPDATE_INSTRUCTIONS}
<br /><br />
<!-- ENDIF -->
<!-- ENDIF -->
<!-- INCLUDE overall_footer.html -->

View file

@ -0,0 +1,61 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @package acp
*/
class acp_update
{
var $u_action;
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('install');
$this->tpl_name = 'acp_update';
$this->page_title = 'ACP_UPDATE';
// Get current and latest version
$errstr = '';
$errno = 0;
$info = get_remote_file('www.phpbb.com', '/updatecheck', '30x.txt', $errstr, $errno);
if ($info === false)
{
trigger_error($errstr . adm_back_link($this->u_action));
}
$info = explode("\n", $info);
$latest_version = trim($info[0]);
$announcement_url = trim($info[1]);
$update_archive_link = 'http://www.phpbb.com/files/releases/phpBB-' . $config['version'] . '_to_' . $latest_version . '.zip';
$update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
$up_to_date = (version_compare(strtolower($config['version']), strtolower($latest_version), '<')) ? false : true;
$template->assign_vars(array(
'S_UP_TO_DATE' => $up_to_date,
'S_VERSION_CHECK' => true,
'U_ACTION' => $this->u_action,
'LATEST_VERSION' => $latest_version,
'CURRENT_VERSION' => $config['version'],
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_archive_link, $update_link),
));
}
}
?>

View file

@ -0,0 +1,37 @@
<?php
/**
*
* @package acp
* @version $Id$
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @package module_install
*/
class acp_update_info
{
function module()
{
return array(
'filename' => 'acp_update',
'title' => 'ACP_UPDATE',
'version' => '1.0.0',
'modes' => array(
'version_check' => array('title' => 'ACP_VERSION_CHECK', 'auth' => 'acl_a_', 'cat' => array('ACP_AUTOMATION')),
),
);
}
function install()
{
}
function uninstall()
{
}
}
?>