Delete a compiled for all environment
@throws Server500
@throws \Exception
329307
private function deleteAllCompiled()
    {
        $env = array("dev", "prod");
        Output::displayAsSuccess("Hey, I delete compiled for all environment", "none");
        for ($i = 0; $i < count($env); $i++) {
            $this->callDelCreaServer($env[$i]);
        }
        if (in_array("--noexit", $this->options["options"])) {
            Output::displayAsEndSuccess("Compiled was deleted for all environment.", "none");
        } else {
            Output::displayAsNormal("Compiled was deleted for all environment.");
        }
    }
415867
protected function cleanup(): void
    {
        $this->output->writeln('');
        $this->output->write('Cleaning up... ');
        $this->output->writeln('');
        $this->output->writeln('');

        $projectDir = $this->getContainer()->getParameter('kernel.project_dir');

        try {
            $fileSystem = $this->getContainer()->get('filesystem');

            if (
                $fileSystem->exists($projectDir . '/.git') &&
                $this->questionHelper->ask(
                    $this->input,
                    $this->output,
                    $this->getConfirmationQuestion(
                        'Do you want to delete the <comment>.git</comment> folder?',
                        true
                    )
                )
            ) {
                $fileSystem->remove($projectDir . '/.git');
            }
        } catch (Exception $e) {
            // Do nothing
        }
    }
1088833
public function _delete()
	{
		if ( empty( $this->_instance_name ) ) 
		{
			throw new CCException("CCConfig::write - configuration name is missing.");
		}
		
		return $this->_driver->delete( $this->_instance_name );
	}
1166385
public function delete()
    {
        if (!file_exists($this->path)) {
            throw new \Exception(
                "Can't delete something unexisting : " . $this->path,
                1
            );
        }

        if (is_dir($this->path)){
            $iterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator(
                    $this->path,
                    \RecursiveDirectoryIterator::SKIP_DOTS
                ),
                \RecursiveIteratorIterator::CHILD_FIRST
            );

            foreach ($iterator as $file) {
                if ($file->isDir()) {
                    rmdir($file->getPathname());
                    continue;
                }
                unlink($file->getPathname());
            }
            rmdir($this->path);
            return;
        }

        unlink($this->path);
    }
1086352
public function uninstall_cleanup() {
        global $DB, $CFG;

        $DB->delete_records('filter_active', array('filter' => $this->name));
        $DB->delete_records('filter_config', array('filter' => $this->name));

        if (empty($CFG->filterall)) {
            $stringfilters = array();
        } else if (!empty($CFG->stringfilters)) {
            $stringfilters = explode(',', $CFG->stringfilters);
            $stringfilters = array_combine($stringfilters, $stringfilters);
        } else {
            $stringfilters = array();
        }

        unset($stringfilters[$this->name]);

        set_config('stringfilters', implode(',', $stringfilters));
        set_config('filterall', !empty($stringfilters));

        parent::uninstall_cleanup();
    }
585350
private void deleteAllConfiguredApplications() {
        try {
            Configuration[] configs = configAdmin.listConfigurations("(&(service.factoryPid=" + AppManagerConstants.APPLICATIONS_PID + ")("
                                                                     + AppManagerConstants.AUTO_INSTALL_PROP + "=true))");
            if (configs != null) {
                for (Configuration c : configs) {
                    try {
                        c.delete();
                    } catch (Exception e) {
                        // Move on, but FFDC
                    }
                }
            }
        } catch (IOException e) {
            // Hmm, I guess this is a bad place to be, not sure what to do. I guess I just FFDC and move on.
            // A clean start will fix this issue.
        } catch (InvalidSyntaxException e) {
            // This should never happen, if it does we want the FFDC
        }
    }
