public function load()
	{
		if (!$infile = $this->arguments->getOpt(3))
		{
			$this->output->error('Please provide an input file');
		}
		else
		{
			if (!is_file($infile))
			{
				$this->output->error("'{$infile}' does not appear to be a valid file");
			}
		}

		// First, set some things aside that we need to reapply after the update
		$params                           = [];
		$params['com_system']             = \Component::params('com_system');
		$params['com_tools']              = \Component::params('com_tools');
		$params['com_usage']              = \Component::params('com_usage');
		$params['com_users']              = \Component::params('com_users');
		$params['plg_projects_databases'] = \Plugin::params('projects', 'databases');

		$tables = App::get('db')->getTableList();

		// See if we should drop all tables first
		if ($this->arguments->getOpt('drop-all-tables'))
		{
			$this->output->addLine('Dropping all tables...');
			foreach ($tables as $table)
			{
				App::get('db')->dropTable($table);
			}
		}

		// Craft the command to be executed
		$infile = escapeshellarg($infile);
		$cmd    = "mysql -u " . Config::get('user') . " -p'" . Config::get('password') . "' -D " . Config::get('db') . " < {$infile}";

		$this->output->addLine('Loading data from ' . $infile . '...');

		// Now push the big red button
		exec($cmd);

		$migration = new Migration(App::get('db'));

		// Now load some things back up
		foreach ($params as $k => $v)
		{
			if (!empty($v))
			{
				$migration->saveParams($k, $v);
			}
		}

		$this->output->addLine('Load complete!', 'success');
	}
public function load()
	{
		if (!$infile = $this->arguments->getOpt(3))
		{
			$this->output->error('Please provide an input file');
		}
		else
		{
			if (!is_file($infile))
			{
				$this->output->error("'{$infile}' does not appear to be a valid file");
			}
		}

		// First, set some things aside that we need to reapply after the update
		$params                           = [];
		$params['com_system']             = \Component::params('com_system');
		$params['com_tools']              = \Component::params('com_tools');
		$params['com_usage']              = \Component::params('com_usage');
		$params['com_users']              = \Component::params('com_users');
		$params['plg_projects_databases'] = \Plugin::params('projects', 'databases');

		$tables = App::get('db')->getTableList();

		// See if we should drop all tables first
		if ($this->arguments->getOpt('drop-all-tables'))
		{
			$this->output->addLine('Dropping all tables...');
			foreach ($tables as $table)
			{
				App::get('db')->dropTable($table);
			}
		}

		// Craft the command to be executed
		$infile = escapeshellarg($infile);
		$cmd    = "mysql -u " . Config::get('user') . " -p'" . Config::get('password') . "' -D " . Config::get('db') . " < {$infile}";

		$this->output->addLine('Loading data from ' . $infile . '...');

		// Now push the big red button
		exec($cmd);

		$migration = new Migration(App::get('db'));

		// Now load some things back up
		foreach ($params as $k => $v)
		{
			if (!empty($v))
			{
				$migration->saveParams($k, $v);
			}
		}

		$this->output->addLine('Load complete!', 'success');
	}
public function load ( ) { if ( ! $ infile = $ this -> arguments -> getOpt ( 3 ) ) { $ this -> output -> error ( 'Please provide an input file' ) ; } else { if ( ! is_file ( $ infile ) ) { $ this -> output -> error ( "'{$infile}' does not appear to be a valid file" ) ; } } // First, set some things aside that we need to reapply after the update $ params = [ ] ; $ params [ 'com_system' ] = \ Component :: params ( 'com_system' ) ; $ params [ 'com_tools' ] = \ Component :: params ( 'com_tools' ) ; $ params [ 'com_usage' ] = \ Component :: params ( 'com_usage' ) ; $ params [ 'com_users' ] = \ Component :: params ( 'com_users' ) ; $ params [ 'plg_projects_databases' ] = \ Plugin :: params ( 'projects' , 'databases' ) ; $ tables = App :: get ( 'db' ) -> getTableList ( ) ; // See if we should drop all tables first if ( $ this -> arguments -> getOpt ( 'drop-all-tables' ) ) { $ this -> output -> addLine ( 'Dropping all tables...' ) ; foreach ( $ tables as $ table ) { App :: get ( 'db' ) -> dropTable ( $ table ) ; } } // Craft the command to be executed $ infile = escapeshellarg ( $ infile ) ; $ cmd = "mysql -u " . Config :: get ( 'user' ) . " -p'" . Config :: get ( 'password' ) . "' -D " . Config :: get ( 'db' ) . " < {$infile}" ; $ this -> output -> addLine ( 'Loading data from ' . $ infile . '...' ) ; // Now push the big red button exec ( $ cmd ) ; $ migration = new Migration ( App :: get ( 'db' ) ) ; // Now load some things back up foreach ( $ params as $ k => $ v ) { if ( ! empty ( $ v ) ) { $ migration -> saveParams ( $ k , $ v ) ; } } $ this -> output -> addLine ( 'Load complete!' , 'success' ) ; }
Load a database dump

@museDescription  Loads the provided database into the hubs currently configured database

@return  void
Load a database dump