Example #1
0
 // Wrong format
 //
 $sBackupFile = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'file_name_format', BACKUP_DEFAULT_FORMAT);
 $oBackup = new DBBackupScheduled();
 $sZipName = $oBackup->MakeName($sBackupFile);
 if ($sZipName == '') {
     $oP->p($sImgError . Dict::Format('bkp-wrong-format-spec', $sBackupFile, BACKUP_DEFAULT_FORMAT));
 } else {
     $oP->p(Dict::Format('bkp-name-sample', $sZipName));
 }
 // Week Days
 //
 $aWeekDayToString = array(1 => Dict::S('DayOfWeek-Monday'), 2 => Dict::S('DayOfWeek-Tuesday'), 3 => Dict::S('DayOfWeek-Wednesday'), 4 => Dict::S('DayOfWeek-Thursday'), 5 => Dict::S('DayOfWeek-Friday'), 6 => Dict::S('DayOfWeek-Saturday'), 7 => Dict::S('DayOfWeek-Sunday'));
 $aDayLabels = array();
 $oBackupExec = new BackupExec();
 foreach ($oBackupExec->InterpretWeekDays() as $iDay) {
     $aDayLabels[] = $aWeekDayToString[$iDay];
 }
 $sDays = implode(', ', $aDayLabels);
 $sBackupTime = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'time', '23:30');
 $oP->p(Dict::Format('bkp-week-days', $sDays, $sBackupTime));
 $iRetention = MetaModel::GetConfig()->GetModuleSetting('itop-backup', 'retention_count', 5);
 $oP->p(Dict::Format('bkp-retention', $iRetention));
 $oP->add("</fieldset>");
 // List of backups
 //
 $aFiles = $oBackup->ListFiles($sBackupDirAuto);
 $aFilesToDelete = array();
 while (count($aFiles) > $iRetention - 1) {
     $aFilesToDelete[] = array_shift($aFiles);
 }