906541
public function actionDelete()
    {
        
        $this->outVerbose("Deleting language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "' ...");
    	
    	$dir = $this->buildLanguagePath($this->options['extension'], $this->options['language']);
        if (!tao_helpers_File::remove($dir, true)) {
        	$this->err("Could not delete language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "'.", true);	
        }
        
        $this->outVerbose("Language '" . $this->options['language'] . "' for extension '" . $this->options['extension'] . "' successfully deleted.");
        
    }
60132
protected function deleteMultiple(array $environments, InputInterface $input, OutputInterface $output)
    {
        // Confirm which environments the user wishes to be deleted.
        $delete = [];
        $deactivate = [];
        $error = false;
        /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
        $questionHelper = $this->getService('question_helper');
        foreach ($environments as $environment) {
            $environmentId = $environment->id;
            if ($environmentId == 'master') {
                $output->writeln("The <error>master</error> environment cannot be deleted.");
                $error = true;
                continue;
            }
            // Check that the environment does not have children.
            // @todo remove this check when Platform's behavior is fixed
            foreach ($this->api()->getEnvironments($this->getSelectedProject()) as $potentialChild) {
                if ($potentialChild->parent == $environment->id) {
                    $output->writeln(
                        "The environment <error>$environmentId</error> has children and therefore can't be deleted."
                    );
                    $output->writeln("Please delete the environment's children first.");
                    $error = true;
                    continue 2;
                }
            }
            if ($environment->isActive()) {
                $output->writeln("The environment <comment>$environmentId</comment> is currently active: deleting it will delete all associated data.");
                if ($questionHelper->confirm("Are you sure you want to delete the environment <comment>$environmentId</comment>?")) {
                    $deactivate[$environmentId] = $environment;
                    if (!$input->getOption('no-delete-branch')
                        && $this->shouldWait($input)
                        && ($input->getOption('delete-branch')
                            || (
                                $input->isInteractive()
                                && $questionHelper->confirm("Delete the remote Git branch too?")
                            )
                        )) {
                        $delete[$environmentId] = $environment;
                    }
                }
            } elseif ($environment->status === 'inactive') {
                if ($questionHelper->confirm("Are you sure you want to delete the remote Git branch <comment>$environmentId</comment>?")) {
                    $delete[$environmentId] = $environment;
                }
            } elseif ($environment->status === 'dirty') {
                $output->writeln("The environment <error>$environmentId</error> is currently building, and therefore can't be deleted. Please wait.");
                $error = true;
                continue;
            }
        }

        $deactivateActivities = [];
        $deactivated = 0;
        /** @var Environment $environment */
        foreach ($deactivate as $environmentId => $environment) {
            try {
                $output->writeln("Deleting environment <info>$environmentId</info>");
                $deactivateActivities[] = $environment->deactivate();
                $deactivated++;
            } catch (\Exception $e) {
                $output->writeln($e->getMessage());
            }
        }

        if ($this->shouldWait($input)) {
            /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */
            $activityMonitor = $this->getService('activity_monitor');
            if (!$activityMonitor->waitMultiple($deactivateActivities, $this->getSelectedProject())) {
                $error = true;
            }
        }

        $deleted = 0;
        foreach ($delete as $environmentId => $environment) {
            try {
                if ($environment->status !== 'inactive') {
                    $environment->refresh();
                    if ($environment->status !== 'inactive') {
                        $output->writeln("Cannot delete branch <error>$environmentId</error>: it is not (yet) inactive.");
                        continue;
                    }
                }
                $environment->delete();
                $output->writeln("Deleted remote Git branch <info>$environmentId</info>");
                $deleted++;
            } catch (\Exception $e) {
                $output->writeln($e->getMessage());
            }
        }

        if ($deleted > 0) {
            $output->writeln("Run <info>git fetch --prune</info> to remove deleted branches from your local cache.");
        }

        if ($deleted < count($delete) || $deactivated < count($deactivate)) {
            $error = true;
        }

        if (($deleted || $deactivated || $error) && isset($environment)) {
            $this->api()->clearEnvironmentsCache($environment->project);
        }

        return !$error;
    }
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()));
        }
    }
328271
public function deleteEnvironmentConfiguration(string $name)
    {
        if (array_key_exists($name, $this->environmentConfigurations)) {
            unset($this->environmentConfigurations[$name]);
        } else {
            throw new DomainException('There is no environment configuration with name' . $name);
        }
    }
624028
public function emptyCompileDir()
    {
        $this->console("Deleting compiled assets");
        $dir = $this->compilePath() . $this->prefix();
        if (is_dir($dir)) {
            Rails\Toolbox\FileTools::emptyDir($dir);
        }
    }
95749
public function clearCache()
	{
	    $path = $this->getCompiledPath();
	    if (is_dir($path)) {
	        return Dir::delete($path);
	    }
	    return true;
	}
