PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.4
Booking for Appointments and Events Calendar – Amelia v2.4.4
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / sabre / vobject / bin / generateicalendardata.php
ameliabooking / vendor / sabre / vobject / bin Last commit date
bench.php 6 months ago bench_freebusygenerator.php 6 months ago bench_manipulatevcard.php 6 months ago fetch_windows_zones.php 1 year ago generate_vcards 1 year ago generateicalendardata.php 6 months ago mergeduplicates.php 6 months ago rrulebench.php 6 months ago vobject 1 year ago
generateicalendardata.php
88 lines
1 #!/usr/bin/env php
2 <?php
3
4 use AmeliaVendor\Sabre\VObject;
5
6 if ($argc < 2) {
7 $cmd = $argv[0];
8 fwrite(STDERR, <<<HI
9 Fruux test data generator
10
11 This script generates a lot of test data. This is used for profiling and stuff.
12 Currently it just generates events in a single calendar.
13
14 The iCalendar output goes to stdout. Other messages to stderr.
15
16 {$cmd} [events]
17
18
19 HI
20 );
21 exit();
22 }
23
24 $events = 100;
25
26 if (isset($argv[1])) {
27 $events = (int) $argv[1];
28 }
29
30 include __DIR__.'/../vendor/autoload.php';
31
32 fwrite(STDERR, 'Generating '.$events." events\n");
33
34 $currentDate = new DateTime('-'.round($events / 2).' days');
35
36 $calendar = new VObject\Component\VCalendar();
37
38 $ii = 0;
39
40 while ($ii < $events) {
41 ++$ii;
42
43 $event = $calendar->add('VEVENT');
44 $event->DTSTART = 'bla';
45 $event->SUMMARY = 'Event #'.$ii;
46 $event->UID = md5(microtime(true));
47
48 $doctorRandom = mt_rand(1, 1000);
49
50 switch ($doctorRandom) {
51 // All-day event
52 case 1:
53 $event->DTEND = 'bla';
54 $dtStart = clone $currentDate;
55 $dtEnd = clone $currentDate;
56 $dtEnd->modify('+'.mt_rand(1, 3).' days');
57 $event->DTSTART->setDateTime($dtStart);
58 $event->DTSTART['VALUE'] = 'DATE';
59 $event->DTEND->setDateTime($dtEnd);
60 break;
61 case 2:
62 $event->RRULE = 'FREQ=DAILY;COUNT='.mt_rand(1, 10);
63 // no break intentional
64 default:
65 $dtStart = clone $currentDate;
66 $dtStart->setTime(mt_rand(1, 23), mt_rand(0, 59), mt_rand(0, 59));
67 $event->DTSTART->setDateTime($dtStart);
68 $event->DURATION = 'PT'.mt_rand(1, 3).'H';
69 break;
70 }
71
72 $currentDate->modify('+ '.mt_rand(0, 3).' days');
73 }
74 fwrite(STDERR, "Validating\n");
75
76 $result = $calendar->validate();
77 if ($result) {
78 fwrite(STDERR, "Errors!\n");
79 fwrite(STDERR, print_r($result, true));
80 exit(-1);
81 }
82
83 fwrite(STDERR, "Serializing this beast\n");
84
85 echo $calendar->serialize();
86
87 fwrite(STDERR, "done.\n");
88