运行服务器

@return void
963799
public function run()
    {
        if(version_compare(SWOOLE_VERSION, '4.1', '>='))
        {
            \Swoole\Runtime::enableCoroutine(true);
        }
        if(file_exists($this->socketFile))
        {
            unlink($this->socketFile);
        }
        go(function(){
            $this->socket = stream_socket_server('unix://' . $this->socketFile, $errno, $errstr);
            if(false === $this->socket)
            {
                throw new \RuntimeException(sprintf('Create unix socket server failed, errno: %s, errstr: %s', $errno, $errstr));
            }
            while(true)
            {
                $conn = stream_socket_accept($this->socket, 0);
                if(false === $conn)
                {
                    continue;
                }
                go(function() use($conn){
                    $this->parseConn($conn);
                });
            }
        });
    }
233719
public function run()
    {
        DB::table('groups')->delete();

        // users
        $permissions = array('user' => 1, 'edit' => 0, 'blog' => 0, 'mod' => 0, 'admin' => 0);
        $group = array('name' => 'Users', 'permissions' => $permissions);
        Credentials::getGroupProvider()->create($group);

        // editors
        $permissions = array('user' => 1, 'edit' => 1, 'blog' => 0, 'mod' => 0, 'admin' => 0);
        $group = array('name' => 'Editors', 'permissions' => $permissions);
        Credentials::getGroupProvider()->create($group);

        // bloggers
        $permissions = array('user' => 1, 'edit' => 0, 'blog' => 1, 'mod' => 0, 'admin' => 0);
        $group = array('name' => 'Bloggers', 'permissions' => $permissions);
        Credentials::getGroupProvider()->create($group);

        // moderators
        $permissions = array('user' => 1, 'edit' => 0, 'blog' => 0, 'mod' => 1, 'admin' => 0);
        $group = array('name' => 'Moderators', 'permissions' => $permissions);
        Credentials::getGroupProvider()->create($group);

        // admins
        $permissions = array('user' => 1, 'edit' => 1, 'blog' => 1, 'mod' => 1, 'admin' => 1);
        $group = array('name' => 'Admins', 'permissions' => $permissions);
        Credentials::getGroupProvider()->create($group);
    }
214326
public function run()
    {
        if (!is_array($rules = $this->getRules())) {
            $rules = $this->convertToArray($rules);
        }

        if (!is_array($datas = $this->getDatas())) {
            $datas = $this->convertToArray($datas);
        }

        foreach ($rules as $key => $rule) {
            $parsedRules = explode("|", $rule);

            foreach ($parsedRules as $parsedRule) {
                $required = $this->handleRule($parsedRule, $key, $datas);

                if ($required !== null && $required === false) {
                    break;
                }
            }
        }
    }
886548
public function run()
	{
		list($name,$id)=$this->resolveNameID();

		if(isset($this->htmlOptions['id']))
			$id=$this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;
		if(isset($this->htmlOptions['name']))
			$name=$this->htmlOptions['name'];

		if($this->flat===false)
		{
			if($this->hasModel())
				echo CHtml::activeTextField($this->model,$this->attribute,$this->htmlOptions);
			else
				echo CHtml::textField($name,$this->value,$this->htmlOptions);
		}
		else
		{
			if($this->hasModel())
			{
				echo CHtml::activeHiddenField($this->model,$this->attribute,$this->htmlOptions);
				$attribute=$this->attribute;
				$this->options['defaultDate']=$this->model->$attribute;
			}
			else
			{
				echo CHtml::hiddenField($name,$this->value,$this->htmlOptions);
				$this->options['defaultDate']=$this->value;
			}

			$this->options['altField']='#'.$id;

			$id=$this->htmlOptions['id']=$id.'_container';
			$this->htmlOptions['name']=$name.'_container';

			echo CHtml::tag('div',$this->htmlOptions,'');
		}

		$options=CJavaScript::encode($this->options);
		$js = "jQuery('#{$id}').datepicker($options);";

		if($this->language!='' && $this->language!='en')
		{
			$this->registerScriptFile($this->i18nScriptFile);
			$js = "jQuery('#{$id}').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['{$this->language}'],{$options}));";
		}

		$cs = Yii::app()->getClientScript();

		if(isset($this->defaultOptions))
		{
			$this->registerScriptFile($this->i18nScriptFile);
			$cs->registerScript(__CLASS__,$this->defaultOptions!==null?'jQuery.datepicker.setDefaults('.CJavaScript::encode($this->defaultOptions).');':'');
		}
		$cs->registerScript(__CLASS__.'#'.$id,$js);
	}
