@param \Interpro\Service\Contracts\DbCleaner

@return void
435164
public function registerCleaner(Cleaner $cleaner)
    {
        $family = $cleaner->getFamily();
        $artefact = $cleaner->getArtefact();

        if(array_key_exists($family.'_'.$artefact, $this->cleaners))
        {
            throw new ServiceException('Чистильщик пакета '.$family.'('.$artefact.') уже зарегестрирована в медиаторе!');
        }

        $this->cleaners[$family.'_'.$artefact] = $cleaner;
        $this->cleaner_by_family[$family][$artefact] = $cleaner;
        $this->cleaner_by_art[$artefact][$family] = $cleaner;
    }
1087469
protected void prepareDroppingTablesApproachScripts() throws DBCleanException
   {
      cleaningScripts.addAll(getTablesDroppingScripts());
      cleaningScripts.addAll(getDBInitializationScripts());
      cleaningScripts.addAll(getFKRemovingScripts());
      cleaningScripts.addAll(getIndexesDroppingScripts());

      committingScripts.addAll(getIndexesAddingScripts());
      committingScripts.addAll(getFKAddingScripts());
   }
589491
public function cleanupWorkspacesAfterFinalizing()
    {
        $queryBuilder = $this->getQueryBuilder();

        $constraints = [
            $queryBuilder->expr()->andX(
                $queryBuilder->expr()->eq(
                    'pid',
                    $queryBuilder->createNamedParameter(-1, \PDO::PARAM_INT)
                ),
                $queryBuilder->expr()->eq(
                    't3ver_wsid',
                    $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
                ),
                $queryBuilder->expr()->gt(
                    't3ver_id',
                    $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)
                )
            ),
        ];

        $queryBuilder->delete('tt_content')
            ->where(...$constraints)
            ->execute();
    }
