@@ -9,14 +9,14 @@ |
||
9 | 9 | 'name' => 'import', |
10 | 10 | 'route' => "[--timestamp=]", |
11 | 11 | 'short_description' => "Good morning!! This is a beautiful day", |
12 | - "handler" => ['App\Command\ImportCommand', 'run'], |
|
12 | + "handler" => [ 'App\Command\ImportCommand', 'run' ], |
|
13 | 13 | ], |
14 | 14 | ], |
15 | - WpPostService::class => function (ContainerInterface $c) { |
|
16 | - $host = $c->get('mysql')['host']; |
|
17 | - $db = $c->get('mysql')['db']; |
|
18 | - $user = $c->get('mysql')['user']; |
|
19 | - $password = $c->get('mysql')['password']; |
|
15 | + WpPostService::class => function(ContainerInterface $c) { |
|
16 | + $host = $c->get('mysql')[ 'host' ]; |
|
17 | + $db = $c->get('mysql')[ 'db' ]; |
|
18 | + $user = $c->get('mysql')[ 'user' ]; |
|
19 | + $password = $c->get('mysql')[ 'password' ]; |
|
20 | 20 | $pdo = new \PDO( |
21 | 21 | "mysql:host={$host};dbname={$db}", |
22 | 22 | $user, |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ':ping_status' => 'closed', |
39 | 39 | ':post_type' => 'artist', |
40 | 40 | ]); |
41 | - $console->writeLine("[INFO] New artist ({$artistDB['ID']}) {$artistDB['post_title']}"); |
|
41 | + $console->writeLine("[INFO] New artist ({$artistDB[ 'ID' ]}) {$artistDB[ 'post_title' ]}"); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | if ($song->album->name) { |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | ':post_type' => 'album', |
57 | 57 | ]); |
58 | 58 | $wpPost->insertMeta([ |
59 | - ':post_id' => $albumDB['ID'], |
|
59 | + ':post_id' => $albumDB[ 'ID' ], |
|
60 | 60 | ':key' => 'theme2035_album_artist_name', |
61 | - ':value' => $artistDB['ID'], |
|
61 | + ':value' => $artistDB[ 'ID' ], |
|
62 | 62 | ]); |
63 | - $console->writeLine("[INFO] New album ({$albumDB['ID']}) {$albumDB['post_title']}"); |
|
63 | + $console->writeLine("[INFO] New album ({$albumDB[ 'ID' ]}) {$albumDB[ 'post_title' ]}"); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | $songDB = $wpPost->findOneLyricByTitle($song->title); |
@@ -78,24 +78,24 @@ discard block |
||
78 | 78 | ]); |
79 | 79 | if ($albumDB != null) { |
80 | 80 | $wpPost->insertMeta([ |
81 | - ':post_id' => $songDB['ID'], |
|
81 | + ':post_id' => $songDB[ 'ID' ], |
|
82 | 82 | ':key' => 'theme2035_album_name', |
83 | - ':value' => $albumDB['ID'], |
|
83 | + ':value' => $albumDB[ 'ID' ], |
|
84 | 84 | ]); |
85 | 85 | } |
86 | 86 | if ($artistDB != null) { |
87 | 87 | $wpPost->insertMeta([ |
88 | - ':post_id' => $songDB['ID'], |
|
88 | + ':post_id' => $songDB[ 'ID' ], |
|
89 | 89 | ':key' => 'theme2035_album_name', |
90 | - ':value' => $artistDB['ID'], |
|
90 | + ':value' => $artistDB[ 'ID' ], |
|
91 | 91 | ]); |
92 | 92 | } |
93 | - $console->writeLine("[INFO] New lyrics ({$songDB['ID']}) {$songDB['post_title']}"); |
|
93 | + $console->writeLine("[INFO] New lyrics ({$songDB[ 'ID' ]}) {$songDB[ 'post_title' ]}"); |
|
94 | 94 | } |
95 | 95 | die; |
96 | 96 | } |
97 | 97 | $start = $start + $limit; |
98 | - } while (count($result['result']) < $limit); |
|
98 | + } while (count($result[ 'result' ]) < $limit); |
|
99 | 99 | } else { |
100 | 100 | } |
101 | 101 | } |
@@ -28,6 +28,6 @@ |
||
28 | 28 | ); |
29 | 29 | $body = json_decode(curl_exec($call)); |
30 | 30 | curl_close($call); |
31 | - return $body[0]; |
|
31 | + return $body[ 0 ]; |
|
32 | 32 | } |
33 | 33 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | public function findOneAlbumByName($albumName) |
12 | 12 | { |
13 | - $sql = 'SELECT * FROM muu_posts WHERE post_title = "%'.$albumName.'%" AND post_type="album";'; |
|
13 | + $sql = 'SELECT * FROM muu_posts WHERE post_title = "%' . $albumName . '%" AND post_type="album";'; |
|
14 | 14 | foreach ($this->pdo->query($sql) as $res) { |
15 | 15 | return $res; |
16 | 16 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function findOneLyricByTitle($title) |
20 | 20 | { |
21 | - $sql = 'SELECT * FROM muu_posts WHERE post_title = "'.$title.'" AND post_type="lyrics";'; |
|
21 | + $sql = 'SELECT * FROM muu_posts WHERE post_title = "' . $title . '" AND post_type="lyrics";'; |
|
22 | 22 | foreach ($this->pdo->query($sql) as $res) { |
23 | 23 | return $res; |
24 | 24 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function findOneArtistByName($artistName) |
28 | 28 | { |
29 | - $sql = 'SELECT * FROM muu_posts WHERE post_title = "'.$artistName.'" AND post_type="artist";'; |
|
29 | + $sql = 'SELECT * FROM muu_posts WHERE post_title = "' . $artistName . '" AND post_type="artist";'; |
|
30 | 30 | foreach ($this->pdo->query($sql) as $res) { |
31 | 31 | return $res; |
32 | 32 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | $sql->bindValue($key, $param); |
44 | 44 | } |
45 | 45 | if (!$sql->execute()) { |
46 | - var_dump($this->pdo->errorInfo());die; |
|
46 | + var_dump($this->pdo->errorInfo()); die; |
|
47 | 47 | } |
48 | 48 | $id = $this->pdo->lastInsertId(); |
49 | - $sql = 'SELECT * FROM muu_posts WHERE ID='.$id; |
|
49 | + $sql = 'SELECT * FROM muu_posts WHERE ID=' . $id; |
|
50 | 50 | foreach ($this->pdo->query($sql) as $res) { |
51 | 51 | return $res; |
52 | 52 | } |