Skip to content

Commit

Permalink
Patch script improvement
Browse files Browse the repository at this point in the history
 - added a link to go to login page after patch is done
 - added a link to go back to admin.php after patch is done
   (only appears if the file was run from admin.php)
 - general aesthetics modifications
  • Loading branch information
tajemo authored and bradymiller committed Jun 11, 2012
1 parent ae35631 commit f6d1333
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions sql_patch.php
Expand Up @@ -23,24 +23,27 @@
// Force logging off
$GLOBALS["enable_auditlog"]=0;

$EMRversion = trim(preg_replace('/\s*\([^)]*\)/', '', $GLOBALS['openemr_version']));
?>


<html>
<head>
<title>OpenEMR Database Patch</title>
<title>OpenEMR <?php echo attr($EMRversion) ?> <?php echo xlt('Database Patch'); ?></title>
<link rel='STYLESHEET' href='interface/themes/style_blue.css'>
</head>
<body>
<center>
<span class='title'>OpenEMR Database Patch</span>
<br>
</center>
<body style="color:green;">
<div style="box-shadow: 3px 3px 5px 6px #ccc; border-radius: 20px; padding: 10px 40px;background-color:#EFEFEF; width:500px; margin:40px auto">

<p style="font-weight:bold; font-size:1.8em; text-align:center">OpenEMR <?php echo text($EMRversion),' ',xlt('Database Patch'),' ',text($v_realpatch) ?></p>
<p style="font-weight:bold; text-align:center;"><?php echo xlt('Applying Patch to site'),' : ',text($_SESSION['site_id']) ?></p>


<?php
upgradeFromSqlFile('patch.sql');
flush();

echo "<font color='green'>Updating global configuration defaults...</font><br />\n";
echo '<p style="font-weight:bold; text-align:left; color:green">',xlt('Updating global configuration defaults'),'...</p>';
require_once("library/globals.inc.php");
foreach ($GLOBALS_METADATA as $grpname => $grparr) {
foreach ($grparr as $fldid => $fldarr) {
Expand All @@ -55,14 +58,23 @@
}
}

echo "<font color='green'>Updating version indicators...</font><br />\n";
echo '<p style="font-weight:bold; text-align:left;">',xlt('Updating version indicators'),'...</p>';
sqlStatement("UPDATE version SET v_realpatch = '$v_realpatch'");

echo "<p><font color='green'>Database patch finished.</font></p>\n";
echo "</body></html>\n";
exit();

?>
echo '<p style="text-align:center; font-size:1.8em;">',xlt('Database Patch'),' ',text($v_realpatch),' ',xlt('finished'),'.</p>';

echo '<p style="text-align:center; font-size:1.8em;">OpenEMR ',xlt('Version'),' = ',text($EMRversion.'('.$v_realpatch.')'),'.</p>';

echo '<p><a style="border-radius: 10px; padding:5px; width:200px; margin:0 auto; background-color:green; color:white; font-weight:bold; display:block; text-align:center;" href="index.php?site=',attr($_SESSION['site_id']).'">',xlt('Log in'),'</a></p>';

if(isset($_SERVER['HTTP_REFERER'])) {
$split = preg_split('/\//',$_SERVER['HTTP_REFERER']);
if($split[count($split) - 1] == 'admin.php')
echo '<p><a style="border-radius: 10px; padding:5px; width:200px; margin:0 auto; background-color:green; color:white; font-weight:bold; display:block; text-align:center;" href="admin.php">',xlt('Back to Admin Page'),'</a></p>';
}

?>
</div>
</body>
</html>

0 comments on commit f6d1333

Please sign in to comment.