{"action":"closed","number":9861,"pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/9861","id":106901372,"html_url":"https://github.com/civicrm/civicrm-core/pull/9861","diff_url":"https://github.com/civicrm/civicrm-core/pull/9861.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/9861.patch","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/9861","number":9861,"state":"closed","locked":false,"title":"CRM-20059: rebuild menu and caches before running extension upgraders","user":{"login":"omarabuhussein","id":6275540,"avatar_url":"https://avatars.githubusercontent.com/u/6275540?v=3","gravatar_id":"","url":"https://api.github.com/users/omarabuhussein","html_url":"https://github.com/omarabuhussein","followers_url":"https://api.github.com/users/omarabuhussein/followers","following_url":"https://api.github.com/users/omarabuhussein/following{/other_user}","gists_url":"https://api.github.com/users/omarabuhussein/gists{/gist_id}","starred_url":"https://api.github.com/users/omarabuhussein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omarabuhussein/subscriptions","organizations_url":"https://api.github.com/users/omarabuhussein/orgs","repos_url":"https://api.github.com/users/omarabuhussein/repos","events_url":"https://api.github.com/users/omarabuhussein/events{/privacy}","received_events_url":"https://api.github.com/users/omarabuhussein/received_events","type":"User","site_admin":false},"body":"When running extension upgraders from API using Extension.upgrade end-point ( e.g : drush cvapi Extension.upgrade ) then and before running the upgraders, civicrm will call : \r\n\r\n**CRM_Core_Invoke::rebuildMenuAndCaches(TRUE);**\r\n\r\nwhich clear cache, rebuild menus, and most importantly ; it will run managed entity handler which may create,remove , update any managed entity needed .\r\n\r\n The things are different when running upgrader from UI ( from Extension manager page ) where that line of code is not called inside UI upgrader handler code which cause difference when running upgraders from UI vs running them from API if you have an extension that use managed entities .\r\n\r\n Look here to see the difference in code between UI & API : \r\n\r\n- API : https://github.com/omarabuhussein/civicrm-core/blob/master/api/v3/Extension.php#L86 \r\n- UI : https://github.com/omarabuhussein/civicrm-core/blob/master/CRM/Admin/Page/ExtensionsUpgrade.php#L13 \r\n\r\nSo what is required is to update that UI handler code to call : **CRM_Core_Invoke::rebuildMenuAndCaches(TRUE);** before running upgraders to match what happen at API side .\r\n\r\n---\r\n\r\n * [CRM-20059: running managed entites handler , clear cache and rebuild menus when running extension upgraders from UI](https://issues.civicrm.org/jira/browse/CRM-20059)","created_at":"2017-02-19T13:35:38Z","updated_at":"2017-02-24T21:26:26Z","closed_at":"2017-02-24T21:26:26Z","merged_at":null,"merge_commit_sha":"2484fa6cfc812757847039f8cc528604fca99f14","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/9861/commits","review_comments_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/9861/comments","review_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/9861/comments","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/02e66fdd0f2b23de285b508e5a11fa8500c21288","head":{"label":"omarabuhussein:CRM-20059-ui-extension-upgrade-clear-cache","ref":"CRM-20059-ui-extension-upgrade-clear-cache","sha":"02e66fdd0f2b23de285b508e5a11fa8500c21288","user":{"login":"omarabuhussein","id":6275540,"avatar_url":"https://avatars.githubusercontent.com/u/6275540?v=3","gravatar_id":"","url":"https://api.github.com/users/omarabuhussein","html_url":"https://github.com/omarabuhussein","followers_url":"https://api.github.com/users/omarabuhussein/followers","following_url":"https://api.github.com/users/omarabuhussein/following{/other_user}","gists_url":"https://api.github.com/users/omarabuhussein/gists{/gist_id}","starred_url":"https://api.github.com/users/omarabuhussein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omarabuhussein/subscriptions","organizations_url":"https://api.github.com/users/omarabuhussein/orgs","repos_url":"https://api.github.com/users/omarabuhussein/repos","events_url":"https://api.github.com/users/omarabuhussein/events{/privacy}","received_events_url":"https://api.github.com/users/omarabuhussein/received_events","type":"User","site_admin":false},"repo":{"id":55993210,"name":"civicrm-core","full_name":"omarabuhussein/civicrm-core","owner":{"login":"omarabuhussein","id":6275540,"avatar_url":"https://avatars.githubusercontent.com/u/6275540?v=3","gravatar_id":"","url":"https://api.github.com/users/omarabuhussein","html_url":"https://github.com/omarabuhussein","followers_url":"https://api.github.com/users/omarabuhussein/followers","following_url":"https://api.github.com/users/omarabuhussein/following{/other_user}","gists_url":"https://api.github.com/users/omarabuhussein/gists{/gist_id}","starred_url":"https://api.github.com/users/omarabuhussein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omarabuhussein/subscriptions","organizations_url":"https://api.github.com/users/omarabuhussein/orgs","repos_url":"https://api.github.com/users/omarabuhussein/repos","events_url":"https://api.github.com/users/omarabuhussein/events{/privacy}","received_events_url":"https://api.github.com/users/omarabuhussein/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/omarabuhussein/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":true,"url":"https://api.github.com/repos/omarabuhussein/civicrm-core","forks_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/forks","keys_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/teams","hooks_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/events","assignees_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/tags","blobs_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/subscription","commits_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/merges","archive_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/downloads","issues_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/releases{/id}","deployments_url":"https://api.github.com/repos/omarabuhussein/civicrm-core/deployments","created_at":"2016-04-11T17:34:24Z","updated_at":"2017-02-19T13:34:58Z","pushed_at":"2017-02-24T21:16:11Z","git_url":"git://github.com/omarabuhussein/civicrm-core.git","ssh_url":"git@github.com:omarabuhussein/civicrm-core.git","clone_url":"https://github.com/omarabuhussein/civicrm-core.git","svn_url":"https://github.com/omarabuhussein/civicrm-core","homepage":null,"size":172247,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"civicrm:master","ref":"master","sha":"cd8eca8b5d47c855df4dca14995c07b6edda37f4","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":8495499,"name":"civicrm-core","full_name":"civicrm/civicrm-core","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars.githubusercontent.com/u/136373?v=3","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":false,"url":"https://api.github.com/repos/civicrm/civicrm-core","forks_url":"https://api.github.com/repos/civicrm/civicrm-core/forks","keys_url":"https://api.github.com/repos/civicrm/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civicrm-core/teams","hooks_url":"https://api.github.com/repos/civicrm/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civicrm-core/events","assignees_url":"https://api.github.com/repos/civicrm/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civicrm-core/tags","blobs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/civicrm/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civicrm-core/subscription","commits_url":"https://api.github.com/repos/civicrm/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civicrm-core/merges","archive_url":"https://api.github.com/repos/civicrm/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civicrm-core/downloads","issues_url":"https://api.github.com/repos/civicrm/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civicrm-core/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civicrm-core/deployments","created_at":"2013-03-01T06:11:56Z","updated_at":"2017-02-16T00:26:20Z","pushed_at":"2017-02-24T21:24:13Z","git_url":"git://github.com/civicrm/civicrm-core.git","ssh_url":"git@github.com:civicrm/civicrm-core.git","clone_url":"https://github.com/civicrm/civicrm-core.git","svn_url":"https://github.com/civicrm/civicrm-core","homepage":null,"size":140169,"stargazers_count":183,"watchers_count":183,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":525,"mirror_url":null,"open_issues_count":207,"forks":525,"open_issues":207,"watchers":183,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/9861"},"html":{"href":"https://github.com/civicrm/civicrm-core/pull/9861"},"issue":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/9861"},"comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/9861/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/9861/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/9861/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civicrm-core/statuses/02e66fdd0f2b23de285b508e5a11fa8500c21288"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":2,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":2,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"omarabuhussein"}}