Exemple #1
0
        $flag = isPresent($value, $collection);
        $type = "upcoming";
        if ($flag) {
            $result = $collection->updateOne(['name' => $value], ['$set' => array("lang" => $lang, "name" => $value, "type" => $type, "update_ts" => $current_ts)], ['upsert' => true]);
        } else {
            $result = $collection->insertOne(array("lang" => $lang, "name" => $value, "type" => $type, "insert_ts" => $current_ts));
        }
        //var_dump($result);
    }
}
//insert running movies into database
//$current_ts = date("Y/m/d h:i:sa");
foreach ($running_movies as $key => $value) {
    $lang = $key;
    foreach ($value as $key => $value) {
        $upcoming = isUpcoming($value, $collection);
        $type = "running";
        if ($upcoming) {
            $result = $collection->updateOne(['name' => $value], ['$set' => array("lang" => $lang, "name" => $value, "type" => $type, "prev_type" => "upcoming", "notify" => "true", "update_ts" => $current_ts)], ['upsert' => true]);
        } else {
            $running = isRunning($value, $collection);
            if ($running) {
                $result = $collection->updateOne(['name' => $value], ['$set' => array("lang" => $lang, "name" => $value, "type" => $type, "update_ts" => $current_ts)], ['upsert' => true]);
            } else {
                $result = $collection->insertOne(array("lang" => $lang, "name" => $value, "type" => $type, "notify" => "true", "insert_ts" => $current_ts));
            }
        }
    }
}
function isUpcoming($value, $collection)
{
Exemple #2
0
                                $key = $value;
                            } elseif ($value == "Music director") {
                                $key = $value;
                            } else {
                                $cast_crew[$key][] = $value;
                            }
                        }
                    }
                });
            });
            $actor = $cast_crew["Actors"];
            $director = $cast_crew["Director"];
            $music = $cast_crew["Music director"];
            unset($cast_crew);
        }
        $upcoming = isUpcoming($movie_name, $movies_collection);
        $type = "running";
        if ($upcoming) {
            $result = $movies_collection->updateOne(['name' => $movie_name], ['$set' => array("lang" => $lang, "name" => $movie_name, "type" => $type, "prev_type" => "upcoming", "booking_open_ts" => $current_ts, "notify" => "true", "update_ts" => $current_ts)], ['upsert' => true]);
            $events = $events_collection->insertOne(array("movie_name" => $movie_name, "event_type" => "UR", "notify" => 'true', "insert_ts" => $current_ts));
        } else {
            $running = isRunning($movie_name, $movies_collection);
            if ($running) {
                $result = $movies_collection->updateOne(['name' => $value], ['$set' => array("lang" => $lang, "name" => $value, "type" => $type, "update_ts" => $current_ts)], ['upsert' => true]);
            } else {
                $result = $movies_collection->insertOne(array("lang" => $lang, "name" => $movie_name, "type" => $type, "id" => $movie_id, "poster_url" => $poster_url, "link" => $movie_link, "actors" => $actor, "director" => $director, "music_director" => $music, "genre" => $genre, "producer" => $producer, "release_ts" => date("Y/m/d H:i:s", strtotime($release_ts)), "notify" => "true", "disabled" => "false", "insert_ts" => $current_ts));
                $events = $events_collection->insertOne(array("movie_name" => $movie_name, "event_type" => "FR", "notify" => 'true', "insert_ts" => $current_ts));
            }
        }
    }
}