1363165
public function clear(string $appname, string $env):int
    {
        if ($appname == "_all" && in_array(strtolower($env), array("dev", "prod", "all"))) {
            if (in_array(strtolower($env), array("dev", "prod"))) {
                Server::delete(FEnv::get("framework.web.components.apps").
                    strtolower($env), 'directory');
                Server::create(FEnv::get("framework.web.components.apps").
                    strtolower($env), 'directory');
            } else {
                Server::delete(FEnv::get("framework.web.components.apps").("dev"), 'directory');
                Server::create(FEnv::get("framework.web.components.apps").("dev"), 'directory');

                Server::delete(FEnv::get("framework.web.components.apps").("prod"), 'directory');
                Server::create(FEnv::get("framework.web.components.apps").("prod"), 'directory');
            }
        }
        if ($appname != "" && in_array(strtolower($env), array("dev", "prod", "all"))) {
            if (in_array(strtolower($env), array("dev", "prod"))) {
                Server::delete(FEnv::get("framework.web.components.apps").
                    strtolower($env)."/".strtolower($appname), 'directory');
            } else {
                Server::delete(FEnv::get("framework.web.components.apps").
                    ("dev")."/".strtolower($appname), 'directory');
                Server::delete(
                    FEnv::get("framework.web.components.apps").
                    ("prod")."/".strtolower($appname),
                    'directory'
                );
            }
        }
        return (1);
    }
50977
static function cleanup()
    {
        $ini = eZINI::instance();
        $db = eZDB::instance();
        $timeFrame = 1;
        if ( $ini->hasVariable( 'TipAFriend', 'TimeFrame' ) )
            $timeFrame = $ini->variable( 'TipAFriend', 'TimeFrame' );
        $time = time() - $timeFrame * 3600;

        $db->query( "DELETE FROM eztipafriend_request
                      WHERE created < $time " );
    }
714997
public function delete()
    {
        if (!$this->isXmlHttpRequest()) {
            throw new \Exception("wrong request mode");
        }

        $deleted = $this->getClassService()->deleteInstance($this->getCurrentInstance());

        $this->returnJson(array(
            'deleted' => $deleted
        ));
    }
658594
public function cleanupCommand(): void
    {
        try {
            $indicesToBeRemoved = $this->nodeIndexer->removeOldIndices();
            if (count($indicesToBeRemoved) > 0) {
                foreach ($indicesToBeRemoved as $indexToBeRemoved) {
                    $this->logger->log('Removing old index ' . $indexToBeRemoved);
                }
            } else {
                $this->logger->log('Nothing to remove.');
            }
        } catch (ApiException $exception) {
            $response = json_decode($exception->getResponse());
            if ($response->error instanceof \stdClass) {
                $this->logger->log(sprintf('Nothing removed. ElasticSearch responded with status %s, saying "%s: %s"', $response->status, $response->error->type, $response->error->reason));
            } else {
                $this->logger->log(sprintf('Nothing removed. ElasticSearch responded with status %s, saying "%s"', $response->status, $response->error));
            }
        }
    }
1019595
public function clean()
	{
		// So the task doesn't complain,
		// make any 'missing' dirs to cleanup
		array_map(function ($dir) {
			if ( ! is_dir($dir))
			{
				`mkdir -p {$dir}`;
			}
		}, $this->cleanDirs);

		$this->_cleanDir($this->cleanDirs);
		$this->_deleteDir($this->cleanDirs);
	}

	/**
	 * Run unit tests and generate coverage reports
	 */
	public function coverage()
	{
		$this->_run(['phpdbg -qrr -- vendor/bin/phpunit -c build']);
	}

	/**
	 * Generate documentation with phpdox
	 */
	public function docs()
	{
		$this->_run(['vendor/bin/phpdox']);
	}

	/**
	 * Verify that source files are valid
	 */
	public function lint()
	{
		$files = $this->getAllSourceFiles();

		$chunks = array_chunk($files, (int)`getconf _NPROCESSORS_ONLN`);

		foreach($chunks as $chunk)
		{
			$this->parallelLint($chunk);
		}
	}

	/**
	 * Run the phpcs tool
	 *
	 * @param bool $report - if true, generates reports instead of direct output
	 */
	public function phpcs($report = FALSE)
	{
		$dir = __DIR__;

		$report_cmd_parts = [
			'vendor/bin/phpcs',
			"--standard=./build/CodeIgniter",
			"--report-checkstyle=./build/logs/phpcs.xml",
		];

		$normal_cmd_parts = [
			'vendor/bin/phpcs',
			"--standard=./build/CodeIgniter",
		];

		$cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts;

		$this->_run($cmd_parts);
	}