Run `backup:run` command.

@return \Illuminate\Http\JsonResponse
509347
public function run()
    {
        try {
            ini_set('max_execution_time', 300);

            // start the backup process
            Artisan::call('backup:run');

            $output = Artisan::output();

            return response()->json([
                'status'  => true,
                'message' => $output,
            ]);
        } catch (\Exception $e) {
            return response()->json([
                'status'  => false,
                'message' => $e->getMessage(),
            ]);
        }
    }
427305
public function run()
    {
        // Load routing user config file
        $this->routes();
        // Launch routage
        Router::resolve();
        // Load databases user config file
        $this->databases();
        // Load Bootstrap
        $this->bootstrap();
        // Launch Controller defined by routage
        $bodyContent = $this->controller();
        // Show body content return by Controller
        echo $bodyContent;
    }
141518
public function run()
    {
        $this->loadMiddleware();

        //~ Default response
        $response = new HttpMessage\Response();
        //$response->getBody()->write('-- static --');

        //~ Get response
        $stack    = new HttpMiddleware\Stack($response, $this->middleware);
        $response = $stack->process(HttpMessage\ServerRequest::createFromGlobal());

        //~ Send response
        (new HttpMessage\ResponseSender($response))->send();
    }
844224
public function run()
	{
		/** @var BackendTemplate|object $objTemplate */
		$objTemplate = new \BackendTemplate('mod_dlstats_be_stat_details');
		$objTemplate->theme         = \Backend::getTheme();
		$objTemplate->base          = \Environment::get('base');
		$objTemplate->language      = $GLOBALS['TL_LANGUAGE'];
		$objTemplate->title         = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['systemMessages']);
		$objTemplate->charset       = \Config::get('characterSet');

		
		if ( is_null( \Input::get('action'   ,true) ) ||
		     is_null( \Input::get('dlstatsid',true) ) )
		{
		    $objTemplate->messages = '<p class="tl_error">'.$GLOBALS['TL_LANG']['tl_dlstatstatistics_stat']['wrong_parameter'].'</p>';
		    return $objTemplate->getResponse();
		}
		
		
		switch (\Input::get('action',true))
		{
		    case 'TopLastDownloads' :
		        $DetailFunction = 'getDlstatsDetails'.\Input::get('action',true);
		        $objTemplate->messages = $this->$DetailFunction( \Input::get('action',true), \Input::get('dlstatsid',true) );
		        break;
		    default:
		        $objTemplate->messages = '<p class="tl_error">'.$GLOBALS['TL_LANG']['tl_dlstatstatistics_stat']['wrong_parameter'].'</p>';
		        break;
		}
		
		return $objTemplate->getResponse();
	}
