    <h1><?php print _("Upgrading the Gallery Core Module") ?></h1>

    <p>
      <?php print _("The Gallery Core Module is the heart of the Gallery application.  You can upgrade most other modules using the Site Administration interface, but this module must be handled separately in order for the upgrade to go smoothly.") ?>
    </p>

    <table>
      <tr>
	<td width="175">
	  <?php print _("Currently installed") ?>
	</td>
	<td>
	  <b>
	    <?php printf(_("Core Module version: %s (Gallery %s)"), $templateData['installed']['core'], $templateData['installed']['gallery']); ?>
	  </b>
	</td>
      </tr>
      <tr>
	<td>
	  <?php print _("New version") ?>
	</td>
	<td>
	  <b>
	    <?php printf(_("Core Module version: %s (Gallery %s)"), $templateData['coreVersion'], $templateData['galleryVersion']); ?>
	  </b>
	</td>
      </tr>
      <?php if ($templateData['isConfigUpgradeRequired'] && !isset($templateData['isTryingToDowngrade'])): ?>
      <tr>
	<td>
	  <?php print _("Config.php upgrade") ?>
	</td>
	<td>
	  <b> <?php print _("Required") ?> </b>
	</td>
      </tr>
      <?php if (!$templateData['isConfigWriteable']): ?>
      <tr>
	<td colspan="2" class="error">
	  <?php printf(_("Unable to write to config.php in your %s directory.  Please change its permissions."), basename(GALLERY_CONFIG_DIR)) ?>
	  <?php if ($templateData['canChmod']) print _("You can do <i>chmod 666 config.php</i> to fix this.") ?>
	</td>
      </tr>
      <?php endif; ?>
      <?php endif; ?>
    </table>

    <?php if (isset($templateData['isTryingToDowngrade'])): ?>
    <p class="error">
      <?php print _("The installed version is newer than the version you are trying to upgrade to. You cannot downgrade G2. Please replace the gallery2 files with files from the currently installed version or later.") ?>
    </p>
    <?php else: ?>
    <p>
      <?php print _("Before you upgrade, we <b>strongly recommend</b> that you make a backup of your database!  If you fail to make a backup and something goes wrong, there is a strong possibility that we will not be able to help you recover your data!  Refer to the following example:") ?>
    </p>

    <div class="example">
    <?php if (!strncmp($templateData['storeConfig']['type'], 'mysql', 5)): ?>
      <h3> <?php print _("MySQL") ?> </h3>
      <?php printf('mysqldump -u%s -p -h %s --opt %s > %s.sql',
		   $templateData['storeConfig']['username'],
		   $templateData['storeConfig']['hostname'],
		   $templateData['storeConfig']['database'],
		   $templateData['storeConfig']['database']) ?>

    <?php elseif (!strncmp($templateData['storeConfig']['type'], 'postgres', 8)): ?>
      <h3> <?php print _("PostgreSQL") ?> </h3>
      <?php printf('pg_dump -h %s --format=t %s > %s.sql',
		   $templateData['storeConfig']['hostname'],
		   $templateData['storeConfig']['database'],
		   $templateData['storeConfig']['database']) ?>

    <?php elseif ($templateData['storeConfig']['type'] == 'oci8po'): ?>
      <h3> <?php print _("Oracle") ?> </h3>
      <?php printf('exp %s@%s file=%s.dmp full=yes',
		   $templateData['storeConfig']['username'],
		   $templateData['storeConfig']['database'],
		   $templateData['storeConfig']['database']) ?>

    <?php elseif (strstr($templateData['storeConfig']['type'], 'db2')): ?>
      <h3> <?php print _("IBM DB2") ?> </h3>
      <?php printf('db2 "backup database %s"',
		   $templateData['storeConfig']['database']) ?>

    <?php elseif (strstr($templateData['storeConfig']['type'], 'mssql')): ?>
      <h3> <?php print _("Microsoft SQL Server") ?> </h3>
      <?php printf('sqlcmd -S %s\SQLEXPRESS -e -Q "backup database %s to disk = \'%s.bkp\'"',
		   $templateData['storeConfig']['hostname'],
		   $templateData['storeConfig']['database'],
		   $templateData['storeConfig']['database']) ?>
    <?php endif; ?>
    </div>

    <p>
      <form method="post" action="<?php generateUrl('index.php?step=' . $stepNumber) ?>">
	<input type="hidden" name="confirm" value="1"/>
      </form>

      <?php print _("Once the upgrade has begun, please be patient.  If you cancel or reload the page, you may interfere with the upgrade process.") ?>
    </p>

    <div class="go">
	  <div class="btn btn-continue"><div><div><div><div><div><div><div><div>
	<?php if (!$templateData['isConfigUpgradeRequired']
		  || $templateData['isConfigWriteable']): ?>
	  <a href="javascript:document.forms[0].submit()"><?php print _('Begin Upgrade') ?></a>
	<?php else: ?>
	  <a href="<?php generateUrl('index.php?step=' . $stepNumber) ?>"><?php print _('Recheck config.php') ?></a>
	<?php endif; ?>
	  </div></div></div></div></div></div></div></div></div>
    </div>
    <?php endif; ?>
