                                                                                                                                                                                    

<?php
//-->-->-->-->-->-->-->-->-->-->-->-->-->-->

  include "/home/waggacwc/public_html/refurb/RETRO-GLOBALS.php";

  include "$LIBRARYPATH/RETROVOX-CONSTANT-VARIABLES.php";
  include "$LIBRARYPATH/fnRetrovoxStartHtml.php";

  $bNewFile = false;
  $sDataFolderPath = $DATAPATH;
  $sCodeFolderPath = $WEBDOCUMENTROOT.$MANAGEMENTWEBFOLDER;

  $sBackupFolder = $BACKUPZIPS;
  $sCodeBackupFileName = "manage-dir.tar.gz";
  $sDataBackupFileName = "product-data-dir.tar.gz";

  //$sCodeBackupFileName = "manage.zip";
  //$sDataBackupFileName = "product-data.zip";

  if (file_exists($sCodeBackupFileName))
  {
    unlink($sCodeBackupFileName);
  }

  if (file_exists($sDataBackupFileName))
  {
    unlink($sDataBackupFileName);
  }
  
  //Test if shell execs are possible
  //$sCommandResult = shell_exec('ls -la'); 

  $sCommandResult = 
     shell_exec('tar -zcvf '.$sCodeBackupFileName.' '.$sCodeFolderPath.' 2>&1');
  $sCommandResult = $sCommandResult.
     shell_exec('tar -zcvf '.$sDataBackupFileName.' '.$sDataFolderPath.' 2>&1');

  //$sCommandResult = 
  //   shell_exec('zip -uSr '.$sCodeBackupFileName.' '.$sCodeFolderPath.' 2>&1');
  //$sCommandResult = $sCommandResult.
  //   shell_exec('zip -uSr '.$sDataBackupFileName.' '.$sDataFolderPath.' 2>&1');

  //$sCommandResult = 
  //   shell_exec('c:\tools\infozip\zip\zip.exe -Sr c:\apache2\htdocs\ideas\manage c:\apache2\htdocs\ideas\manage 2>&1');
  //$sCommandResult = $sCommandResult.
  //   shell_exec('c:\tools\infozip\zip\zip.exe -Sr c:\apache2\htdocs\ideas\product-data c:\apache2\htdocs\ideas\product-data 2>&1');

//--<--<--<--<--<--<--<--<--<--<--<--<--<--<
?>

<?=fnRetrovoxStartHtml("The $ORGANISATIONNAME code and data folders have been backed up")?>

  <strong>The <?=ORGANISATIONNAME?> code:</strong>
    <br>&nbsp;&nbsp;<em><?=$sCodeFolderPath?></em> 
  <strong>and the Retrovox data:</strong>
    <br>&nbsp;&nbsp;<em><?=$sDataFolderPath?></em> 
  <br><strong>should have been backed up to the files:</strong>
    <br><a href = '../<?=$sCodeBackupFileName?>'><?=$sCodeBackupFileName?></a>
    <br><a href = '../<?=$sDataBackupFileName?>'><?=$sDataBackupFileName?></a>
  <br>
  The backup command returned the following messages (if these messages
  only contain a list of file names, then the backup worked).
  <br>
  <pre>
    <?=htmlspecialchars($sCommandResult)?>
  </pre>
</body>
</html>



                                                                                                                                                                                    