README 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Yammer Import Plugin
  2. ====================
  3. This plugin allows a one-time import pulling user accounts, groups, and
  4. public messages from an existing Yammer instance, using Yammer's public API.
  5. Requirements
  6. ------------
  7. * An account on the Yammer network you wish to import from
  8. * An administrator account on the target StatusNet instance, or
  9. command-line administrative access
  10. * This YammerImport plugin enabled on your StatusNet instance
  11. Limitations
  12. -----------
  13. Yammer API key registrations only work for your own network unless you make
  14. arrangements for a 'trusted app' key, so for now users will need to register
  15. the app themselves. There is a helper in the admin panel for this.
  16. In theory any number of users, groups, and messages should be supported, but
  17. it hasn't been fully tested on non-trivial-sized sites.
  18. No provision has yet been made for dealing with conflicting usernames or
  19. group names, or names which are not considered valid by StatusNet. Errors
  20. are possible.
  21. Running via the web admin interface requires having queueing enabled, and is
  22. fairly likely to have problems with the application key registration step in
  23. a small installation at this time.
  24. Web setup
  25. ---------
  26. The import process is runnable through an administration panel on your
  27. StatusNet site. The user interface is still a bit flaky, however, and if
  28. errors occur during import the process may stop with no way to restart it
  29. visible.
  30. The admin interface will probably kinda blow up if JS/AJAX isn't working.
  31. You'll be prompted to register the application and authenticate into Yammer,
  32. after which a progress screen will display.
  33. Two big warnings:
  34. * The progress display does not currently auto-refresh.
  35. * If anything fails once actual import has begun, it'll just keep showing
  36. the current state. You won't see an error message, and there's no way
  37. to reset or restart from the web UI yet.
  38. You can continue or reset the import state using the command-line script.
  39. CLI setup
  40. ---------
  41. You'll need to register an application consumer key to allow the importer
  42. to connect to your Yammer network; this requires logging into Yammer:
  43. https://www.yammer.com/client_applications/new
  44. Check all the 'read' options; no 'write' options are required, but Yammer
  45. seems to end up setting them anyway.
  46. You can set the resulting keys directly in config.php:
  47. $config['yammer']['consumer_key'] = '#####';
  48. $config['yammer']['consumer_secret'] = '##########';
  49. Initiate authentication by starting up the importer script:
  50. php plugins/YammerImport/scripts/yammer-import.php
  51. Since you haven't yet authenticated, this will request an auth token and
  52. give you a URL to open in your web browser. Once logged in and authorized
  53. there, you'll be given a confirmation code. Pass this back:
  54. php plugins/YammerImport/scripts/yammer-import.php --verify=####
  55. If all is well, the import process will begin and run through the end.
  56. In case of error or manual abort, you should be able to continue the
  57. import from where you left off by running the script again:
  58. php plugins/YammerImport/scripts/yammer-import.php
  59. To reset the Yammer import state -- without removing any of the items
  60. that have already been imported -- you can pass the --reset option:
  61. php plugins/YammerImport/scripts/yammer-import.php --reset
  62. This'll let you start over from the requesting-authentication stage.
  63. Any users, groups, or notices that have already been imported will be
  64. retained.
  65. Subscriptions and group memberships
  66. -----------------------------------
  67. Yammer's API does not expose user/tag subscriptions or group memberships
  68. except for the authenticating user. As a result, users will need to re-join
  69. groups and re-follow their fellow users after the import.
  70. (This limitation may be lifted in future for sites on the Silver or Gold
  71. plans where the import is done by a verified admin, as it should be possible
  72. to fetch the information for each user via the admin account.)
  73. Authentication
  74. --------------
  75. Account passwords cannot be retrieved, but the primary e-mail address is
  76. retained so users can reset their passwords by mail if you're not using a
  77. custom authentication system like LDAP.
  78. Private messages and groups
  79. ---------------------------
  80. At this time, only public messages are imported; private direct and group
  81. messages are ignored. (This may change with Silver and Gold plans in future.)
  82. Yammer groups may be either public or private. Groups in StatusNet currently
  83. have no privacy option, so any private groups will become public groups in the
  84. imported site.
  85. Attachments
  86. -----------
  87. Attached image and document files will be copied in as if they had been
  88. uploaded to the StatusNet site. Currently images do not display inline like
  89. they do on Yammer; they will be linked instead.
  90. File type and size limitations on attachments will be applied, so beware some
  91. attachments may not make it through.
  92. Code structure
  93. ==============
  94. Standalone classes
  95. ------------------
  96. YammerRunner: encapsulates the iterative process of retrieving the various users,
  97. groups, and messages via SNYammerClient and saving them locally
  98. via YammerImporter.
  99. SNYammerClient: encapsulates HTTP+OAuth interface to Yammer API, returns data
  100. as straight decoded JSON object trees.
  101. YammerImporter: encapsulates logic to pull information from the returned API data
  102. and convert them to native StatusNet users, groups, and messages.
  103. Web UI actions
  104. -------------
  105. YammeradminpanelAction: web panel for site administrator to initiate and monitor
  106. the import process.
  107. Command-line scripts
  108. --------------------
  109. yammer-import.php: CLI script to start a Yammer import run in one go.
  110. Database objects
  111. ----------------
  112. Yammer_state: data object storing YammerRunner's state between iterations.
  113. Yammer_notice_stub: data object for temporary storage of fetched Yammer messages
  114. between fetching them (reverse chron order) and saving them
  115. to local messages (forward chron order).
  116. Yammer_user,
  117. Yammer_group,
  118. Yammer_notice: data objects mapping original Yammer item IDs to their local copies.