{"action":"created","comment":{"url":"https://api.github.com/repos/ding2/ding2/pulls/comments/225831468","pull_request_review_id":165514906,"id":225831468,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTgzMTQ2OA==","diff_hunk":"@@ -0,0 +1,240 @@\n+<?php\n+\n+/**\n+ * @file\n+ * Ding list rescue module for old lists and elements.\n+ * \n+ * Previous bugs have collided ids of different users lists.\n+ * Missing lists and elements can be rescued or reimported with this tool.\n+ * The module works by loading lists and elements from the previous entity \n+ * storage model and saving them to the pure remove service.\n+ */\n+\n+use DingList\\DingList;\n+use DingList\\DingListElement;\n+\n+/**\n+ * Implements hook_menu().\n+ */\n+function ding_listrescue_menu() {\n+  return array(\n+    'listecheck' => array(\n+      'title' => 'Rescue lists',\n+      'page callback' => 'drupal_get_form',\n+      'page arguments' => array('ding_listrescue_form'),\n+      'access arguments' => array('use personalisation'),\n+    ),\n+  );\n+}\n+\n+/**\n+ * Rescue form.\n+ */\n+function ding_listrescue_form($form, &$form_state) {\n+\n+  $intro = array(\n+    'header' => array(\n+      '#type' => 'html_tag',\n+      '#tag' => 'h2',\n+      '#value' => t(\"Rescue old lists\"),\n+    ),\n+    'content' => array(\n+      '#type' => 'html_tag',\n+      '#tag' => 'p',\n+      '#value' => t(\"This is a tool to attempt recovery of old lists\"),\n+    ),\n+  );\n+\n+  // Try to find elements from the previous storage model.\n+  try {\n+    $lists = ding_listrescue_get_local_lists();\n+    $cnt = count($lists);\n+    $details = array(\n+      'header' => array(\n+        '#type' => 'html_tag',\n+        '#tag' => 'h2',\n+        '#value' => t(\"Details\"),\n+      ),\n+      'lists' => array(\n+        '#type' => 'html_tag',\n+        '#tag' => 'pre',\n+        '#value' => $cnt > 0 ? t(\"Found @cnt lists to re-import\", array(\"@cnt\" => $cnt)) : t(\"No lists to re-import\"),\n+      ),\n+    );\n+\n+    // Enable submit button if previous lists was found.\n+    if ($cnt > 0) {\n+      $form['submit'] = array(\n+        '#type' => 'submit',\n+        '#value' => t('Proceed'),\n+      );\n+    }\n+  } \n+  catch (Exception $e) {\n+    $details = array(\n+      'header' => array(\n+        '#type' => 'html_tag',\n+        '#tag' => 'h2',\n+        '#value' => t(\"No local lists found\"),\n+      ),\n+    );\n+  }\n+\n+  $form['#prefix'] = render($intro) . render($details);\n+  \n+  return $form;\n+}\n+\n+/**\n+ * Rescue form submit.\n+ */\n+function ding_listrescue_form_submit($form, &$form_state) {\n+  global $user;\n+\n+  $form_state['rebuild'] = TRUE;\n+\n+  // Load the user object.\n+  $account = user_load($user->uid);","path":"modules/p2/ding_list/modules/ding_listrescue/ding_listrescue.module","position":97,"original_position":97,"commit_id":"2dff90dd7113a858f1c19c466b8326453b100bdd","original_commit_id":"2dff90dd7113a858f1c19c466b8326453b100bdd","user":{"login":"cableman","id":111397,"node_id":"MDQ6VXNlcjExMTM5Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/111397?v=4","gravatar_id":"","url":"https://api.github.com/users/cableman","html_url":"https://github.com/cableman","followers_url":"https://api.github.com/users/cableman/followers","following_url":"https://api.github.com/users/cableman/following{/other_user}","gists_url":"https://api.github.com/users/cableman/gists{/gist_id}","starred_url":"https://api.github.com/users/cableman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cableman/subscriptions","organizations_url":"https://api.github.com/users/cableman/orgs","repos_url":"https://api.github.com/users/cableman/repos","events_url":"https://api.github.com/users/cableman/events{/privacy}","received_events_url":"https://api.github.com/users/cableman/received_events","type":"User","site_admin":false},"body":"Why load the user account when you have the user object in $user?","created_at":"2018-10-17T08:43:08Z","updated_at":"2018-10-17T08:49:38Z","html_url":"https://github.com/ding2/ding2/pull/1224#discussion_r225831468","pull_request_url":"https://api.github.com/repos/ding2/ding2/pulls/1224","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments/225831468"},"html":{"href":"https://github.com/ding2/ding2/pull/1224#discussion_r225831468"},"pull_request":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1224"}}},"pull_request":{"url":"https://api.github.com/repos/ding2/ding2/pulls/1224","id":222913872,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyOTEzODcy","html_url":"https://github.com/ding2/ding2/pull/1224","diff_url":"https://github.com/ding2/ding2/pull/1224.diff","patch_url":"https://github.com/ding2/ding2/pull/1224.patch","issue_url":"https://api.github.com/repos/ding2/ding2/issues/1224","number":1224,"state":"open","locked":false,"title":"3744: Rescue module for OpenList","user":{"login":"martinb14","id":1502991,"node_id":"MDQ6VXNlcjE1MDI5OTE=","avatar_url":"https://avatars1.githubusercontent.com/u/1502991?v=4","gravatar_id":"","url":"https://api.github.com/users/martinb14","html_url":"https://github.com/martinb14","followers_url":"https://api.github.com/users/martinb14/followers","following_url":"https://api.github.com/users/martinb14/following{/other_user}","gists_url":"https://api.github.com/users/martinb14/gists{/gist_id}","starred_url":"https://api.github.com/users/martinb14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinb14/subscriptions","organizations_url":"https://api.github.com/users/martinb14/orgs","repos_url":"https://api.github.com/users/martinb14/repos","events_url":"https://api.github.com/users/martinb14/events{/privacy}","received_events_url":"https://api.github.com/users/martinb14/received_events","type":"User","site_admin":false},"body":"#### Link to issue\r\n\r\nhttps://platform.dandigbib.org/issues/3744\r\n\r\n#### Description\r\n\r\nA module for rescuing certain lists and elements\r\n\r\n\r\n","created_at":"2018-10-15T13:51:50Z","updated_at":"2018-10-17T08:49:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2584ce997319c397948a5b41d3530ce226892c7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ding2/ding2/pulls/1224/commits","review_comments_url":"https://api.github.com/repos/ding2/ding2/pulls/1224/comments","review_comment_url":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ding2/ding2/issues/1224/comments","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/2dff90dd7113a858f1c19c466b8326453b100bdd","head":{"label":"b14:b3744","ref":"b3744","sha":"2dff90dd7113a858f1c19c466b8326453b100bdd","user":{"login":"b14","id":2855819,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4NTU4MTk=","avatar_url":"https://avatars2.githubusercontent.com/u/2855819?v=4","gravatar_id":"","url":"https://api.github.com/users/b14","html_url":"https://github.com/b14","followers_url":"https://api.github.com/users/b14/followers","following_url":"https://api.github.com/users/b14/following{/other_user}","gists_url":"https://api.github.com/users/b14/gists{/gist_id}","starred_url":"https://api.github.com/users/b14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b14/subscriptions","organizations_url":"https://api.github.com/users/b14/orgs","repos_url":"https://api.github.com/users/b14/repos","events_url":"https://api.github.com/users/b14/events{/privacy}","received_events_url":"https://api.github.com/users/b14/received_events","type":"Organization","site_admin":false},"repo":{"id":55677883,"node_id":"MDEwOlJlcG9zaXRvcnk1NTY3Nzg4Mw==","name":"ding2","full_name":"b14/ding2","private":false,"owner":{"login":"b14","id":2855819,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI4NTU4MTk=","avatar_url":"https://avatars2.githubusercontent.com/u/2855819?v=4","gravatar_id":"","url":"https://api.github.com/users/b14","html_url":"https://github.com/b14","followers_url":"https://api.github.com/users/b14/followers","following_url":"https://api.github.com/users/b14/following{/other_user}","gists_url":"https://api.github.com/users/b14/gists{/gist_id}","starred_url":"https://api.github.com/users/b14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b14/subscriptions","organizations_url":"https://api.github.com/users/b14/orgs","repos_url":"https://api.github.com/users/b14/repos","events_url":"https://api.github.com/users/b14/events{/privacy}","received_events_url":"https://api.github.com/users/b14/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/b14/ding2","description":"Ding install profile","fork":true,"url":"https://api.github.com/repos/b14/ding2","forks_url":"https://api.github.com/repos/b14/ding2/forks","keys_url":"https://api.github.com/repos/b14/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/b14/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/b14/ding2/teams","hooks_url":"https://api.github.com/repos/b14/ding2/hooks","issue_events_url":"https://api.github.com/repos/b14/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/b14/ding2/events","assignees_url":"https://api.github.com/repos/b14/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/b14/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/b14/ding2/tags","blobs_url":"https://api.github.com/repos/b14/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/b14/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/b14/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/b14/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/b14/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/b14/ding2/languages","stargazers_url":"https://api.github.com/repos/b14/ding2/stargazers","contributors_url":"https://api.github.com/repos/b14/ding2/contributors","subscribers_url":"https://api.github.com/repos/b14/ding2/subscribers","subscription_url":"https://api.github.com/repos/b14/ding2/subscription","commits_url":"https://api.github.com/repos/b14/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/b14/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/b14/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/b14/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/b14/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/b14/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/b14/ding2/merges","archive_url":"https://api.github.com/repos/b14/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/b14/ding2/downloads","issues_url":"https://api.github.com/repos/b14/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/b14/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/b14/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/b14/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/b14/ding2/labels{/name}","releases_url":"https://api.github.com/repos/b14/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/b14/ding2/deployments","created_at":"2016-04-07T08:34:26Z","updated_at":"2016-05-26T14:27:47Z","pushed_at":"2018-10-16T09:03:09Z","git_url":"git://github.com/b14/ding2.git","ssh_url":"git@github.com:b14/ding2.git","clone_url":"https://github.com/b14/ding2.git","svn_url":"https://github.com/b14/ding2","homepage":"","size":96552,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ding2:master","ref":"master","sha":"948b639d0bf6d65622332fe0fa15ccb99b033be6","user":{"login":"ding2","id":564698,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NDY5OA==","avatar_url":"https://avatars0.githubusercontent.com/u/564698?v=4","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"repo":{"id":1266749,"node_id":"MDEwOlJlcG9zaXRvcnkxMjY2NzQ5","name":"ding2","full_name":"ding2/ding2","private":false,"owner":{"login":"ding2","id":564698,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2NDY5OA==","avatar_url":"https://avatars0.githubusercontent.com/u/564698?v=4","gravatar_id":"","url":"https://api.github.com/users/ding2","html_url":"https://github.com/ding2","followers_url":"https://api.github.com/users/ding2/followers","following_url":"https://api.github.com/users/ding2/following{/other_user}","gists_url":"https://api.github.com/users/ding2/gists{/gist_id}","starred_url":"https://api.github.com/users/ding2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ding2/subscriptions","organizations_url":"https://api.github.com/users/ding2/orgs","repos_url":"https://api.github.com/users/ding2/repos","events_url":"https://api.github.com/users/ding2/events{/privacy}","received_events_url":"https://api.github.com/users/ding2/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ding2/ding2","description":"Ding install profile","fork":false,"url":"https://api.github.com/repos/ding2/ding2","forks_url":"https://api.github.com/repos/ding2/ding2/forks","keys_url":"https://api.github.com/repos/ding2/ding2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ding2/ding2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ding2/ding2/teams","hooks_url":"https://api.github.com/repos/ding2/ding2/hooks","issue_events_url":"https://api.github.com/repos/ding2/ding2/issues/events{/number}","events_url":"https://api.github.com/repos/ding2/ding2/events","assignees_url":"https://api.github.com/repos/ding2/ding2/assignees{/user}","branches_url":"https://api.github.com/repos/ding2/ding2/branches{/branch}","tags_url":"https://api.github.com/repos/ding2/ding2/tags","blobs_url":"https://api.github.com/repos/ding2/ding2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ding2/ding2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ding2/ding2/git/refs{/sha}","trees_url":"https://api.github.com/repos/ding2/ding2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ding2/ding2/statuses/{sha}","languages_url":"https://api.github.com/repos/ding2/ding2/languages","stargazers_url":"https://api.github.com/repos/ding2/ding2/stargazers","contributors_url":"https://api.github.com/repos/ding2/ding2/contributors","subscribers_url":"https://api.github.com/repos/ding2/ding2/subscribers","subscription_url":"https://api.github.com/repos/ding2/ding2/subscription","commits_url":"https://api.github.com/repos/ding2/ding2/commits{/sha}","git_commits_url":"https://api.github.com/repos/ding2/ding2/git/commits{/sha}","comments_url":"https://api.github.com/repos/ding2/ding2/comments{/number}","issue_comment_url":"https://api.github.com/repos/ding2/ding2/issues/comments{/number}","contents_url":"https://api.github.com/repos/ding2/ding2/contents/{+path}","compare_url":"https://api.github.com/repos/ding2/ding2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ding2/ding2/merges","archive_url":"https://api.github.com/repos/ding2/ding2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ding2/ding2/downloads","issues_url":"https://api.github.com/repos/ding2/ding2/issues{/number}","pulls_url":"https://api.github.com/repos/ding2/ding2/pulls{/number}","milestones_url":"https://api.github.com/repos/ding2/ding2/milestones{/number}","notifications_url":"https://api.github.com/repos/ding2/ding2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ding2/ding2/labels{/name}","releases_url":"https://api.github.com/repos/ding2/ding2/releases{/id}","deployments_url":"https://api.github.com/repos/ding2/ding2/deployments","created_at":"2011-01-18T10:54:00Z","updated_at":"2018-10-11T13:53:36Z","pushed_at":"2018-10-16T15:37:38Z","git_url":"git://github.com/ding2/ding2.git","ssh_url":"git@github.com:ding2/ding2.git","clone_url":"https://github.com/ding2/ding2.git","svn_url":"https://github.com/ding2/ding2","homepage":"","size":95929,"stargazers_count":13,"watchers_count":13,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":48,"mirror_url":null,"archived":false,"open_issues_count":168,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":48,"open_issues":168,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1224"},"html":{"href":"https://github.com/ding2/ding2/pull/1224"},"issue":{"href":"https://api.github.com/repos/ding2/ding2/issues/1224"},"comments":{"href":"https://api.github.com/repos/ding2/ding2/issues/1224/comments"},"review_comments":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1224/comments"},"review_comment":{"href":"https://api.github.com/repos/ding2/ding2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ding2/ding2/pulls/1224/commits"},"statuses":{"href":"https://api.github.com/repos/ding2/ding2/statuses/2dff90dd7113a858f1c19c466b8326453b100bdd"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cableman"}}