876308
public function run() {

		$model	= $this->model;

		if( isset( $model ) ) {

			if( $model->load( Yii::$app->request->post(), $model->getClassName() ) ) {

				switch( $model->visibility ) {

					case IVisibility::VISIBILITY_PUBLIC: {

						$this->modelService->makePublic( $model );

						break;
					}
					case IVisibility::VISIBILITY_PROTECTED: {

						$this->modelService->makeProtected( $model );

						break;
					}
					case IVisibility::VISIBILITY_PRIVATE: {

						$this->modelService->makePrivate( $model );

						break;
					}
				}

				// Trigger Ajax Success
				return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ) );
			}

			// Trigger Ajax Failure
			return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_REQUEST ) );
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
186209
public function run()
    {
        $this->running = true;

        do {
            $hasEvents = $this->tick(true);
        } while ($this->running && $hasEvents);
        $this->running = false;
    }
1211954
public function run()
    {
        $dataType = $this->dataType('slug', 'posts');
        if (!$dataType->exists) {
            $dataType->fill([
                'name'                  => 'posts',
                'display_name_singular' => '帖子',
                'display_name_plural'   => '帖子',
                'icon'                  => 'voyager-news',
                'model_name'            => 'TCG\\Voyager\\Models\\Post',
                'controller'            => '',
                'generate_permissions'  => 1,
                'description'           => '',
            ])->save();
        }

        $dataType = $this->dataType('slug', 'pages');
        if (!$dataType->exists) {
            $dataType->fill([
                'name'                  => 'pages',
                'display_name_singular' => '页面',
                'display_name_plural'   => '页面',
                'icon'                  => 'voyager-file-text',
                'model_name'            => 'TCG\\Voyager\\Models\\Page',
                'controller'            => '',
                'generate_permissions'  => 1,
                'description'           => '',
            ])->save();
        }

        $dataType = $this->dataType('slug', 'users');
        if (!$dataType->exists) {
            $dataType->fill([
                'name'                  => 'users',
                'display_name_singular' => '用户',
                'display_name_plural'   => '用户',
                'icon'                  => 'voyager-person',
                'model_name'            => 'TCG\\Voyager\\Models\\User',
                'controller'            => '',
                'generate_permissions'  => 1,
                'description'           => '',
            ])->save();
        }

        $dataType = $this->dataType('name', 'categories');
        if (!$dataType->exists) {
            $dataType->fill([
                'slug'                  => 'categories',
                'display_name_singular' => '分类',
                'display_name_plural'   => '分类',
                'icon'                  => 'voyager-categories',
                'model_name'            => 'TCG\\Voyager\\Models\\Category',
                'controller'            => '',
                'generate_permissions'  => 1,
                'description'           => '',
            ])->save();
        }

        $dataType = $this->dataType('slug', 'menus');
        if (!$dataType->exists) {
            $dataType->fill([
                'name'                  => 'menus',
                'display_name_singular' => '菜单',
                'display_name_plural'   => '菜单',
                'icon'                  => 'voyager-list',
                'model_name'            => 'TCG\\Voyager\\Models\\Menu',
                'controller'            => '',
                'generate_permissions'  => 1,
                'description'           => '',
            ])->save();
        }

        $dataType = $this->dataType('slug', 'roles');
        if (!$dataType->exists) {
            $dataType->fill([
                'name'                  => 'roles',
                'display_name_singular' => '角色',
                'display_name_plural'   => '角色',
                'icon'                  => 'voyager-lock',
                'model_name'            => 'TCG\\Voyager\\Models\\Role',
                'controller'            => '',
                'generate_permissions'  => 1,
                'description'           => '',
            ])->save();
        }
    }
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);
        }
    }
1273618
public function run()
    {
        /** @var Request $request */
        $request = $this->getService('request-handler');

        //Process incoming request
        $request->incoming($this);

        //Register helper services
        $helpers = static::$container['helpers'];

        foreach($helpers as $helper => $options) {
            $this->registerService(new $helper($options));
        }

        //Start session
        $this->getService('session-handler')->start();

        //Execute callback
        if ($this->getService('router')->routeIsCallable()) {
            $this->executeCallback();
            return;
        }

        //Execute extenders
        $this->executeUnitExtenders($this->getActiveUnit());

        $this->executeService();
    }
