Skip to content

Commit

Permalink
Update import script to ignore sandbox mode if not available
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnoble73 committed Jun 11, 2024
1 parent 7be5191 commit 050c3ea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion code/web/cron/importAspenBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,19 @@
if ($exportFile != '.' && $exportFile != '..' && is_file($sqlBackupDir . $exportFile)) {
/** @noinspection PhpStrFunctionsInspection */
if (strpos($exportFile, ".sql") > 0 && strpos($exportFile, 'mysql') === false) {
// Trimming the first two lines of the file
$filePath = $sqlBackupDir . $exportFile;
$fhnd = fopen($filePath, 'r');
$line = fgets($fhnd);
fclose($fhnd);

echo("Importing $exportFile\n");
$importCommand = "mysql -u$dbUser -p$dbPassword -h$dbHost -P$dbPort $dbName < $sqlBackupDir$exportFile";
if (strpos($line, "/*!999999\- enable the sandbox mode") === 0){
$importCommand = "mysql -u$dbUser -p$dbPassword -h$dbHost -P$dbPort -D $dbName --force < $sqlBackupDir$exportFile";
}else{
$importCommand = "mysql -u$dbUser -p$dbPassword -h$dbHost -P$dbPort $dbName < $sqlBackupDir$exportFile ";
}

$results = [];
exec($importCommand, $results);
echo(implode("\n", $results));
Expand Down
5 changes: 4 additions & 1 deletion code/web/release_notes/24.05.02.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
- Correct indexing Polaris Items when new items are found that have not been indexed previously. (*MDN*)

### Symphony Updates
- Immediately delete MARC files after they have been processed. (Ticket 128804) (*MDN*)
- Immediately delete MARC files after they have been processed. (Ticket 128804) (*MDN*)

### Other Updates
- Update import script to ignore sandbox mode if not available. (*MDN*)

## This release includes code contributions from
- ByWater Solutions
Expand Down

0 comments on commit 050c3ea

Please sign in to comment.