This repository was archived by the owner on Jan 28, 2024. It is now read-only.
File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace presentator \api \commands ;
3
+
4
+ use Yii ;
5
+ use yii \console \Controller ;
6
+ use yii \helpers \Console ;
7
+ use presentator \api \models \Screen ;
8
+
9
+ /**
10
+ * Provides helper functions related to the project screens (eg. thumbs generation).
11
+ *
12
+ * @author Gani Georgiev <[email protected] >
13
+ */
14
+ class ScreensController extends Controller
15
+ {
16
+ /**
17
+ * {@inheritdoc}
18
+ */
19
+ public $ color = true ;
20
+
21
+ /**
22
+ * Regenerates all project screen thumbs.
23
+ *
24
+ * Example usage:
25
+ * ```bash
26
+ * php yii screens/generate-thumbs
27
+ * ```
28
+ *
29
+ * @return integer
30
+ */
31
+ public function actionGenerateThumbs ()
32
+ {
33
+ $ thumbsCount = 0 ;
34
+ foreach (Screen::find ()->each () as $ screen ) {
35
+ $ this ->stdout ('Creating thumbs for screen ' . $ screen ->filePath . '... ' , Console::FG_YELLOW );
36
+ $ this ->stdout (PHP_EOL );
37
+
38
+ $ thumbsCount += $ screen ->createThumbs ();
39
+ }
40
+
41
+ $ this ->stdout ('Successfully created ' . $ thumbsCount . ' thumb(s). ' , Console::BG_GREEN );
42
+ $ this ->stdout (PHP_EOL );
43
+
44
+ return self ::EXIT_CODE_NORMAL ;
45
+ }
46
+ }
You can’t perform that action at this time.
0 commit comments