2010-09-21 23:54:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
if (php_sapi_name() != 'cli') {
|
|
|
|
die('no');
|
|
|
|
}
|
|
|
|
|
2010-09-22 20:52:34 +01:00
|
|
|
define('INSTALLDIR', dirname(dirname(dirname(dirname(__FILE__)))));
|
2010-09-21 23:54:39 +01:00
|
|
|
|
|
|
|
require INSTALLDIR . "/scripts/commandline.inc";
|
|
|
|
|
2010-09-24 00:40:22 +01:00
|
|
|
$runner = YammerRunner::init();
|
2010-09-21 23:54:39 +01:00
|
|
|
|
2010-09-24 00:40:22 +01:00
|
|
|
switch ($runner->state())
|
|
|
|
{
|
|
|
|
case 'init':
|
|
|
|
$url = $runner->requestAuth();
|
|
|
|
echo "Log in to Yammer at the following URL and confirm permissions:\n";
|
|
|
|
echo "\n";
|
|
|
|
echo " $url\n";
|
|
|
|
echo "\n";
|
|
|
|
echo "Pass the resulting code back by running:\n"
|
|
|
|
echo "\n"
|
|
|
|
echo " php yammer-import.php --auth=####\n";
|
|
|
|
echo "\n";
|
|
|
|
break;
|
2010-09-21 23:54:39 +01:00
|
|
|
|
2010-09-24 00:40:22 +01:00
|
|
|
case 'requesting-auth':
|
|
|
|
if (empty($options['auth'])) {
|
|
|
|
echo "Please finish authenticating!\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$runner->saveAuthToken($options['auth']);
|
|
|
|
// Fall through...
|
2010-09-21 23:54:39 +01:00
|
|
|
|
2010-09-24 00:40:22 +01:00
|
|
|
default:
|
|
|
|
while (true) {
|
|
|
|
echo "... {$runner->state->state}\n";
|
|
|
|
if (!$runner->iterate()) {
|
|
|
|
echo "... done.\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|