    <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 print $templateData['installed']['core'] ?>
	  </b>
	</td>
      </tr>
      <tr>
	<td>
	  <?php print _("New version") ?>
	</td>
	<td>
	  <b>
	    <?php print $templateData['coreVersion'] ?>
	  </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 examples:") ?>
    </p>

    <div class="example">
      <h3> <?php print _("MySQL") ?> </h3>
      <?php printf(_("mysqldump -u%s -p<i>YourPassword</i> --opt %s > %s.sql"),
		   $templateData['storeConfig']['username'],
		   $templateData['storeConfig']['database'],
		   $templateData['storeConfig']['database']) ?>
    </div>

    <div class="example">
      <h3> <?php print _("PostgreSQL") ?> </h3>
      <?php printf(_("pg_dump --format=t %s > %s.sql"),
		   $templateData['storeConfig']['database'],
		   $templateData['storeConfig']['database']) ?>
    </div>

    <p>
      <form method="post" action="">
	<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">
      <span class="goToNext">
	<?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; ?>
      </span>
    </div>
    <?php endif; ?>
