@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $bits = explode('/', $path); |
77 | 77 | $bitsCurrent = []; |
78 | 78 | $parts = []; |
79 | - foreach($bits as $i => $bit) { |
|
79 | + foreach ($bits as $i => $bit) { |
|
80 | 80 | $bitsCurrent[] = $bit; |
81 | 81 | if ($i == 0) continue; |
82 | 82 | $parts[] = implode('/', $bitsCurrent); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param array $filters - array of additional search filters passed to Query where clause |
119 | 119 | * @return array|\yii\db\ActiveRecord[] |
120 | 120 | */ |
121 | - private function _listQuery($directory = '', $withDeleted=false, $filters=[]) |
|
121 | + private function _listQuery($directory = '', $withDeleted = false, $filters = []) |
|
122 | 122 | { |
123 | 123 | $directory = $this->getRealPath($directory); |
124 | 124 | $item = Media::findDirectoryByPath($directory, $withDeleted); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | return collect($items)->map(function($item) use ($filesIndex) { |
144 | 144 | $file = $filesIndex->get($item['id']); |
145 | - $item['concatName'] = $item['path'] .'/'. ($file ? $file['name'] : ''); |
|
145 | + $item['concatName'] = $item['path'].'/'.($file ? $file['name'] : ''); |
|
146 | 146 | $item['file'] = $file; |
147 | 147 | $item['path'] = Media::formatPath($item['path']); |
148 | 148 | return $item; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | /** |
153 | 153 | * @inheritDoc |
154 | 154 | */ |
155 | - public function listContents($directory = '', $withDeleted=false) |
|
155 | + public function listContents($directory = '', $withDeleted = false) |
|
156 | 156 | { |
157 | 157 | return $this->_listQuery($directory, $withDeleted); |
158 | 158 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $items = $query->all(); |
174 | 174 | |
175 | 175 | |
176 | - foreach($items as $key => $item) { |
|
176 | + foreach ($items as $key => $item) { |
|
177 | 177 | $items[$key]['path'] = Media::formatPath($item['path']); |
178 | 178 | } |
179 | 179 | return $items; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | /** |
183 | 183 | * @inheritDoc |
184 | 184 | */ |
185 | - public function addFile($id, $path='/') |
|
185 | + public function addFile($id, $path = '/') |
|
186 | 186 | { |
187 | 187 | // Find the file |
188 | 188 | $fileMeta = neon()->firefly->getMeta($id); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | |
257 | 257 | // make sure it does not already exist |
258 | - if (! empty(Media::findDirectoryByPath($newPath))) { |
|
258 | + if (!empty(Media::findDirectoryByPath($newPath))) { |
|
259 | 259 | throw new DirectoryExistsException("The directory '$newPath' already exists"); |
260 | 260 | } |
261 | 261 | $node->path = $newPath; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function setRootPath($path) |
290 | 290 | { |
291 | - $this->_rootPath = rtrim($path, '/') . '/'; |
|
291 | + $this->_rootPath = rtrim($path, '/').'/'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | ->where(['deleted' => 1]) |
354 | 354 | ->all(); |
355 | 355 | $destroyed = []; |
356 | - foreach($items as $item) { |
|
356 | + foreach ($items as $item) { |
|
357 | 357 | $destroyed[$item->id] = $item->destroy(); |
358 | 358 | } |
359 | 359 | return $destroyed; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $items = Media::findAll(['id' => $items]); |
379 | 379 | // update each item |
380 | 380 | $success = []; |
381 | - foreach($items as $item) { |
|
381 | + foreach ($items as $item) { |
|
382 | 382 | $success[$item->id] = $item->moveInto($into); |
383 | 383 | } |
384 | 384 | return $success; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function getRealPath($path) |
396 | 396 | { |
397 | - $path = $this->getRootPath() . ltrim($path, '/'); |
|
397 | + $path = $this->getRootPath().ltrim($path, '/'); |
|
398 | 398 | return strlen($path) === 1 ? '/' : rtrim($path, '/'); |
399 | 399 | } |
400 | 400 | } |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | }, $paths); |
49 | 49 | |
50 | 50 | if (empty($created)) { |
51 | - if ($directory == '') |
|
52 | - throw new DirectoryExistsException("The root directory already exists"); |
|
51 | + if ($directory == '') { |
|
52 | + throw new DirectoryExistsException("The root directory already exists"); |
|
53 | + } |
|
53 | 54 | throw new DirectoryExistsException("The directory '$directory' already exists"); |
54 | 55 | } |
55 | 56 | return $created; |
@@ -78,7 +79,9 @@ discard block |
||
78 | 79 | $parts = []; |
79 | 80 | foreach($bits as $i => $bit) { |
80 | 81 | $bitsCurrent[] = $bit; |
81 | - if ($i == 0) continue; |
|
82 | + if ($i == 0) { |
|
83 | + continue; |
|
84 | + } |
|
82 | 85 | $parts[] = implode('/', $bitsCurrent); |
83 | 86 | } |
84 | 87 | return $parts; |
@@ -91,14 +94,17 @@ discard block |
||
91 | 94 | */ |
92 | 95 | public function validateAbsoluteDirectoryPath($directory) |
93 | 96 | { |
94 | - if (!is_string($directory)) |
|
95 | - throw new InvalidDirectoryException("Invalid directory parameter '$directory'. The directory must be absolute string path and start with '/'."); |
|
97 | + if (!is_string($directory)) { |
|
98 | + throw new InvalidDirectoryException("Invalid directory parameter '$directory'. The directory must be absolute string path and start with '/'."); |
|
99 | + } |
|
96 | 100 | // must be absolute and start with / |
97 | - if ($directory[0] !== '/') |
|
98 | - throw new InvalidDirectoryException("Invalid directory parameter '$directory'. The directory must be absolute path and start with '/'."); |
|
101 | + if ($directory[0] !== '/') { |
|
102 | + throw new InvalidDirectoryException("Invalid directory parameter '$directory'. The directory must be absolute path and start with '/'."); |
|
103 | + } |
|
99 | 104 | // prevent folders with no names being created |
100 | - if (strpos($directory, '//') !== false) |
|
101 | - throw new InvalidDirectoryException("Invalid directory parameter '$directory'. You can not have empty path sections containing '//' each directory needs a name."); |
|
105 | + if (strpos($directory, '//') !== false) { |
|
106 | + throw new InvalidDirectoryException("Invalid directory parameter '$directory'. You can not have empty path sections containing '//' each directory needs a name."); |
|
107 | + } |
|
102 | 108 | } |
103 | 109 | |
104 | 110 | /** |
@@ -123,7 +129,9 @@ discard block |
||
123 | 129 | $directory = $this->getRealPath($directory); |
124 | 130 | $item = Media::findDirectoryByPath($directory, $withDeleted); |
125 | 131 | |
126 | - if (empty($item)) return []; |
|
132 | + if (empty($item)) { |
|
133 | + return []; |
|
134 | + } |
|
127 | 135 | |
128 | 136 | $m = Media::tableName(); |
129 | 137 | $f = FileManager::tableName(); |
@@ -132,8 +140,9 @@ discard block |
||
132 | 140 | ->orderBy("type ASC, $m.path, $f.name ASC") |
133 | 141 | ->leftJoin(FileManager::tableName(), "id = $f.uuid") |
134 | 142 | ->asArray(); |
135 | - if (!empty($filters)) |
|
136 | - $query->where($filters); |
|
143 | + if (!empty($filters)) { |
|
144 | + $query->where($filters); |
|
145 | + } |
|
137 | 146 | $items = $query->all(); |
138 | 147 | |
139 | 148 | $ids = collect($items)->pluck('id'); |
@@ -218,10 +227,11 @@ discard block |
||
218 | 227 | throw new BadRequestHttpException('A name cannot contain a "/" character'); |
219 | 228 | } |
220 | 229 | |
221 | - if ($node->isDir()) |
|
222 | - $this->_updateDirectoryName($node, $name); |
|
223 | - else |
|
224 | - $this->_updateFileName($node, $name); |
|
230 | + if ($node->isDir()) { |
|
231 | + $this->_updateDirectoryName($node, $name); |
|
232 | + } else { |
|
233 | + $this->_updateFileName($node, $name); |
|
234 | + } |
|
225 | 235 | return true; |
226 | 236 | } |
227 | 237 | |
@@ -297,7 +307,9 @@ discard block |
||
297 | 307 | public function getDirectoryMeta($path) |
298 | 308 | { |
299 | 309 | $dir = Media::findDirectoryByPath($path); |
300 | - if ($dir === null) return []; |
|
310 | + if ($dir === null) { |
|
311 | + return []; |
|
312 | + } |
|
301 | 313 | return $dir->toArray(); |
302 | 314 | } |
303 | 315 | |
@@ -307,7 +319,9 @@ discard block |
||
307 | 319 | public function getMeta($id) |
308 | 320 | { |
309 | 321 | $item = Media::find()->where(['id' => $id])->asArray()->one(); |
310 | - if ($item === null) return []; |
|
322 | + if ($item === null) { |
|
323 | + return []; |
|
324 | + } |
|
311 | 325 | if ($item['type'] === 'file') { |
312 | 326 | $item['file'] = neon()->firefly->fileManager->getMeta($id); |
313 | 327 | } |
@@ -320,8 +334,9 @@ discard block |
||
320 | 334 | public function delete($id) |
321 | 335 | { |
322 | 336 | $item = Media::findOne($id); |
323 | - if ($item === null) |
|
324 | - throw new NotFoundHttpException("No item with id '$id' could be found'"); |
|
337 | + if ($item === null) { |
|
338 | + throw new NotFoundHttpException("No item with id '$id' could be found'"); |
|
339 | + } |
|
325 | 340 | $result = $item->delete(); |
326 | 341 | if ($result === false) { |
327 | 342 | return $item->getErrors(); |
@@ -335,8 +350,9 @@ discard block |
||
335 | 350 | public function destroy($id) |
336 | 351 | { |
337 | 352 | $item = Media::findWithDeleted()->where(['id' => $id])->one(); |
338 | - if ($item === null) |
|
339 | - throw new NotFoundHttpException("No item with id '$id' could be found'"); |
|
353 | + if ($item === null) { |
|
354 | + throw new NotFoundHttpException("No item with id '$id' could be found'"); |
|
355 | + } |
|
340 | 356 | return $item->destroy(); |
341 | 357 | } |
342 | 358 | |
@@ -368,11 +384,13 @@ discard block |
||
368 | 384 | $into = Media::findOne($intoId); |
369 | 385 | |
370 | 386 | // throw error if it doesn't exist |
371 | - if ($into === null) |
|
372 | - throw new NotFoundHttpException("No item with id '$intoId' could be found'"); |
|
387 | + if ($into === null) { |
|
388 | + throw new NotFoundHttpException("No item with id '$intoId' could be found'"); |
|
389 | + } |
|
373 | 390 | // throw error if its not a directory |
374 | - if (!$into->isDir()) |
|
375 | - throw new BadRequestHttpException("This is not a directory - you can only move items into directories"); |
|
391 | + if (!$into->isDir()) { |
|
392 | + throw new BadRequestHttpException("This is not a directory - you can only move items into directories"); |
|
393 | + } |
|
376 | 394 | |
377 | 395 | // find all items to move |
378 | 396 | $items = Media::findAll(['id' => $items]); |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | * @since 3.8.0 |
82 | 82 | * |
83 | 83 | */ |
84 | - function __construct($name, $attrs, $innerBlocks, $innerHTML, $innerContent, $uuid=null) |
|
84 | + function __construct($name, $attrs, $innerBlocks, $innerHTML, $innerContent, $uuid = null) |
|
85 | 85 | { |
86 | 86 | $this->cmp = $name; |
87 | 87 | $this->props = $attrs; |
88 | 88 | //$this->innerBlocks = $innerBlocks; |
89 | 89 | //$this->innerHTML = $innerHTML; |
90 | 90 | //$this->innerContent = $innerContent; |
91 | - if (isset($attrs['uuid']) ) { |
|
91 | + if (isset($attrs['uuid'])) { |
|
92 | 92 | $uuid = $attrs['uuid']; |
93 | 93 | } |
94 | 94 | $this->uuid = $uuid ? $uuid : Hash::uuid64(); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | if (0 === $stack_depth) { |
301 | 301 | if (isset($leading_html_start)) { |
302 | 302 | $uuid = Hash::uuid64(); |
303 | - $this->output[$uuid] = (array)self::freeform( |
|
303 | + $this->output[$uuid] = (array) self::freeform( |
|
304 | 304 | substr( |
305 | 305 | $this->document, |
306 | 306 | $leading_html_start, |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ), $uuid |
309 | 309 | ); |
310 | 310 | } |
311 | - $cmp = (array)new Cmp($block_name, $attrs, array(), '', array(), $uuid); |
|
311 | + $cmp = (array) new Cmp($block_name, $attrs, array(), '', array(), $uuid); |
|
312 | 312 | $this->output[$cmp->uuid] = $cmp; |
313 | 313 | $this->offset = $start_offset + $token_length; |
314 | 314 | return true; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $is_void = isset($matches['void']) && -1 !== $matches['void'][1]; |
424 | 424 | $namespace = $matches['namespace']; |
425 | 425 | $namespace = (isset($namespace) && -1 !== $namespace[1]) ? $namespace[0] : ''; // 'core/'; |
426 | - $name = $namespace . $matches['name'][0]; |
|
426 | + $name = $namespace.$matches['name'][0]; |
|
427 | 427 | $has_attrs = isset($matches['attrs']) && -1 !== $matches['attrs'][1]; |
428 | 428 | /* |
429 | 429 | * Fun fact! It's not trivial in PHP to create "an empty associative array" since all arrays |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | return; |
478 | 478 | } |
479 | 479 | $uuid = Hash::uuid64(); |
480 | - $this->output[$uuid] = (array)self::freeform(substr($this->document, $this->offset, $length), $uuid); |
|
480 | + $this->output[$uuid] = (array) self::freeform(substr($this->document, $this->offset, $length), $uuid); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | } |
527 | 527 | if (isset($stack_top->leading_html_start)) { |
528 | 528 | $uuid = Hash::uuid64(); |
529 | - $this->output[$uuid] = (array)self::freeform( |
|
529 | + $this->output[$uuid] = (array) self::freeform( |
|
530 | 530 | substr( |
531 | 531 | $this->document, |
532 | 532 | $stack_top->leading_html_start, |
@@ -534,6 +534,6 @@ discard block |
||
534 | 534 | ), $uuid |
535 | 535 | ); |
536 | 536 | } |
537 | - $this->output[$stack_top->block->uuid] = (array)$stack_top->block; |
|
537 | + $this->output[$stack_top->block->uuid] = (array) $stack_top->block; |
|
538 | 538 | } |
539 | 539 | } |
540 | 540 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | class CmpManager extends \yii\base\Component |
11 | 11 | { |
12 | - public function getComponents(){ |
|
12 | + public function getComponents() { |
|
13 | 13 | |
14 | 14 | } |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param array $themeHierarchy |
34 | 34 | * @throws \SmartyException |
35 | 35 | */ |
36 | - public function __construct($page=null, array $themeHierarchy=[]) |
|
36 | + public function __construct($page = null, array $themeHierarchy = []) |
|
37 | 37 | { |
38 | 38 | parent::__construct(); |
39 | 39 | // $this->smarty->escape_html = true; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | |
74 | 74 | // We have to set cachable to false otherwise it only caches the id output not the full rendering |
75 | 75 | $this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'widget', ['\neon\cms\components\Widget', 'factory'], false); |
76 | - $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'editor', ['\neon\cms\components\Editor', 'editor'] , false); |
|
77 | - $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'drop_zone', ['\neon\cms\components\Editor', 'editor'] , false); |
|
76 | + $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'editor', ['\neon\cms\components\Editor', 'editor'], false); |
|
77 | + $this->smarty->registerPlugin(Smarty::PLUGIN_BLOCK, 'drop_zone', ['\neon\cms\components\Editor', 'editor'], false); |
|
78 | 78 | |
79 | 79 | $this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'dds', ['\neon\cms\components\Daedalus', 'dds'], false); |
80 | 80 | $this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'dds_choice', ['\neon\cms\components\Daedalus', 'dds_choice'], false); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @return string |
207 | 207 | * @throws \SmartyException |
208 | 208 | */ |
209 | - public function renderString($string, $saveCompile=true) |
|
209 | + public function renderString($string, $saveCompile = true) |
|
210 | 210 | { |
211 | 211 | $smartyCmd = $saveCompile ? 'string' : 'eval'; |
212 | 212 | return $this->smarty->fetch("$smartyCmd:$string"); |
@@ -48,12 +48,14 @@ discard block |
||
48 | 48 | // set up the theme directories |
49 | 49 | foreach ($themeHierarchy as $theme) { |
50 | 50 | if (isset($theme['templates'])) { |
51 | - foreach ($theme['templates'] as $tplDir) |
|
52 | - $this->smarty->addTemplateDir($tplDir); |
|
51 | + foreach ($theme['templates'] as $tplDir) { |
|
52 | + $this->smarty->addTemplateDir($tplDir); |
|
53 | + } |
|
53 | 54 | } |
54 | 55 | if (isset($theme['plugins'])) { |
55 | - foreach ($theme['plugins'] as $pluginDir) |
|
56 | - $this->smarty->addPluginsDir($pluginDir); |
|
56 | + foreach ($theme['plugins'] as $pluginDir) { |
|
57 | + $this->smarty->addPluginsDir($pluginDir); |
|
58 | + } |
|
57 | 59 | } |
58 | 60 | } |
59 | 61 | |
@@ -158,7 +160,9 @@ discard block |
||
158 | 160 | |
159 | 161 | public static function component($params, $content, $tagName, $template, $repeat) |
160 | 162 | { |
161 | - if ($repeat) return; |
|
163 | + if ($repeat) { |
|
164 | + return; |
|
165 | + } |
|
162 | 166 | $params['content'] = $content; |
163 | 167 | $params['slot'] = $content; |
164 | 168 | $params['type'] = $tagName; |
@@ -187,8 +191,9 @@ discard block |
||
187 | 191 | $this->smarty->assign('site', $this->_page->getSiteData()); |
188 | 192 | |
189 | 193 | // an expensive-ish call so reduce need for it in repeated renders |
190 | - if (!isset($templates[$template])) |
|
191 | - $templates[$template] = $this->smarty->createTemplate($template); |
|
194 | + if (!isset($templates[$template])) { |
|
195 | + $templates[$template] = $this->smarty->createTemplate($template); |
|
196 | + } |
|
192 | 197 | $tpl = $templates[$template]; |
193 | 198 | |
194 | 199 | // reset any parameters for the new render |
@@ -27,7 +27,7 @@ |
||
27 | 27 | 'layout' => 'string COMMENT "the name of the layout template to load for this page"', |
28 | 28 | 'template' => 'string COMMENT "the name of the template file"' |
29 | 29 | ]); |
30 | - $this->createTable(CmsUrl::tableName(),[ |
|
30 | + $this->createTable(CmsUrl::tableName(), [ |
|
31 | 31 | 'id' => 'pk', |
32 | 32 | 'url' => 'string', |
33 | 33 | 'page_id' => 'int', |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->run('Generating Page UUIDs and nice_ids', function() { |
45 | 45 | // the soft delete column has not been added yet - so lets turn off this behaviour! |
46 | 46 | CmsPage::$softDelete = false; |
47 | - foreach(CmsPage::find()->each(100) as $page) { |
|
47 | + foreach (CmsPage::find()->each(100) as $page) { |
|
48 | 48 | $page->id = CmsPage::uuid64(); |
49 | 49 | $page->nice_id = "page_{$page->old_id}"; |
50 | 50 | $page->save(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | "UPDATE $cms_url INNER JOIN $cms_page ON $cms_page.nice_id = $cms_url.page_id SET `page_id` = $cms_page.old_id" |
93 | 93 | ); |
94 | 94 | $this->execute("UPDATE $cms_page SET `id` = `old_id`"); |
95 | - $this->alterColumn($cms_page, 'id', $this->integer(11) . ' NOT NULL AUTO_INCREMENT'); |
|
95 | + $this->alterColumn($cms_page, 'id', $this->integer(11).' NOT NULL AUTO_INCREMENT'); |
|
96 | 96 | $this->dropColumn($cms_page, 'old_id'); |
97 | 97 | $this->dropColumn($cms_page, 'nice_id'); |
98 | 98 | $this->alterColumn($cms_url, 'page_id', $this->integer(11)->comment('cms_page foreign key')); |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | class m170107_201653_cms_create_cms_static_content_table_again extends Migration |
6 | 6 | { |
7 | - public function safeUp() |
|
8 | - { |
|
7 | + public function safeUp() |
|
8 | + { |
|
9 | 9 | $cms_static = 'cms_static_content'; |
10 | 10 | |
11 | 11 | // recreate the table with the new structure |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | // } |
47 | 47 | // } |
48 | 48 | // } while ($count < $total); |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - public function safeDown() |
|
52 | - { |
|
51 | + public function safeDown() |
|
52 | + { |
|
53 | 53 | $this->dropTable('cms_static_content'); |
54 | - } |
|
54 | + } |
|
55 | 55 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | // recreate the table with the new structure |
12 | 12 | $this->execute("DROP TABLE IF EXISTS $cms_static"); |
13 | - $sql =<<<EOQ |
|
13 | + $sql = <<<EOQ |
|
14 | 14 | CREATE TABLE IF NOT EXISTS `cms_static_content` ( |
15 | 15 | `key` varchar(100) NOT NULL COMMENT 'a key to access the content' COLLATE utf8mb4_unicode_ci, |
16 | 16 | `page_id` INT UNSIGNED NULL COMMENT 'if provided, restrict content to the associated page', |
@@ -7,23 +7,23 @@ |
||
7 | 7 | |
8 | 8 | class m170112_201653_cms_static_content_page_ids_to_uuid64 extends Migration |
9 | 9 | { |
10 | - public function safeUp() |
|
11 | - { |
|
12 | - $cms_static_content = CmsStaticContent::tableName(); |
|
10 | + public function safeUp() |
|
11 | + { |
|
12 | + $cms_static_content = CmsStaticContent::tableName(); |
|
13 | 13 | $cms_page = CmsPage::tableName(); |
14 | 14 | |
15 | 15 | // use a nice id |
16 | - $this->alterColumn($cms_static_content, 'page_id', $this->char(22)->null()->comment('A uuid using base 64')); |
|
16 | + $this->alterColumn($cms_static_content, 'page_id', $this->char(22)->null()->comment('A uuid using base 64')); |
|
17 | 17 | // update with nice_id's |
18 | 18 | $this->execute("UPDATE $cms_static_content JOIN $cms_page ON $cms_page.old_id = $cms_static_content.page_id SET $cms_static_content.page_id = $cms_page.id"); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | - public function safeDown() |
|
22 | - { |
|
21 | + public function safeDown() |
|
22 | + { |
|
23 | 23 | $cms_static_content = CmsStaticContent::tableName(); |
24 | 24 | $cms_page = CmsPage::tableName(); |
25 | 25 | |
26 | 26 | $this->execute("UPDATE $cms_static_content JOIN $cms_page ON $cms_page.id = $cms_static_content.page_id SET $cms_static_content.page_id = $cms_page.old_id"); |
27 | 27 | $this->alterColumn($cms_static_content, 'page_id', $this->integer(11)->null()); |
28 | - } |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
10 | 10 | // created by an earlier cms migration so always appears if the |
11 | 11 | // migration creation order is not adhered to. |
12 | 12 | $connection = neon()->db; |
13 | -$sql =<<<EOQ |
|
13 | +$sql = <<<EOQ |
|
14 | 14 | SET foreign_key_checks = 0; |
15 | 15 | DROP TABLE IF EXISTS `ddt_cms_static_content`; |
16 | 16 | DELETE FROM `dds_member` WHERE `class_type`='cms_static_content'; |