Tell MP about all deleted LPs that previously existed on locations which
have also been deleted.
767970
private void deleteDestLocalizations(JsBus bus) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "deleteDestLocalizations", this);
        }

        Iterator i = alterDestinations.iterator();

        while (i.hasNext()) {

            String key = (String) i.next();

            try {
                // Get it from the old cache as it is no longer in the new cache.
                DestinationDefinition dd = (DestinationDefinition) _me.getSIBDestination(bus.getName(), key);
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    SibTr.debug(tc, "deleteDestLocalizations: deleting DestinationLocalization, name =" + key + " Name=");
                }
                if (!isInZOSServentRegion() && _mpAdmin != null) {
                	LocalizationEntry dldEntry = (LocalizationEntry) lpMap.get(dd.getName()+"@"+_me.getName());
                	LocalizationDefinition dld=(LocalizationDefinition) dldEntry.getLocalizationDefinition();
                	
                    //Venu Liberty change: passing Destination UUID as String.
                    //Destination Definition is passed as NULL as entire destination has to be deleted
                    _mpAdmin.deleteDestinationLocalization(dd.getUUID().toString(), null);  
                }
               
            } catch (Exception e) {
                com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".deleteDestLocalizations", "1", this);
                SibTr.exception(tc, e);
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, "deleteDestLocalizations");
        }
    }
793140
def _storage_purge_all(delete=False, verbosity=0):
    """"""
    orphaned_storages = Storage.objects.filter(data=None)

    if verbosity >= 1:
        if orphaned_storages.exists():
            logger.info(__("Unreferenced storages ({}):", orphaned_storages.count()))
            for storage_id in orphaned_storages.values_list('id', flat=True):
                logger.info(__("  {}", storage_id))
        else:
            logger.info("No unreferenced storages")

    if delete:
        orphaned_storages.delete()
77554
def relocated_record(self):
        # type: () -> bool
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Rock Ridge extension not yet initialized')

        return self.dr_entries.re_record is not None or self.ce_entries.re_record is not None
98885
def remove_expired_multipartobjects():
    """"""
    delta = current_app.config['FILES_REST_MULTIPART_EXPIRES']
    expired_dt = datetime.utcnow() - delta

    file_ids = []
    for mp in MultipartObject.query_expired(expired_dt):
        file_ids.append(str(mp.file_id))
        mp.delete()

    for fid in file_ids:
        remove_file_data.delay(fid)
1170770
def ndeleted(self):
        """"""
        if not self._counters_calculated:
            self._counters_calculated = True
            self._extract_counters()

        return self._ndeleted
285919
def fix_ofiles(self):
        
        filepaths = self.outdir.list_filepaths()
        #logger.info("in fix_ofiles with filepaths %s" % list(filepaths))

        old2new = FilepathFixer().fix_paths(filepaths)

        for old, new in old2new.items():
            self.history.info("will rename old %s to new %s" % (old, new))
            os.rename(old, new)
828163
def _location_purge_all(delete=False, verbosity=0):
    """"""
    if DataLocation.objects.exists():
        for location in DataLocation.objects.filter(Q(purged=False) | Q(data=None)):
            location_purge(location.id, delete, verbosity)
    else:
        logger.info("No data locations")
