Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.

Commit 9ceb91f

Browse files
Seth BattisSeth Battis
authored andcommitted
No more pussy-footin' around
Just call PHP from the command line. It's easier and cleaner. Signed-off-by: Seth Battis <[email protected]>
1 parent f5170c6 commit 9ceb91f

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

import.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929

3030
require_once(__DIR__ . '/common.inc.php');
3131

32+
if (isset($argc)) {
33+
$_REQUEST['cal'] = $argv[1];
34+
$_REQUEST['canvas_url'] = $argv[2];
35+
$_REQUEST['schedule'] = $argv[3];
36+
}
37+
3238
/**
3339
* compute the calendar context for the canvas object based on its URL
3440
**/

sync.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
require_once(APP_PATH . '/include/canvas-api.inc.php');
77
require_once(APP_PATH . '/include/mysql.inc.php');
8-
require_once(APP_PATH . '/include/Pest.php');
98

109
require_once(__DIR__ . '/common.inc.php');
1110

@@ -19,7 +18,6 @@
1918
`synced` ASC
2019
");
2120

22-
$import = new Pest(preg_replace('%(https?://)(.*)%', '\\1' . MYSQL_USER . ':' . MYSQL_PASSWORD . '@\\2', $argv[INDEX_WEB_PATH]));
2321
while($schedule = $schedulesResponse->fetch_assoc()) {
2422
$calendarResponse = mysqlQuery("
2523
SELECT *
@@ -28,19 +26,7 @@
2826
`id` = '{$schedule['calendar']}'
2927
");
3028
if ($calendar = $calendarResponse->fetch_assoc()) {
31-
try {
32-
$import->get(
33-
'import', // assumes ../.htaccess with RewriteCond
34-
array(
35-
'cal' => $calendar['ics_url'],
36-
'canvas_url' => $calendar['canvas_url'],
37-
'schedule' => $schedule['id']
38-
)
39-
);
40-
} catch (Exception $e) {
41-
debugFlag($e->getMessage());
42-
exit;
43-
}
29+
shell_exec("php import.php {$calendar['ics_url']} {$calendar['canvas_url']} {$schedule['id']}");
4430
}
4531
}
4632

0 commit comments

Comments
 (0)