575894
public function run()
    {
        if ($this->unRegister() && empty(static::$keys[$this->getKey()])) {
            call_user_func_array($this->callback, $this->arguments);
        }
    }
815284
public function run(): void
    {
        $response = $this->routes->getResponse($this->request);
        if (!($response instanceof App\Response)) {
            $response = new App\Response\NotFound();
        }
        $this->send($response);
    }
1211406
public function run()
    {
        /** @var ResponseInterface $response */
        $response = $this->queue->handle($this->request);

        // http status
        $reasonPhrase = $response->getReasonPhrase();
        $reasonPhrase = ($reasonPhrase ? ' '.$reasonPhrase : '');
        header(sprintf('HTTP/%s %d%s', $response->getProtocolVersion(), $response->getStatusCode(), $reasonPhrase));

        // additional headers
        foreach ($response->getHeaders() as $header => $values) {
            $first = true;
            foreach ($values as $value) {
                header(sprintf('%s: %s', $header, $value), $first);
                $first = false;
            }
        }
        echo $response->getBody();
    }
1135144
public function run()
    {
       
        $this->outVerbose("Connecting...");
        if ($this->connect($this->options['user'], $this->options['password'])){
            $this->outVerbose("Connected to TAO API.");
            
            switch ($this->options['action']){
                case 'setConfig':
                    $this->setCurrentAction($this->options['action']);
                    $this->actionSetConfig();
                break;
                
                case 'install':
                    $this->setCurrentAction($this->options['action']);
                    $this->actionInstall();
                break;
            }
            
            $this->disconnect();    
        }
        else{
            $this->error("Could not connect to TAO API. Please check your user name and password.", true);
        }
       
    }
21671
public function run() {
        try {
            $request  = $this->getLoops()->getService("request");
            $response = $this->getLoops()->getService("response");
            $web_core = $this->getLoops()->getService("web_core");

            //dispatch request
            echo $web_core->dispatch($this->url, $request, $response);
        }
        catch(Throwable $exception) {
            http_response_code(500);

            try {
                $renderer = $this->getLoops()->getService("renderer");
                echo $renderer->render($exception);
            }
            catch(Throwable $render_exception) {
                Misc::displayException($exception);
            }
        }
    }
789296
public function run()
    {
        DB::table('users_groups')->delete();

        $this->matchUser('admin@dsmg.co.uk', 'Admins');
        $this->matchUser('semiadmin@dsmg.co.uk', 'Moderators');
        $this->matchUser('semiadmin@dsmg.co.uk', 'Bloggers');
        $this->matchUser('semiadmin@dsmg.co.uk', 'Editors');
        $this->matchUser('moderator@dsmg.co.uk', 'Moderators');
        $this->matchUser('blogger@dsmg.co.uk', 'Bloggers');
        $this->matchUser('editor@dsmg.co.uk', 'Editors');
        $this->matchUser('user@dsmg.co.uk', 'Users');
    }
1348880
static public function run()
  {
    foreach (self::$dbs as $db) {
      $db->execute(self::files());
    }

    foreach (self::$writers as $writer) {
      $writer->execute(self::files());
    }
  }
648419
public function run()
	{
		if(!empty($this->links)) {
		
			$links=array();
	
			foreach($this->links as $label=>$url) {
				if(is_string($label) || is_array($url))
					$links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url, array('title'=>$label));
				//else
				//	$links[] = '<span>'.($this->encodeLabel ? CHtml::encode($url) : $url).'</span>';
			}
		}
		
		/*
		if($this->homeLink===null)
			$links[]=CHtml::link(Yii::t('phrase', 'Close'), 'javascript:void(0);', array('title'=>Yii::t('phrase', 'Close'), 'class'=>'closed','off_address'=>''));
		elseif($this->homeLink!==false)
			$links[]=$this->homeLink;
		*/
		
		if(!empty($this->links)) {
			echo implode($this->separator,$links);
			echo ' '.Yii::t('phrase', 'or').' ';
		}
		echo CHtml::link(Yii::t('phrase', 'Close'), 'javascript:void(0);', array('title'=>Yii::t('phrase', 'Close'), 'class'=>'closed','off_address'=>''));
	}