34388
def delete_orphaned_files(modeladmin, request, queryset=None):
    
    
    execute = request.POST.get('execute')
    
    storage = get_media_storage()
    broken_node_links = []
    orphaned_files_choices = []

    broken_nodes, orphaned_files = get_broken_media()

    for node in broken_nodes:
        link = mark_safe('<a href="%s">%s</a>' % (node.get_admin_url(), node.__unicode__()))
        broken_node_links.append(link)

    for storage_name in orphaned_files:
        file_path = storage.path(storage_name)
        link = mark_safe('<a href="%s">%s</a>' % (
            storage.url(storage_name), file_path))
        orphaned_files_choices.append((storage_name, link))

    if not len(orphaned_files_choices) and not len(broken_node_links):
        messages.success(request, message=_('There are no orphaned files.'))
        return HttpResponseRedirect('')

    if execute:
        form = DeleteOrphanedFilesForm(queryset, orphaned_files_choices, request.POST)
        if form.is_valid():
            form.save()
            node = FileNode.get_top_node()
            messages.success(request, message=ungettext('Deleted %i file from storage.', 'Deleted %i files from storage.', len(form.success_files)) % len(form.success_files))
            if form.error_files:
                messages.error(request, message=_('The following files could not be deleted from storage:')+' '+repr(form.error_files))
            return HttpResponseRedirect(node.get_admin_url())

    if not execute:
        if len(orphaned_files_choices) > 0:
            form = DeleteOrphanedFilesForm(queryset, orphaned_files_choices)
        else:
            form = None

    c = get_actions_context(modeladmin)
    c.update({
        'title': _('Orphaned files'),
        'submit_label': _('Delete selected files'),
        'form': form,
        'select_all': 'selected_files',
        'node_list_title': _('The following files in the database do not exist in storage. You should fix these media objects:'),
        'node_list': broken_node_links,
    })
    return render_to_response('admin/media_tree/filenode/actions_form.html', c, context_instance=RequestContext(request))
661059
def deleted(self, deleted_since, filters=None, params=None):
        

        return self.tc_requests.deleted(
            self.api_type,
            self.api_sub_type,
            deleted_since,
            owner=self.owner,
            filters=filters,
            params=params,
        )
979627
def songs_delete(self, songs):
		

		mutations = [mc_calls.TrackBatch.delete(song['id']) for song in songs]
		response = self._call(
			mc_calls.TrackBatch,
			mutations
		)

		success_ids = [
			res['id']
			for res in response.body['mutate_response']
			if res['response_code'] == 'OK'
		]

		# TODO: Report failures.
		# failure_ids = [
		# 	res['id']
		# 	for res in response.body['mutate_response']
		# 	if res['response_code'] != 'OK'
		# ]

		return success_ids
79127
private void doFindFiles() throws IOException {
    Set<FileSystem> allFs = new HashSet<FileSystem>();
    Set<Path> filesToFix = new HashSet<Path>();      // files that are yet to be fixed

    // collect all unique filesystems in all policies.
    for (PolicyInfo pinfo: all) {
      FileSystem fs = getFs(pinfo.getConf(), pinfo.getSrcPath());
      if (fs != null) {
        allFs.add(fs);
      }
      for (PathInfo d:pinfo.getDestPaths()) {
        fs = getFs(pinfo.getConf(), d.rpath);
        if (fs != null) {
          allFs.add(fs);
        }
      }
    }

    // make a RPC to all relevant namenodes to find corrupt files
    for (FileSystem fs:allFs) {
      if (!running) break;
      List<Path> corruptFiles = null;

      corruptFiles = getCorruptFilesFromNamenode(fs);

      // if we are not already fixing this one, then put it in the list
      // of files that need fixing.
      for (Path p : corruptFiles) {
        if (filesBeingFixed.add(p)) {
           filesToFix.add(p);
        }
      }
    }

    if (!filesToFix.isEmpty()) {
      LOG.info("Found " + filesToFix.size() + " corrupt files.");
    }

    for (Path path: filesToFix) {
      if (!running) break;
      try {
        fixFile(path);
      } catch (IOException ie) {
        LOG.error("Error while processing " + path +
          ": " + StringUtils.stringifyException(ie));
        // For certain kinds of errors, it might be good if we remove
        // this file from filesBeingFixed, so that the file-fix gets
        // attemted in the immediate next iteration. For example, if
        // we get a network Exception, we can retry immediately. On 
        // the other hand, if we get a file length mismatch exception
        // then no amount of retry will fix it, so it is better to 
        // retry less frequently.
      }
    }
  }
