public static function getIdByUrlAndAuth($url, $authInfo) { $crypto = new Scalr_Util_CryptoTool(MCRYPT_TRIPLEDES, MCRYPT_MODE_CFB, 24, 8); $cryptoKey = @file_get_contents(dirname(__FILE__) . "/../../etc/.cryptokey"); $eAuthInfo = $crypto->encrypt(serialize($authInfo), $cryptoKey); return Core::GetDBInstance()->GetOne("SELECT id FROM dm_sources WHERE `url`=? AND auth_info=?", array($url, $eAuthInfo)); }
protected function run1($stage) { $crypto = new \Scalr_Util_CryptoTool(MCRYPT_TRIPLEDES, MCRYPT_MODE_CFB, 24, 8); $cryptoKey = @file_get_contents(SRCPATH . "/../etc/.cryptokey"); $this->console->out('Creating field ssl_simple_pkey'); $this->db->Execute('ALTER TABLE services_ssl_certs ADD `ssl_simple_pkey` text'); $this->console->out('Encrypting values'); $values = $this->db->GetAll('SELECT * FROM services_ssl_certs'); foreach ($values as $value) { if ($value['ssl_pkey']) { $this->db->Execute('UPDATE services_ssl_certs SET ssl_simple_pkey = ?, ssl_pkey = ? WHERE id = ?', array($value['ssl_pkey'], $crypto->encrypt($value['ssl_pkey'], $cryptoKey), $value['id'])); } } }