{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/14666","labels_url":"https://api.github.com/repos/owncloud/core/issues/14666/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/14666/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/14666/events","html_url":"https://github.com/owncloud/core/issues/14666","id":59627039,"number":14666,"title":"App callbacks","user":{"login":"BernhardPosselt","id":195053,"avatar_url":"https://avatars.githubusercontent.com/u/195053?v=3","gravatar_id":"","url":"https://api.github.com/users/BernhardPosselt","html_url":"https://github.com/BernhardPosselt","followers_url":"https://api.github.com/users/BernhardPosselt/followers","following_url":"https://api.github.com/users/BernhardPosselt/following{/other_user}","gists_url":"https://api.github.com/users/BernhardPosselt/gists{/gist_id}","starred_url":"https://api.github.com/users/BernhardPosselt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BernhardPosselt/subscriptions","organizations_url":"https://api.github.com/users/BernhardPosselt/orgs","repos_url":"https://api.github.com/users/BernhardPosselt/repos","events_url":"https://api.github.com/users/BernhardPosselt/events{/privacy}","received_events_url":"https://api.github.com/users/BernhardPosselt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/1%20-%20To%20develop","name":"1 - To develop","color":"ededed"},{"url":"https://api.github.com/repos/owncloud/core/labels/enhancement","name":"enhancement","color":"02e10c"}],"state":"open","locked":false,"assignee":{"login":"BernhardPosselt","id":195053,"avatar_url":"https://avatars.githubusercontent.com/u/195053?v=3","gravatar_id":"","url":"https://api.github.com/users/BernhardPosselt","html_url":"https://github.com/BernhardPosselt","followers_url":"https://api.github.com/users/BernhardPosselt/followers","following_url":"https://api.github.com/users/BernhardPosselt/following{/other_user}","gists_url":"https://api.github.com/users/BernhardPosselt/gists{/gist_id}","starred_url":"https://api.github.com/users/BernhardPosselt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BernhardPosselt/subscriptions","organizations_url":"https://api.github.com/users/BernhardPosselt/orgs","repos_url":"https://api.github.com/users/BernhardPosselt/repos","events_url":"https://api.github.com/users/BernhardPosselt/events{/privacy}","received_events_url":"https://api.github.com/users/BernhardPosselt/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/48","html_url":"https://github.com/owncloud/core/milestones/9.0-next","labels_url":"https://api.github.com/repos/owncloud/core/milestones/48/labels","id":1196845,"number":48,"title":"9.0-next","description":"","creator":{"login":"cmonteroluque","id":879976,"avatar_url":"https://avatars.githubusercontent.com/u/879976?v=3","gravatar_id":"","url":"https://api.github.com/users/cmonteroluque","html_url":"https://github.com/cmonteroluque","followers_url":"https://api.github.com/users/cmonteroluque/followers","following_url":"https://api.github.com/users/cmonteroluque/following{/other_user}","gists_url":"https://api.github.com/users/cmonteroluque/gists{/gist_id}","starred_url":"https://api.github.com/users/cmonteroluque/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmonteroluque/subscriptions","organizations_url":"https://api.github.com/users/cmonteroluque/orgs","repos_url":"https://api.github.com/users/cmonteroluque/repos","events_url":"https://api.github.com/users/cmonteroluque/events{/privacy}","received_events_url":"https://api.github.com/users/cmonteroluque/received_events","type":"User","site_admin":false},"open_issues":319,"closed_issues":4,"state":"open","created_at":"2015-07-07T14:21:23Z","updated_at":"2015-09-22T13:29:35Z","due_on":"2016-02-09T05:00:00Z","closed_at":null},"comments":24,"created_at":"2015-03-03T11:11:19Z","updated_at":"2015-09-22T13:31:51Z","closed_at":null,"body":"Sometimes you need to execute code after an app was initialized (appinfo/app.php included) or after an app is active, for instance adding additional JavaScript or CSS to an app. The biggest motivation for me is the REQUEST_URI not found error when running cron, basically its unreliable to check the URL if an app has been started since sometimes there might not even be an URL. IIRC @butonic suggested something similar, I can't find the issue however.\r\n\r\nMy proposal is to do the following:\r\n```php\r\nOC::$server->getAppManager()->onAppInit($callback, $appId);\r\nOC::$server->getAppManager()->onAppLaunch($callback, $appId);\r\n\r\n// adding JS for the files app\r\n// files_sharing/appinfo/app.php\r\nOC::$server->getAppManager()->onAppLaunch(function () {\r\n    OCP\\Util::addScript('files_sharing', 'script');\r\n}, 'files');\r\n```\r\n\r\nThe $appId parameter is optional. If it is not set, it will be executed for every app. \r\n\r\n@MorrisJobke @DeepDiver1975 @jbtbnl @LEDfan @georgehrke @oparoz @icewind1991 @butonic  "},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/142290373","html_url":"https://github.com/owncloud/core/issues/14666#issuecomment-142290373","issue_url":"https://api.github.com/repos/owncloud/core/issues/14666","id":142290373,"user":{"login":"oparoz","id":323220,"avatar_url":"https://avatars.githubusercontent.com/u/323220?v=3","gravatar_id":"","url":"https://api.github.com/users/oparoz","html_url":"https://github.com/oparoz","followers_url":"https://api.github.com/users/oparoz/followers","following_url":"https://api.github.com/users/oparoz/following{/other_user}","gists_url":"https://api.github.com/users/oparoz/gists{/gist_id}","starred_url":"https://api.github.com/users/oparoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oparoz/subscriptions","organizations_url":"https://api.github.com/users/oparoz/orgs","repos_url":"https://api.github.com/users/oparoz/repos","events_url":"https://api.github.com/users/oparoz/events{/privacy}","received_events_url":"https://api.github.com/users/oparoz/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T13:31:51Z","updated_at":"2015-09-22T13:31:51Z","body":"The only thing left would be to add some documentation and mnodify ocdev. All apps should listen fro now on instead of dump their scripts on poor Files. "}}