743722
public function run( )
    {
        // Spamming-Schutz
        if( \Config::get('backupdb_var') != '' ) {
            if( \Input::get( \Config::get('backupdb_var') ) === NULL ) {
                die( 'You cannot access this file directly!' );             // Variable nicht vorhanden => NULL
            }                                                               // Variable leer            => ''
        }

        @set_time_limit( 600 );

        //--- alten Zeitstempel löschen ---
        $pfad = TL_ROOT . '/' . $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB';
        if( file_exists( $pfad . '/' . BACKUPDB_CRON_LAST ) ) {
            unlink( $pfad . '/' . BACKUPDB_CRON_LAST );             // LastRun-Datei löschen
        }

        $result = 'Starting BackupDB ...<br>';

        //--- Datei-Extension festlegen ---
        $ext = '.sql';
        if( isset( $GLOBALS['TL_CONFIG']['backupdb_zip'] ) && ($GLOBALS['TL_CONFIG']['backupdb_zip'] == true) ) {
            $ext = '.zip';
        }

        //--- alte Backups aufrutschen ---  Anzahl einstellbar 29.3.2009 Softleister, über localconfig 07.05.2011
        $anzBackup = 3;
        if( isset( $GLOBALS['BACKUPDB']['AutoBackupCount'] ) && is_int($GLOBALS['BACKUPDB']['AutoBackupCount']) ) {
            $anzBackup = $GLOBALS['BACKUPDB']['AutoBackupCount'];
        }
        if( isset( $GLOBALS['TL_CONFIG']['AutoBackupCount'] ) && is_int($GLOBALS['TL_CONFIG']['AutoBackupCount']) ) {
            $anzBackup = $GLOBALS['TL_CONFIG']['AutoBackupCount'];
        }

        if( file_exists( $pfad . '/AutoBackupDB-' . $anzBackup . $ext ) ) {
            unlink( $pfad . '/AutoBackupDB-' . $anzBackup . $ext );
        }
        for( ; $anzBackup > 1; $anzBackup-- ) {
            if( file_exists( $pfad . '/AutoBackupDB-' . ($anzBackup-1) . $ext ) ) {
                rename( $pfad . '/AutoBackupDB-' . ($anzBackup-1) . $ext, $pfad . '/AutoBackupDB-' . $anzBackup . $ext );
            }
        }

        //--- wenn alte Backupdatei existiert: löschen ---
        if( file_exists( $pfad . '/AutoBackupDB-1.sql' ) ) {
            unlink( $pfad . '/AutoBackupDB-1.sql' );
        }

        //--- neue Datei AutoBackupDB-1.sql ---
        $datei = new \File( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1.sql' );
        $from = defined( 'DIRECT_CALL' ) ? 'Saved            : by direct call from IP ' . $this->Environment->ip : 'Saved by Cron';
        $datei->write( BackupDbCommon::getHeaderInfo( true, $from ) );

        $arrBlacklist = BackupDbCommon::get_blacklist( );
        $sqlarray = BackupDbCommon::getFromDB( );

        if( count($sqlarray) == 0 ) {
            $datei->write( 'No tables found in database.' );
        }
        else {
            foreach( array_keys($sqlarray) as $table ) {
                $datei->write( BackupDbCommon::get_table_structure( $table, $sqlarray[$table] ) );

                if( in_array( $table, $arrBlacklist ) ) continue;      // Blacklisten-Tabellen speichern nur Struktur, keine Daten -> continue
                BackupDbCommon::get_table_content( $table, $datei );   // Dateninhalte in Datei schreiben
            }
        }
        $datei->write( "\r\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\r\n"
                     . "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\r\n"
                     . "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\r\n"
                     . "\r\n# --- End of Backup ---\r\n" );           // Endekennung
        $datei->close();

        $result .= 'End of Backup<br>';

        //--- Wenn Komprimierung gewünscht, ZIP erstellen ---
        if( $ext === '.zip' ) {
            $objZip = new \ZipWriter( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1.zip' );
            $objZip->addFile( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1.sql', 'AutoBackupDB-1.sql' );
            $objZip->addFile( 'composer.json' );
            $objZip->addFile( 'composer.lock' );
            $objZip->addString( BackupDbCommon::get_symlinks(), 'restoreSymlinks.php', time() );    // Symlink-Recovery
            $objZip->close();
            unlink( $pfad . '/AutoBackupDB-1.sql' );
        }
        $objFile = \Dbafs::addResource( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/AutoBackupDB-1' . $ext );    // Datei in der Dateiverwaltung eintragen

        //--- Mail-Benachrichtigung ---
        if( isset( $GLOBALS['TL_CONFIG']['backupdb_sendmail'] ) && ($GLOBALS['TL_CONFIG']['backupdb_sendmail'] == true) ) {
            $objEmail = new \Email();
            $objEmail->from = $GLOBALS['TL_CONFIG']['adminEmail'];
            $objEmail->subject = 'AutoBackupDB ' . \Environment::get('host');
            $objEmail->text = BackupDbCommon::getHeaderInfo( false, $from );

            if( isset( $GLOBALS['TL_CONFIG']['backupdb_attmail'] ) && ($GLOBALS['TL_CONFIG']['backupdb_attmail'] == true) ) {
                $objEmail->attachFile( $pfad . '/AutoBackupDB-1' . $ext, 'application/octet-stream' );
            }

            $objEmail->sendTo( $GLOBALS['TL_CONFIG']['adminEmail'] );
        }

        $datei = new \File( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' . BACKUPDB_CRON_LAST );
        $datei->write( date($GLOBALS['TL_CONFIG']['datimFormat']) );
        $datei->close();

        // Update the hash of the target folder
        $objFile = \Dbafs::addResource( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' . BACKUPDB_CRON_LAST );    // Datei in der Dateiverwaltung eintragen
        \Dbafs::updateFolderHashes( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' );

        return new Response( $result );
    }
744981
public function run( )
    {
        @set_time_limit( 600 );
        $user = \BackendUser::getInstance();

        $filepath = $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB';
        $pfad = TL_ROOT . '/' . $filepath;
        if( file_exists( $pfad . '/' . BACKUPDB_RUN_LAST ) ) {
            unlink( $pfad . '/' . BACKUPDB_RUN_LAST );          // LastRun-Datei löschen
        }

        //--- Datei-Extension festlegen ---
        $ext = '';
        if( isset( $GLOBALS['TL_CONFIG']['backupdb_zip'] ) && ($GLOBALS['TL_CONFIG']['backupdb_zip'] == true) ) {
            $ext = '.zip';
        }

        $tmpdatei = new \File( $filepath . '/Database_' . $GLOBALS['TL_CONFIG']['dbDatabase'] . '_' . date('Y-m-d') . '_' . date('His') . '.sql' );        // temporäre Datei erstellen
        $tmpdatei->write( BackupDbCommon::getHeaderInfo( true, 'Saved by User    : ' . $user->username . ' (' . $user->name . ')' ) );

        $arrBlacklist = BackupDbCommon::get_blacklist( );
        $sqlarray = BackupDbCommon::getFromDB( );

        if( count($sqlarray) == 0 ) {
            $tmpdatei->write( 'No tables found in database.' );
        }
        else {
            foreach( array_keys($sqlarray) as $table ) {
                $tmpdatei->write( BackupDbCommon::get_table_structure( $table, $sqlarray[$table] ) );

                if( in_array( $table, $arrBlacklist ) ) continue;           // Blacklisten-Tabellen speichern nur Struktur, keine Daten -> continue
                BackupDbCommon::get_table_content( $table, $tmpdatei );     // Dateninhalte ausgeben
            }
        }

        $tmpdatei->write( "\r\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\r\n"
                        . "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\r\n"
                        . "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\r\n"
                        . "\r\n# --- End of Backup ---\r\n" );                            // Endekennung
        $tmpdatei->close();
        
        //--- Wenn Komprimierung gewünscht, ZIP erstellen ---
        if( $ext === '.zip' ) {
            $objZip = new \ZipWriter( $filepath . '/' . $tmpdatei->basename . '.zip' );
            $objZip->addFile( $filepath . '/' . $tmpdatei->name, $tmpdatei->name );
            $objZip->addFile( 'composer.json' );
            $objZip->addFile( 'composer.lock' );
            $objZip->addString( BackupDbCommon::get_symlinks(), 'restoreSymlinks.php', time() );    // Symlink-Recovery
            $objZip->close();
        }

        // Timestamp-Datei erstellen
        $datei = new \File( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' . BACKUPDB_RUN_LAST );
        $datei->write( date($GLOBALS['TL_CONFIG']['datimFormat']) );
        $datei->close();

		// Update the hash of the target folder
        $objFile = \Dbafs::addResource( $GLOBALS['TL_CONFIG']['uploadPath'] . '/AutoBackupDB/' . BACKUPDB_RUN_LAST );    // Datei in der Dateiverwaltung eintragen
        \Dbafs::updateFolderHashes($strUploadFolder);

        //=== Ausgabe der temporären Datei ===
        header( 'Pragma: public' );
        header( 'Expires: 0' );
        header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
        header( 'Cache-Control: private', false );
        header( 'Content-type: application/octet-stream' );
        header( 'Content-disposition: attachment; filename=' . $tmpdatei->name . $ext );
        header( 'Content-Transfer-Encoding: binary' );

        echo file_get_contents( $pfad . '/' . $tmpdatei->name . $ext ); // Ausgabe als Download
        $tmpdatei->delete( );
        if( $ext === '.zip' ) {
            unlink( $pfad . '/' . $tmpdatei->name . $ext );             // ZIP-Datei löschen
        }
    }
1339648
public function run()
    {
        /* @var $model \yii\db\ActiveRecord */
        $request=yii::$app->getRequest();
        $id=$request->post('id');
        $key=$request->post('key');
        $value=$request->post('value');

        if($id){
            $ids = explode(',', $id);
            $t=Yii::$app->db->beginTransaction();
            $k=0;
            foreach ($ids as $id){
                if(preg_match('/[\d]+/',$id)){
                    $model = ($this->modelClass)::findOne($id);
                    if($model){
                        $model->setScenario( $this->scenario );
                        if($model->$key==$value){
                            $k++;
                            continue;
                        }
                        if($model->load([$key=>$value],'')&&$model->save()){
                            continue;
                        }else{
                            $msg= ['status'=>false,'msg'=>Yii::t('app',current($model->getFirstErrors()))];
                            break;
                        }
                    }
                }
            }
            if($k==count($ids)){
                $msg= ['status'=>false,'msg'=>Yii::t('app','Unchange')];
            }
            if(isset($msg)){
                $t->rollBack();
            }else{
                $t->commit();
                $msg= ['status'=>true,'msg'=>Yii::t('app','Edit success')];
            }
        }else{
            $msg= ['status'=>true,'msg'=>Yii::t('app',"Invalid id")];
        }

        if($request->isAjax){
            \yii::$app->getResponse()->format=Response::FORMAT_JSON;
            return $msg;
        }else{
            if($msg['status']==true){
                \yii::$app->getSession()->setFlash('success', yii::t('app', 'Success'));
            }else{
                \yii::$app->getSession()->setFlash('error', yii::t('app', $msg['msg']));
            }

            return $this->controller->redirect($this->viewFile);
        }
    }
1137111
public function run() {
        $helperSet = $this->getConsoleHelperSet();
        ConsoleRunner::run($helperSet, $this->getConsoleCommands($helperSet));
    }
1156058
public function run()
	{
		$this->say('Building ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);

		if (!$this->checkFolders())
		{
			return false;
		}

		// Create directory
		$this->prepareDistDirectory();

		// Build extension
		$this->buildExtension($this->params)->run();

		// Create symlink to current folder
		if ($this->isWindows())
		{
			$this->_exec('mklink /J ' . JPATH_BASE . '\dist\current ' . $this->getWindowsPath($this->getBuildFolder()));
		}
		else
		{
			$this->_symlink($this->getBuildFolder(), JPATH_BASE . "/dist/current");
		}

		// Support multiple deployment methods, separated by spaces
		$deploy = explode(" ", $this->getJConfig()->target);

		if (count($deploy))
		{
			foreach ($deploy as $d)
			{
				$task = 'deploy' . ucfirst($d);

				$this->{$task}()->run();
			}
		}

		return true;
	}
124029
public function run()
    {
        if ($this->stage++ > 0) {
            $this->header('500 Too Busy');
            return;
        }
        if ($this->attrs->raw === '') {
            $this->header('500 Internal Server Error');
            echo 'Payload expected.';
            return;
        }
        if (!json_decode($this->attrs->raw, true)) {
            $this->header('500 Internal Server Error');
            echo 'Broken JSON encoding.';
            return;
        }
        $this->appInstance->publish('c2s:' . $this->sessId, $this->attrs->raw, function ($redis) {
            if (!$this->headers_sent) {
                if ($redis->result === 0) {
                    $this->header('404 Not Found');
                } else {
                    $this->header('204 No Content');
                }
            }
            $this->finish();
        });
        $this->sleep(10);
    }
354281
public function run()
    {
        if ($data = BotApi::jsonValidate($this->getRawBody(), true)) {
            $this->handle([Update::fromResponse($data)]);
        }
    }
949681
public function run()
    {
        // TODO: Implement run() method.
        if(isset($this->params['token']))
        {
            $recovery = new \UserRecovery();
            $res = $recovery->get(array('token' => $this->params['token']));
            if($res->count() == 1)
            {
                $this->setTemplate("recovery_password.twig");
                if(isset($_POST['save']))
                {
                    if($_POST['password'] == $_POST['password2'])
                    {
                        $recovery = $res->getModel();
                        if($recovery instanceof \UserRecovery);


                        $user = Model::newInstance("User", $recovery->id_user);
                        if($user->validPassword($_POST['password']))
                        {
                            $user->password = $user->encrypt($_POST['password']);
                            $user->save();
                            $this->addMessage("Se ha guardado correctamente, acceda a login");
                            $recovery->delete();
                            $this->quit("/login");
                        }
                        else
                        {
                            $this->addMessage("La contaseña no es segura. Utilice otra contraseña más larga (min:6)", "danger");
                        }
                    }
                    else
                    {
                        $this->addMessage("Contraseñas no válidas", "danger");
                        
                    }
                }
            }
            else
            {
                $this->addMessage("Codigo de recupercion no válido!", "danger");
            }
            
            
        }
        else
        {
            if(isset($_POST['save']))
            {
                $user = Model::newInstance("User");
                $result = null;
                if(!empty($_POST['username']))
                {
                    $result = $user->get(array('user_name' => $_POST['username']));
                }
                else if(!empty($_POST['email']))
                {
                    $result = $user->get(array('email' => $_POST['email']));
                }
                if($result)
                {
                    if($result->count() > 0)
                    {
                        $user = $result->getModel();
                        $recovery = new \UserRecovery();
                        $recovery = $recovery->generateNew($user);
                        $recovery->save(true);
//                        print_debug($recovery);
                        $mail = new Mail();
                        $message = $mail->render($this, "mail/recover_account.twig", array('user' => $user, 'recovery' => $recovery));
                        if($mail->send($user->email, "Contraseña perdida", $message))
                        {
                            $this->addMessage("Se ha enviado un email al usuario con los pasos que tiene que seguir para recuperar la cuenta");
                        }
                        else
                        {
                            $this->addMessage("Se ha producido un error al enviar el email, verifique los parametros de configuración.", "danger");
                        }

                    }
                    else
                    {
                        $this->addMessage("No se encontraron registros asociados a estos datos", "danger");
                    }
                }
                else
                {
                    $this->addMessage("No se han proporcionado datos", "danger");
                }
            }
        }
    }
191037
public function run()
    {
        $data       = $this->parseRequestUri();
        $controller = $data['controller'];
        $method     = $data['method'];
        $params     = $data['params'];

        $subModule  = $this->subModule;
        if ("" != $subModule) {
            $subModule = "\\" . $subModule;
        }

        $class      = sprintf("%s\\Controller%s\\%sController", $this->appNameSpace, $subModule, $controller);
        if (!(class_exists($class) && method_exists($class, $method))) {
            $this->fileNotFound();
        } else {
            $class  = new $class;
            $pipe = new Pipeline();
            $pipe->through($class->getMiddleWare())->then(function () use ($class, $method, $params) {
                call_user_func_array(array($class, $method), $params);
            });

            //call_user_func_array(array($class, $method), $params);
        }
    }
686496
public function run()
	{
		$this->say('Zipping ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);

		// Instantiate the zip archive
		$this->zip->open($this->target, \ZipArchive::CREATE);

		// Process the files to zip
		foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getBuildFolder()), \RecursiveIteratorIterator::SELF_FIRST) as $subfolder)
		{
			if ($subfolder->isFile())
			{
				// Set all separators to forward slashes for comparison
				$usefolder = str_replace('\\', '/', $subfolder->getPath());

				// Drop the folder part as we don't want them added to archive
				$addpath = str_ireplace($this->getBuildFolder(), '', $usefolder);

				// Remove preceding slash
				$findfirst = strpos($addpath, '/');

				if ($findfirst == 0 && $findfirst !== false)
				{
					$addpath = substr($addpath, 1);
				}

				if (strlen($addpath) > 0 || empty($addpath))
				{
					$addpath .= '/';
				}

				$options = array('add_path' => $addpath, 'remove_all_path' => true);
				$this->zip->addGlob($usefolder . '/*.*', GLOB_BRACE, $options);
			}
		}

		// Close the zip archive
		$this->zip->close();

		return true;
	}
446674
public function run()
	{
		$request = Request::createFromGlobals();
		$this->instance('request', $request);

		$this->bootProviders();

		$response = $this['router']->dispatch($this['request']);

		if (false == ($response instanceof Response)) {
			$response = new Response($response);
		}

		$response->send();
	}
1301533
public function run()
    {
        $request = ServerRequest::createServerRequestFromGlobals();

        $response = $this->handleRequest($request);

        $this->handleResponse($response);

        return $this->shutdown($request, $response);
    }
613356
public function run()
    {
        $error = $this->error;
        $output = $this->output;

        return $this->builder->getProcess()->run(
            function ($type, $buffer) use ($error, $output) {
                if ('err' === $type) {
                    if ($error) {
                        $error($buffer);
                    }
                } elseif ($output) {
                    $output($buffer);
                }
            }
        );
    }