35 public function actionIndex($channel =
false,$clear =
false) {
37 Yii::app()->getModule(
'apalines');
41 $channels = array($channel);
43 $channels = Yii::app()->getModule(
'apalines')->channels;
44 $channels = array_keys($channels);
46 $notExistFolders = array();
47 foreach ($channels as $name) {
49 if (!file_exists($ch->path)) {
50 $notExistFolders[] = $name;
54 foreach ($news as $line) {
58 $channels = implode(
', ', $channels);
59 echo
"News of the channels: {$channels} are removed\n";
60 if (!empty($notExistFolders)) {
61 $notExistFolders = implode(
', ', $notExistFolders);
62 echo
"Channel folders of: {$notExistFolders} are not exist\n";
68 echo
"Channel name is not passed";
72 $channel =
new Channel($channel);
74 if (!$channel->isNew()) {
75 echo
"Fertig.txt does not exist in the channel folder\n";
80 $channel->moveToWork();
81 $channel->processWork();
88 $incronPath =
"/var/spool/incron/root";
89 $module = Yii::app()->getModule(
'apalines');
90 $channels = $module->channels;
92 $yiicPath = Yii::getPathOfAlias(
'site.common').DIRECTORY_SEPARATOR.
"yiic";
93 $events =
"IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO";
95 foreach($channels as $alias => $channel){
97 $path = Yii::getPathOfAlias($channel[
'delivery_path']);
98 $command =
"$yiicPath processApa index --channel=$alias";
99 $incronContent .=
"$path $events $command\n";
102 file_put_contents($incronPath, $incronContent);