-
Notifications
You must be signed in to change notification settings - Fork 977
/
addAllVideosIntoPPV.php
49 lines (41 loc) · 1.14 KB
/
addAllVideosIntoPPV.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
//streamer config
require_once '../videos/configuration.php';
ob_end_flush();
if (!isCommandLineInterface()) {
return die('Command Line only');
}
error_reporting(E_ALL);
ini_set('display_errors', 1);
$ppv = AVideoPlugin::loadPluginIfEnabled('PayPerView');
if (empty($ppv)) {
return die('PayPerView plugin not enabled');
}
$plans = PPV_Plans::getAllActive();
if(empty($plans)){
return die('there is no PPV plan');
}
$ppv_plans_id = 0;
if(count($plans) == 1){
$ppv_plans_id = $plans[0]['id'];
}else{
echo "What plan should I add?".PHP_EOL;
foreach ($plans as $key => $value) {
echo "{$value['id']} => {$value['name']}".PHP_EOL;
}
$ppv_plans_id = intval(readline(""));
}
echo "Will add in the PPV plan {$ppv_plans_id}".PHP_EOL;
if (!empty($ppv_plans_id)) {
$videos = Video::getAllVideosLight('', false, true);
foreach ($videos as $value) {
$plan = new PPV_Plans_Videos(0);
$plan->loadFromPlanVideo($ppv_plans_id, $value['id']);
$plan->setStatus('a');
$plan->save();
echo "Videos_id {$value['id']} saved".PHP_EOL;
}
}
echo "Bye";
echo "\n";
die();