@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | $data = array(); |
77 | 77 | $clearCacheAfter = false; |
78 | 78 | |
79 | - foreach($cronJobs as $cronJob){ |
|
79 | + foreach ($cronJobs as $cronJob) { |
|
80 | 80 | $i = 0; |
81 | 81 | $numRows = 0; |
82 | 82 | try { |
83 | 83 | /** @var \mysqli|\Zend_Db_Statement_Pdo $query */ |
84 | 84 | $query = $this->container->get('wbm_query_manager.db')->query($cronJob['sqlString']); |
85 | - if($query instanceof \Zend_Db_Statement_Pdo) { |
|
85 | + if ($query instanceof \Zend_Db_Statement_Pdo) { |
|
86 | 86 | $query->closeCursor(); |
87 | 87 | } |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $snippets = $this->container->get('snippets')->getNamespace("backend/plugins/wbm/querymanager"); |
91 | 91 | |
92 | 92 | do { |
93 | - if($this->container->get('wbm_query_manager.db')->getColumnCount($query)){ |
|
93 | + if ($this->container->get('wbm_query_manager.db')->getColumnCount($query)) { |
|
94 | 94 | $records = $this->container->get('wbm_query_manager.db')->fetchAll($query); |
95 | 95 | $rowCount = $this->container->get('wbm_query_manager.db')->getRowCount($query); |
96 | 96 | $recordFields = array_keys($records[0]); |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | $csvPath = $this->container->get('application')->DocPath() . 'var/log/' . $file; |
103 | 103 | |
104 | 104 | $outputBuffer = fopen($csvPath, 'w'); |
105 | - foreach(array_merge(array(0 => $recordFields),$records) as $val) { |
|
105 | + foreach (array_merge(array(0 => $recordFields), $records) as $val) { |
|
106 | 106 | fputcsv($outputBuffer, $val, $this->container->get('config')->getByNamespace('WbmQueryManager', 'csv_field_separator')); |
107 | 107 | } |
108 | 108 | fclose($outputBuffer); |
109 | 109 | |
110 | 110 | $mailRecipient = $this->container->get('config')->getByNamespace('WbmQueryManager', 'mail_address_receiver'); |
111 | - if(!empty($cronJob['mailRecipient'])){ |
|
111 | + if (!empty($cronJob['mailRecipient'])) { |
|
112 | 112 | $mailRecipient = $cronJob['mailRecipient']; |
113 | 113 | } |
114 | - if(!empty($mailRecipient)){ |
|
114 | + if (!empty($mailRecipient)) { |
|
115 | 115 | $mail = clone $this->container->get('mail'); |
116 | 116 | $mail->setFrom($this->container->get('config')->get('mail')); |
117 | 117 | $mail->addTo($mailRecipient); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $mail->send(); |
128 | 128 | } |
129 | 129 | |
130 | - if(!$this->container->get('config')->getByNamespace('WbmQueryManager', 'log_csv')){ |
|
130 | + if (!$this->container->get('config')->getByNamespace('WbmQueryManager', 'log_csv')) { |
|
131 | 131 | unlink($csvPath); |
132 | 132 | } |
133 | 133 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $query = $this->container->get('models')->getRepository('WbmQueryManager\Models\Query')->find($cronJob['id']); |
148 | 148 | $query->setLastLog($result); |
149 | 149 | /** @var \DateTime $lastRun */ |
150 | - $lastRun = $query->getLastRun() ? : new \DateTime(); |
|
150 | + $lastRun = $query->getLastRun() ?: new \DateTime(); |
|
151 | 151 | $query->setLastRun($now); |
152 | 152 | $query->setNextRun($lastRun->add(\DateInterval::createFromDateString($query->getIntervalInt() . ' seconds'))); |
153 | 153 | |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | $this->container->get('models')->flush(); |
156 | 156 | $this->container->get('models')->clear(); |
157 | 157 | |
158 | - if($cronJob['clear_cache']){ |
|
158 | + if ($cronJob['clear_cache']) { |
|
159 | 159 | $clearCacheAfter = true; |
160 | 160 | } |
161 | 161 | |
162 | 162 | $data[$cronJob['name']] = $result; |
163 | 163 | } |
164 | 164 | |
165 | - if($clearCacheAfter){ |
|
165 | + if ($clearCacheAfter) { |
|
166 | 166 | $cacheManager = $this->container->get('shopware.cache_manager'); |
167 | 167 | $cacheManager->clearHttpCache(); |
168 | 168 | $cacheManager->clearTemplateCache(); |