20190
public function cleanup()
	{
		$conn = $this->_dbm->acquire( $this->_dbname );

		try
		{
			$date = date( 'Y-m-d H:i:00' );
			$search = new MW_Common_Criteria_SQL( $conn );
			$search->setConditions( $search->compare( '<', $this->_searchConfig['cache.expire']['code'], $date ) );

			$types = $this->_getSearchTypes( $this->_searchConfig );
			$translations = $this->_getSearchTranslations( $this->_searchConfig );
			$conditions = $search->getConditionString( $types, $translations );

			$stmt = $conn->create( str_replace( ':cond', $conditions, $this->_sql['delete'] ) );
			$stmt->bind( 1, $this->_siteid, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->execute()->finish();

			$this->_dbm->release( $conn, $this->_dbname );
		}
		catch( Exception $e )
		{
			$this->_dbm->release( $conn, $this->_dbname );
			throw $e;
		}
	}
55263
public function clear()
    {
        $this->statement = null;
        $this->clearUsingModel();

        $this->query->clear();
        $this->grammar->clear();
    }
1256337
public function flush()
    {
        $this->connect();

        $statementHandle = $this->databaseHandle->prepare('DELETE FROM "' . $this->tagsTableName . '" WHERE "context"=? AND "cache"=?');
        try {
            $statementHandle->execute([$this->context(), $this->cacheIdentifier]);
        } catch (\PDOException $exception) {
        }

        $statementHandle = $this->databaseHandle->prepare('DELETE FROM "' . $this->cacheTableName . '" WHERE "context"=? AND "cache"=?');
        try {
            $statementHandle->execute([$this->context(), $this->cacheIdentifier]);
        } catch (\PDOException $exception) {
        }
    }
68669
public static void cleanup(Driver driver) {
        try {
            DriverManager.deregisterDriver(driver);
        } catch (SQLException ex) {
            LOGGER.debug("An error occurred unloading the database driver", ex);
        } catch (Throwable unexpected) {
            LOGGER.debug("An unexpected throwable occurred unloading the database driver", unexpected);
        }
    }
70361
public static function cleanup() {
        global $CFG, $DB;

        // Delete logs older than the retention period.
        $params = [
            'retentionperiod' => time() - $CFG->task_logretention,
        ];
        $logids = $DB->get_fieldset_select('task_log', 'id', 'timestart < :retentionperiod', $params);
        self::delete_task_logs($logids);

        // Delete logs to retain a minimum number of logs.
        $sql = "SELECT classname FROM {task_log} GROUP BY classname HAVING COUNT(classname) > :retaincount";
        $params = [
            'retaincount' => $CFG->task_logretainruns,
        ];
        $classes = $DB->get_fieldset_sql($sql, $params);

        foreach ($classes as $classname) {
            $notinsql = "";
            $params = [
                'classname' => $classname,
            ];

            $retaincount = (int) $CFG->task_logretainruns;
            if ($retaincount) {
                $keeplogs = $DB->get_records('task_log', [
                        'classname' => $classname,
                    ], 'timestart DESC', 'id', 0, $retaincount);

                if ($keeplogs) {
                    list($notinsql, $params) = $DB->get_in_or_equal(array_keys($keeplogs), SQL_PARAMS_NAMED, 'p', false);
                    $params['classname'] = $classname;
                    $notinsql = " AND id {$notinsql}";
                }
            }

            $logids = $DB->get_fieldset_select('task_log', 'id', "classname = :classname {$notinsql}", $params);
            self::delete_task_logs($logids);
        }
    }
1148155
protected function cleanupMongoDB()
    {
        try {
            $this->dbh->drop();
        } catch (\MongoDB\Driver\Exception $e) {
            throw new \Exception(sprintf('Failed to drop the DB: %s', $e->getMessage()));
        }
    }
32301
private void clean(Connection conn) {
        this.selectColumns = null;
        this.isSQLLimit = false;
        this.orderBySQL = new StringBuilder();
        this.conditionSQL = new StringBuilder();
        this.paramValues.clear();
        this.excludedColumns.clear();
        this.updateColumns.clear();

        ifThen(localConnection.get() == null && conn != null,
                () -> conn.close());
    }
300474
public function uninstall_cleanup() {
        global $DB, $CFG;

        // NOTE: this is a bit brute force way - it will not trigger events and hooks properly.

        // Nuke all role assignments.
        role_unassign_all(array('component'=>'enrol_'.$this->name));

        // Purge participants.
        $DB->delete_records_select('user_enrolments', "enrolid IN (SELECT id FROM {enrol} WHERE enrol = ?)", array($this->name));

        // Purge enrol instances.
        $DB->delete_records('enrol', array('enrol'=>$this->name));

        // Tweak enrol settings.
        if (!empty($CFG->enrol_plugins_enabled)) {
            $enabledenrols = explode(',', $CFG->enrol_plugins_enabled);
            $enabledenrols = array_unique($enabledenrols);
            $enabledenrols = array_flip($enabledenrols);
            unset($enabledenrols[$this->name]);
            $enabledenrols = array_flip($enabledenrols);
            if (is_array($enabledenrols)) {
                set_config('enrol_plugins_enabled', implode(',', $enabledenrols));
            }
        }

        parent::uninstall_cleanup();
    }
45280
function cleanup()
    {
        $db = eZDB::instance();
        $db->begin();
        $db->query( "DELETE FROM ezsearch_word" );
        $db->query( "DELETE FROM ezsearch_object_word_link" );
        $db->commit();
    }
809154
private function executeStatementAndClear(): bool
    {
        $result = parent::executeStatement($this->statement);
        $this->clear();
        return $result;
    }
964298
public function cleanup()
    {
        $this->db->begin();
        $rslt = $this->db->query( 'SELECT * FROM SQLITE_MASTER' );
        $rslt->setFetchMode( PDO::FETCH_NUM );
        $rows = $rslt->fetchAll();
        foreach ( $rows as $row )
        {
            $table = $row[0];
            $this->db->exec( "DROP TABLE `$table`" );
        }
        $this->db->commit();
    }
132804
static function CleanUp()
	{
		$limit = new \DateTime('-30 minutes');
		foreach(self::$instances as $login => $player)
			if($player->awaySince && $player->awaySince < $limit) unset(self::$instances[$login]);
	}
1195143
public function cleanup_tables()
    {

        logger()->info('Performing table maintenance');

        // Prune the failed jobs table
        FailedJob::where('id', '<', (FailedJob::max('id') - 100))->delete();

        // Prune the server statuses older than a week.
        ServerStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete();

        // Prune ESI statuses older than a week
        EsiStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete();

        // Remove groups with no users
        Group::doesntHave('users')->delete();
    }
263101
protected function clear()
    {
        $this->sql      = null;
        $this->start    = null;
        $this->from     = null;
        $this->join     = null;
        $this->set      = null;
        $this->where    = null;
        $this->groupby  = null;
        $this->orderby  = null;
        $this->limit    = null;
        $this->offset   = null;
    }