1331924
def clean_perms(self):
        """"""
        logging.info('Cleaning faulty perms')
        sesh = self.get_session
        pvms = (
            sesh.query(ab_models.PermissionView)
            .filter(or_(
                ab_models.PermissionView.permission == None,  # NOQA
                ab_models.PermissionView.view_menu == None,  # NOQA
            ))
        )
        deleted_count = pvms.delete()
        sesh.commit()
        if deleted_count:
            logging.info('Deleted {} faulty permissions'.format(deleted_count))
573248
def remove_old_tmp_files(profiles=None, max_lifetime=(7 * 24)):
    
    assert isinstance(profiles, (list, tuple)) or profiles is None
    if profiles is None:
        profiles = dju_settings.DJU_IMG_UPLOAD_PROFILES.keys()
    profiles = set(('default',) + tuple(profiles))
    total = removed = 0
    old_dt = datetime.datetime.utcnow() - datetime.timedelta(hours=max_lifetime)
    for profile in profiles:
        conf = get_profile_configs(profile=profile)
        root_path = os.path.join(settings.MEDIA_ROOT, dju_settings.DJU_IMG_UPLOAD_SUBDIR, conf['PATH'])
        for file_path in get_files_recursive(root_path):
            m = re_tmp.match(os.path.basename(file_path))
            if m is None:
                continue
            total += 1
            fdt = dtstr_to_datetime(m.group('dtstr'))
            if fdt and old_dt > fdt:
                os.remove(file_path)
                removed += 1
    return removed, total
1018816
public static function cleanupNotRemovedFiles()
    {
        $timeOneWeekAgo = strtotime('-1 week');

        $files = _glob(self::getTmpPath() . '/*');
        if (empty($files)) {
            return;
        }

        foreach ($files as $file) {
            if (file_exists($file)) {
                $timeLastModified = filemtime($file);

                if ($timeLastModified !== false && $timeOneWeekAgo > $timeLastModified) {
                    unlink($file);
                }
            }
        }
    }
890928
def history(directory, rev_range, verbose, indicate_current):
    """"""
    _history(directory, rev_range, verbose, indicate_current)
455042
public void endRecord_() {
    // this is where we actually update the link database. basically,
    // all we need to do is to retract those links which weren't seen
    // this time around, and that can be done via assertLink, since it
    // can override existing links.

    // get all the existing links
    Collection<Link> oldlinks = linkdb.getAllLinksFor(getIdentity(current));

    // build a hashmap so we can look up corresponding old links from
    // new links
    if (oldlinks != null) {
      Map<String, Link> oldmap = new HashMap(oldlinks.size());
      for (Link l : oldlinks)
        oldmap.put(makeKey(l), l);

      // removing all the links we found this time around from the set of
      // old links. any links remaining after this will be stale, and need
      // to be retracted
      for (Link newl : new ArrayList<Link>(curlinks)) {
        String key = makeKey(newl);
        Link oldl = oldmap.get(key);
        if (oldl == null)
          continue;

        if (oldl.overrides(newl))
          // previous information overrides this link, so ignore
          curlinks.remove(newl);
        else if (sameAs(oldl, newl)) {
          // there's no new information here, so just ignore this
          curlinks.remove(newl);
          oldmap.remove(key); // we don't want to retract the old one
        } else
          // the link is out of date, but will be overwritten, so remove
          oldmap.remove(key);
      }

      // all the inferred links left in oldmap are now old links we
      // didn't find on this pass. there is no longer any evidence
      // supporting them, and so we can retract them.
      for (Link oldl : oldmap.values())
        if (oldl.getStatus() == LinkStatus.INFERRED) {
          oldl.retract(); // changes to retracted, updates timestamp
          curlinks.add(oldl);
        }
    }

    // okay, now we write it all to the database
    for (Link l : curlinks)
      linkdb.assertLink(l);
  }
272373
public function deleteDirs()
    {
        $dirs = $this->files->directories($this->basePath);

        foreach ($dirs as $dir) {
            $this->files->deleteDirectory($dir);
        }

        $this->info('Subdirectories deleted');
    }