Given one backupid, delete completely its temp dir

If supplied, progress object should be ready to receive indeterminate
progress reports.

@param string $backupid Backup id
@param \core\progress\base $progress Optional progress reporting object
496864
static public function delete_backup_dir($backupid, \core\progress\base $progress = null) {
         $backupiddir = make_backup_temp_directory($backupid, false);
         self::clear_backup_dir($backupid, $progress);
         return rmdir($backupiddir);
     }
465342
public function deleteBackup($backupName)
    {
        Service::$log->msg('S3: deleting backup ' . $backupName);
        $destinationFile = rtrim($this->s3Config->RemotePath, '/') . '/' . $backupName;

        if ($this->s3Instance->doesObjectExist($this->s3Config->Bucket, $destinationFile)) {
            $this->s3Instance->deleteObject($this->s3Config->Bucket, $destinationFile);
        }

        Service::$log->msg('S3: backup deleted ' . $backupName);
    }
61293
public function deleteFromId( $FileUploadId){
        $rest = $this->getService( self::API_UPLOAD . $FileUploadId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
483999
private function indexLocations($contentId, ProgressBar $progress)
    {
        $locationIds = $this->getContentLocationIds($contentId);
        foreach ($locationIds as $locationId) {
            try {
                $location = $this->persistenceHandler->locationHandler()->load($locationId);
                $this->searchHandler->indexLocation($location);
            } catch (NotFoundException $e) {
                $this->logWarning($progress, "Could not load Location with id $locationId, so skipped for indexing. Full exception: " . $e->getMessage());
            }
        }
    }
915911
public function getBackupURL($backupId)
    {
        if ($this->connector->getURL() === null) {
            return 'Cannot find site URL from configuration.';
        }
        $url = $this->connector->getURL().self::VERSION.$this->connector->getSiteID().'/backups/'.$backupId.'/url';
        $params = [];
        $response = $this->connector->connecting($url, $params, 'GET');
        if (isset($response->url)) {
            return $response->url;
        }

        return $response;
    }
1190049
public function saveFileToTmpDir($fileId)
    {
        $baseTmpPath = $this->getBaseTmpPath();

        $uploader = $this->uploaderFactory->create(['fileId' => $fileId]);
        $uploader->setAllowedExtensions($this->getAllowedExtensions());
        $uploader->setAllowRenameFiles(true);
        $uploader->setFilesDispersion(true);

        $result = $uploader->save($this->mediaDirectory->getAbsolutePath($baseTmpPath));

        if (!$result) {
            throw new LocalizedException(
                __('File can not be saved to the destination folder.')
            );
        }
        /**
         * Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
         */
        $result['tmp_name'] = str_replace('\\', '/', $result['tmp_name']);
        $result['path'] = str_replace('\\', '/', $result['path']);
        $result['url'] =  $this->getBaseUrl() . $this->getFilePath($baseTmpPath, $result['file']);

        if (isset($result['file'])) {
            try {
                $relativePath = rtrim($baseTmpPath, '/') . '/' . ltrim($result['file'], '/');
                $this->coreFileStorageDatabase->saveFile($relativePath);
            } catch (\Exception $e) {
                $this->logger->critical($e);
                throw new LocalizedException(
                    __('Something went wrong while saving the file(s).')
                );
            }
        }

        return $result;
    }
1095039
public function process() {
        if ($this->progress >= self::PROGRESS_PROCESSED) {
            throw new backup_ui_exception('backupuialreadyprocessed');
        }
        $this->progress = self::PROGRESS_PROCESSED;

        if (optional_param('previous', false, PARAM_BOOL) && $this->stage->get_stage() > $this->get_first_stage_id()) {
            $this->stage = $this->initialise_stage($this->stage->get_prev_stage(), $this->stage->get_params());
            return false;
        }

        // Process the stage.
        $processoutcome = $this->stage->process();

        if ($processoutcome !== false) {
            $this->stage = $this->initialise_stage($this->stage->get_next_stage(), $this->stage->get_params());
        }

        // Process UI event after to check changes are valid.
        $this->controller->process_ui_event();
        return $processoutcome;
    }
95779
public function deleteOrganizer($organizerId)
    {
        if ($this->organizerId === $organizerId) {
            $this->apply(
                $this->createOrganizerDeletedEvent($organizerId)
            );
        }
    }
1129216
public void resetCallbacksForInProgressTasks(String workflowId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        stub.resetWorkflowCallbacks(WorkflowServicePb.ResetWorkflowCallbacksRequest.newBuilder()
                .setWorkflowId(workflowId)
                .build()
        );
    }
1035002
def finish_scan(self, scan_id):
        
        self.set_scan_progress(scan_id, 100)
        self.set_scan_status(scan_id, ScanStatus.FINISHED)
        logger.info("%s: Scan finished.", scan_id)
637878
public function delete($id)
    {
        $result = null;
        $this->hook->attach('module.backup.delete.before', $id, $this);

        if (isset($result)) {
            return $result;
        }

        $result = $this->deleteZip($id);

        if ($result) {
            $this->db->delete('backup', array('backup_id' => $id));
        }

        $this->hook->attach('module.backup.delete.after', $id, $result, $this);
        return (bool) $result;
    }
148770
private synchronized void compareProgress(List<Long> processIds) {
        if (CollectionUtils.isEmpty(processIds) == false) {
            Long minProcessId = processIds.get(0);
            // 对比一下progress中的记录，如果小于当前最小的processId，直接删除内存中的记录
            // 因为发生跨机器调用或者出现restart指令，对应的process记录不会被删除
            for (Long processId : progress.keySet()) {
                if (processId < minProcessId) {
                    progress.remove(processId);
                }
            }
        }
    }
1008291
public static function move_annotations_to_final($backupid, $itemname, \core\progress\base $progress) {
        global $DB;
        $progress->start_progress('move_annotations_to_final');
        $rs = $DB->get_recordset('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
        $progress->progress();
        foreach($rs as $annotation) {
            // If corresponding 'itemfinal' annotation does not exist, update 'item' to 'itemfinal'
            if (! $DB->record_exists('backup_ids_temp', array('backupid' => $backupid,
                                                              'itemname' => $itemname . 'final',
                                                              'itemid' => $annotation->itemid))) {
                $DB->set_field('backup_ids_temp', 'itemname', $itemname . 'final', array('id' => $annotation->id));
            }
            $progress->progress();
        }
        $rs->close();
        // All the remaining $itemname annotations can be safely deleted
        $DB->delete_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => $itemname));
        $progress->end_progress();
    }
632909
public function deleteFromId( $CallId){
        $rest = $this->getService( self::API_CALL_LOG . $CallId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
1268925
public function deleteTask($taskId)
    {
        if ($taskId instanceof Tasks) {
            $taskId = $taskId->id;
        }

        $this->service->tasks->delete($this->tasklist, $taskId);
    }
1275390
public function execute() {
        if ($this->progress >= self::PROGRESS_EXECUTED) {
            throw new backup_ui_exception('backupuialreadyexecuted');
        }
        if ($this->stage->get_stage() < self::STAGE_FINAL) {
            throw new backup_ui_exception('backupuifinalisedbeforeexecute');
        }
        $this->progress = self::PROGRESS_EXECUTED;
        $this->controller->finish_ui();
        $this->controller->execute_plan();
        $this->stage = new backup_ui_stage_complete($this, $this->stage->get_params(), $this->controller->get_results());
        return true;
    }
1013492
public static function backup_includes_file_references($backupid) {
        global $CFG, $DB;

        $sql = "SELECT count(r.repositoryid)
                  FROM {files} f
                  LEFT JOIN {files_reference} r
                       ON r.id = f.referencefileid
                  JOIN {backup_ids_temp} bi
                       ON f.id = bi.itemid
                 WHERE bi.backupid = ?
                       AND bi.itemname = 'filefinal'";
        $count = $DB->count_records_sql($sql, array($backupid));
        return (int)(bool)$count;
    }