public function safeUp()
 {
     $badProxies = $this->getBadProxies();
     $goodProxies = $this->getGoodProxies();
     foreach ($badProxies as $key => $badHost) {
         $proxy = Proxies::find()->where(['host' => $badHost])->limit(1)->one();
         if ($proxy) {
             echo PHP_EOL . $key . ' - ' . $badHost . ' - ' . $proxy->host . ' -> ' . $goodProxies[$key];
             $proxy->host = $goodProxies[$key];
             $proxy->port = '7893';
             $proxy->login = '******';
             $proxy->password = '******';
             if ($proxy->save()) {
                 echo ' - UPDATED';
             } else {
                 echo ' - FAIL';
             }
         }
     }
     $proxy = Proxies::find()->where(['host' => '95.163.126.116'])->limit(1)->one();
     if (is_null($proxy)) {
         $proxy = new Proxies();
         $proxy->host = '95.163.126.116';
         $proxy->port = '7893';
         $proxy->login = '******';
         $proxy->password = '******';
         $proxy->scope_id = 22;
         $proxy->country = 'ru';
         $proxy->save();
     }
 }
 private function _saveProxy($ip, $scopeId)
 {
     $proxy = new Proxies();
     $proxy->host = $ip;
     $proxy->port = '5394';
     $proxy->login = '******';
     $proxy->password = '******';
     $proxy->country = 'usa';
     $proxy->scope_id = $scopeId;
     return $proxy->save();
 }
 private function _saveProxy($ip, $scopeId)
 {
     $proxy = new Proxies();
     $proxy->host = $ip;
     $proxy->port = '5394';
     $proxy->login = '******';
     $proxy->password = '******';
     $proxy->country = 'usa';
     $proxy->scope_id = $scopeId;
     return $proxy->save();
 }