Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
L
Liman MYS - Çekirdek
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
liman
Liman MYS - Çekirdek
Commits
a80755e5
Kaydet (Commit)
a80755e5
authored
Eyl 30, 2020
tarafından
mertcelen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add missign key_port to serverkey objects.
üst
a5a38ace
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
2020_09_30_171001_add_missing_key_port_server_keys.php
...ns/2020_09_30_171001_add_missing_key_port_server_keys.php
+63
-0
No files found.
database/migrations/2020_09_30_171001_add_missing_key_port_server_keys.php
0 → 100644
Dosyayı görüntüle @
a80755e5
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
use
App\Models\ServerKey
;
class
AddMissingKeyPortServerKeys
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
$keys
=
ServerKey
::
all
();
foreach
(
$keys
as
$key
){
$temp
=
$key
->
data
;
$arr
=
json_decode
(
$temp
,
true
);
if
(
!
array_key_exists
(
"key_port"
,
$arr
)){
$type
=
$key
->
type
;
$port
=
null
;
switch
(
$type
){
case
"ssh"
:
case
"ssh_certificate"
:
$port
=
"22"
;
break
;
case
"winrm"
:
case
"winrm_certificate"
:
$port
=
"5986"
;
break
;
case
"snmp"
:
$port
=
"161"
;
break
;
}
if
(
$port
==
null
){
continue
;
}
$arr
[
"key_port"
]
=
$port
;
$foo
=
json_encode
(
$arr
);
$key
->
update
([
"data"
=>
$foo
]);
$key
->
save
();
}
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
//
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment