remvove all of the posts/pages in the trash area in one go
491859
def empty_articles
      type = params[:format]
      Post.where(:disabled => 'Y', :post_type => type).destroy_all

      redirect_to admin_trash_path, notice: I18n.t("controllers.admin.trash.empty_posts.flash.success", type: type)
    end
182661
def _cleanup(path: str) -> None:
    """"""
    if os.path.isdir(path):
        shutil.rmtree(path)
1268249
public function flush()
    {
        $insert = array();
        $update = array();
        $delete = array();

        // fill batch objects
        foreach ($this->pool as $document) {
            /* @var $document \Sokil\Mongo\Document */

            // collection
            $collection = $document->getCollection();
            $collectionName = $collection->getName();

            // persisting
            switch ($this->pool->offsetGet($document)) {
                case self::STATE_SAVE:
                    if ($document->isStored()) {
                        if (!isset($update[$collectionName])) {
                            $update[$collectionName] = new \MongoUpdateBatch($collection->getMongoCollection());
                        }
                        $update[$collectionName]->add(array(
                            'q' => array(
                                '_id' => $document->getId(),
                            ),
                            'u' => $document->getOperator()->toArray(),
                        ));
                    } else {
                        if (!isset($insert[$collectionName])) {
                            $insert[$collectionName] = new \MongoInsertBatch($collection->getMongoCollection());
                        }
                        $insert[$collectionName]->add($document->toArray());
                    }
                    break;

                case self::STATE_REMOVE:
                    // delete document form db
                    if ($document->isStored()) {
                        if (!isset($delete[$collectionName])) {
                            $delete[$collectionName] = new \MongoDeleteBatch($collection->getMongoCollection());
                        }
                        $delete[$collectionName]->add(array(
                            'q' => array(
                                '_id' => $document->getId(),
                            ),
                            'limit' => 1,
                        ));
                    }
                    // remove link form pool
                    $this->detach($document);
                    break;
            }
        }

        // write operations
        $writeOptions = array('w' => 1);
        
        // execute batch insert operations
        if ($insert) {
            foreach ($insert as $collectionName => $collectionInsert) {
                $collectionInsert->execute($writeOptions);
            }
        }

        // execute batch update operations
        if ($update) {
            foreach ($update as $collectionName => $collectionUpdate) {
                $collectionUpdate->execute($writeOptions);
            }
        }

        // execute batch delete operations
        if ($delete) {
            foreach ($delete as $collectionName => $collectionDelete) {
                $collectionDelete->execute($writeOptions);
            }
        }

        return $this;
    }
763711
function cleanOutputDir(done) {
			var htmlDemoFileMask = path.join(o.destCss, o.fontBaseName + '*.{css,html}');
			var files = glob.sync(htmlDemoFileMask).concat(wf.generatedFontFiles(o));
			async.forEach(files, function(file, next) {
				fs.unlink(file, next);
			}, done);
		}
24765
def cleanup(self):
        ''' '''
        allList = []
        allList.extend(self.cur.execute("SELECT keywordid FROM keyword;"))
        usedList = []
        usedList.extend(self.cur.execute("SELECT keywordid FROM notekeyword;"))
        unusedList = [val for val in allList if val not in usedList]
        for key in unusedList:
            if self.debug:
                print("About to delete keyword with ID %s" % key)
            try:
                self.cur.execute("DELETE FROM keyword WHERE keywordId = ?;", key)
            except:
                self.error("There was a problem deleting keyword %s" % key)
        self.con.commit()
1196280
function clean(post) {
  return reject({
    title: post.title,
    contentFormat: post.contentFormat,
    content: post.content,
    tags: post.tags,
    canonicalUrl: post.canonicalUrl,
    publishStatus: post.publishStatus,
    license: post.license
  });
}
380965
@Override
    protected void cleanUp() {

        m_pageStorage = null;
        m_folderStorage = null;
        m_webAppNames = null;
        m_webappUrl = null;
        super.cleanUp();
    }
21553
public static function cleanupRemovedItems()
    {
        $db = eZDB::instance();
        // Find items that have been moved to trash or deleted
        $itemArray = array();
        $offset = 0;
        $limit = 50;
        do
        {
            $items = $db->arrayQuery( 'SELECT node_id FROM ezm_pool', array( 'offset' => $offset, 'limit' => $limit ) );
            if ( empty( $items ) )
                break;

            foreach( $items as $item )
            {
                $rows = $db->arrayQuery( 'SELECT node_id FROM ezcontentobject_tree WHERE node_id = ' . $item['node_id'] );
                if ( empty( $rows ) )
                    $itemArray[] = $item['node_id'];
            }

            $offset += $limit;
        } while ( true );

        // Remove them all from the flow
        $itemArrayCount = count( $itemArray );
        if ( $itemArrayCount > 0 )
        {
            $db->begin();
            $db->query( 'DELETE FROM ezm_pool WHERE ' . $db->generateSQLINStatement( $itemArray, 'node_id' ) );
            $db->commit();
        }

        return $itemArrayCount;
    }
441631
async def stop_pages(self):
        """"""
        await self.bot.delete_message(self.message)
        self.paginating = False
1236743
def _cleanup(self):
        """"""
        for filename in os.listdir(self._storage_dir):
            file_path = path.join(self._storage_dir, filename)
            file_stat = os.stat(file_path)
            evaluate = max(file_stat.st_ctime, file_stat.st_mtime)
            if evaluate + self._duration < time.time():
                LOGGER.debug('Removing stale file: %s', file_path)
                os.unlink(file_path)
1131483
function destroy(req, res, next) {
  db.posts.del(req.params.post, function(err) {
    if(err) { return next(err); }
    res.json(null);
    signals.emit('post:destroy', req.params.post);
  });
}
987833
function erase() {
		$this->query=array_slice($this->query,0,$this->ptr,TRUE)+
			array_slice($this->query,$this->ptr,NULL,TRUE);
		$this->skip(0);
	}
1285120
def purge(context, resource, **kwargs):
    """"""
    uri = '%s/%s/purge' % (context.dci_cs_api, resource)
    if 'force' in kwargs and kwargs['force']:
        r = context.session.post(uri, timeout=HTTP_TIMEOUT)
    else:
        r = context.session.get(uri, timeout=HTTP_TIMEOUT)
    return r
979196
function filterFolder(posts) {
      var reFolder = new RegExp(folder);
      return posts.filter(function filterPosts(post) {
        return reFolder.test(post.source.substr(0, post.source.lastIndexOf(path.sep)));
      });
    }
499082
public static void cleanObsolete() {
        HandlerThreadFactory.getWriteLogThreadHandler().post(new Runnable() {
            @Override
            public void run() {
                long now = System.currentTimeMillis();
                File[] f = BlockCanaryInternals.getLogFiles();
                if (f != null && f.length > 0) {
                    synchronized (SAVE_DELETE_LOCK) {
                        for (File aF : f) {
                            if (now - aF.lastModified() > OBSOLETE_DURATION) {
                                aF.delete();
                            }
                        }
                    }
                }
            }
        });
    }
931807
def purge(root=os.path.join(base.data_dir(), 'models')):
    
    """
    root = os.path.expanduser(root)
    files = os.listdir(root)
    for f in files:
        if f.endswith(".params"):
            os.remove(os.path.join(root, f))
1034359
def cleanup():
    """"""
    if _output_dir and os.path.exists(_output_dir):
        log.msg_warn("Cleaning up output directory at '{output_dir}' ..."
                     .format(output_dir=_output_dir))
        if not _dry_run:
            shutil.rmtree(_output_dir)