<?php
/**
* ProjectPress updater script
*
* @package ProjectPress
* @since 2.1
*/
// Starts the session.
session_start();
define('access',true);
include(dirname(dirname(__FILE__)) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');
// Checks if user is logged in; if not redirect to login page.
if($current_user->hasPermission('access_admin') != true) { pm_redirect(PM_URI . '/index.php'); }
// Enable for error checking and troubleshooting.
# display_errors();
echo '<div id="middle"><p>';
$update = new appupdate(UPDATE_SERVER,CUR_VERSION);
echo "Checking for updates... $update_server ...<br>";ob_flush();
if($update->check_for_updates()) {
echo "<br>Updates found (version ".$update->server_version.")<br>";ob_flush();
echo "<br>Building file list :<br>";ob_flush();
echo $update->print_updated_files_list();ob_flush();
echo "<br>Checking for write permisions :<br>";ob_flush();
if($update->check_if_are_writable()) {
echo "All files are writable.<br>";ob_flush();
} else {
echo "Some files are not writable.<br>";ob_flush();
}
foreach ($update->writable_files as $file=>$value) {
echo $file."=".$value."<br>";ob_flush();
}
echo "<br>Starting to update files... <br>";ob_flush();
if($update->update_files()===true) {
echo "<br>All the files where succesfuly updated. <br>";ob_flush();
} else {
echo "<br>Some errors occurred while updating the files. Please inform your IT person so that they can look into the issue. <br>";ob_flush();
}
} else {
echo "<br>No update neccesary. <br>";ob_flush();
}
echo '</p></div>';
include(PM_DIR . 'pm-includes/footer.php');