{"action":"created","issue":{"url":"https://api.github.com/repos/contao/core/issues/7914","labels_url":"https://api.github.com/repos/contao/core/issues/7914/labels{/name}","comments_url":"https://api.github.com/repos/contao/core/issues/7914/comments","events_url":"https://api.github.com/repos/contao/core/issues/7914/events","html_url":"https://github.com/contao/core/issues/7914","id":94306292,"number":7914,"title":"[3.4.x] Konstanten fehlen beim Seitenausliefern aus dem Cache","user":{"login":"BugBuster1701","id":1218809,"avatar_url":"https://avatars.githubusercontent.com/u/1218809?v=3","gravatar_id":"","url":"https://api.github.com/users/BugBuster1701","html_url":"https://github.com/BugBuster1701","followers_url":"https://api.github.com/users/BugBuster1701/followers","following_url":"https://api.github.com/users/BugBuster1701/following{/other_user}","gists_url":"https://api.github.com/users/BugBuster1701/gists{/gist_id}","starred_url":"https://api.github.com/users/BugBuster1701/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BugBuster1701/subscriptions","organizations_url":"https://api.github.com/users/BugBuster1701/orgs","repos_url":"https://api.github.com/users/BugBuster1701/repos","events_url":"https://api.github.com/users/BugBuster1701/events{/privacy}","received_events_url":"https://api.github.com/users/BugBuster1701/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/contao/core/labels/defect","name":"defect","color":"bd2c00"}],"state":"open","locked":false,"assignee":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/contao/core/milestones/110","html_url":"https://github.com/contao/core/milestones/3.5.1","labels_url":"https://api.github.com/repos/contao/core/milestones/110/labels","id":1151054,"number":110,"title":"3.5.1","description":"Contao 3.5.1 (bugfix release)","creator":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":13,"state":"open","created_at":"2015-06-05T12:19:51Z","updated_at":"2015-07-20T13:16:38Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-07-10T13:22:02Z","updated_at":"2015-07-20T13:16:38Z","closed_at":null,"body":"Szenario: \r\nEine Seite die im Cache ist, und Insert Tags beinhaltet die beim Ausliefern noch ersetzt werden müssen.\r\nDiese Insert Tags rufen beispielsweise auf:\r\n\r\n    \\Picture::create(....)->getTemplateData();\r\n\r\ndas getTemplateData ruft getTemplateDataSource auf, dieses benötigt TL_FILES_URL , das aber nicht definiert ist. Grund ist, ```\\Controller::setStaticUrls()``` wird erst für das Frontend in PageRegular aufgerufen, aber nicht beim Ausliefern aus dem Cache.\r\nFolge ist, es kommen solche Dateipfade zurück:\r\n\r\n    TL_FILES_URLassets/images/d/bla-cc9505ad.jpg\r\n\r\nPHP gibt hier die Konstante als String aus, wenn diese nicht definiert ist.\r\n\r\nContao muss also dafür sorgen, das die Konstanten definiert sind, auch wenn die Seite aus dem Cache kommt.\r\nIn meiner Erweiterung habe ich das mal getestet durch einen Aufruf von:\r\n\r\n    \\Controller::setStaticUrls();\r\n\r\nunmittelbar vor Aufruf der Picture::create Methode, hat funktioniert.\r\n\r\nIch denke in der FrontendIndex::outputFromCache Methode am Anfang wäre ein guter Ort diesen Aufruf ```\\Controller::setStaticUrls();``` unterzubringen. Das habe ich aber noch nicht getestet.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/contao/core/issues/comments/122879717","html_url":"https://github.com/contao/core/issues/7914#issuecomment-122879717","issue_url":"https://api.github.com/repos/contao/core/issues/7914","id":122879717,"user":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T13:16:38Z","updated_at":"2015-07-20T13:16:38Z","body":"Das ist zu spät, denn um zu erkennen, ob der Cache abgelaufen ist, müssen wir ein `include` der Datei machen. Und dabei werden dann auch die Konstanten definiert. Natürlich könnte man die Ausgabe in eine Funktion kapseln und diese nur ausführen, wenn der Cache noch valide ist."}}