{"action":"created","comment":{"url":"https://api.github.com/repos/omegaup/omegaup/pulls/comments/82721822","pull_request_review_id":3608962,"id":82721822,"diff_hunk":"@@ -0,0 +1,26 @@\n+<?php\n+\n+function smarty_compiler_version_hash($params, Smarty $smarty) {\n+    $src = $params['src'];\n+    if ($src[0] == '\"' || $src[0] == \"'\") {\n+        $src = substr($src, 1, strlen($src) - 2);\n+    }\n+    $paths = [];\n+    if ($src =='/js/omegaup/lang.#locale#.js') {\n+        $src = '/js/omegaup/lang.<?php echo $_smarty_tpl->getConfigVariable(\"locale\"); ?>.js';\n+        $paths = ['/js/omegaup/lang.es.js', '/js/omegaup/lang.en.js',\n+            '/js/omegaup/lang.pt.js', '/js/omegaup/lang.pseudo.js'];\n+    } else {\n+        $paths[] = $src;\n+    }\n+    $hashes = [];\n+    foreach ($paths as $path) {\n+        $path = __DIR__ . '/../www/' . $path;\n+        if (!is_file($path)) {\n+            $hashes[] = '000000';\n+        } else {\n+            $hashes[] = substr(sha1(file_get_contents($path)), 0, 6);","path":"frontend/smarty_plugins/compiler.version_hash.php","position":22,"original_position":22,"commit_id":"902702595b769b3aede0f988e871d8afc1ef1568","original_commit_id":"902702595b769b3aede0f988e871d8afc1ef1568","user":{"login":"alanboy","id":527987,"avatar_url":"https://avatars.githubusercontent.com/u/527987?v=3","gravatar_id":"","url":"https://api.github.com/users/alanboy","html_url":"https://github.com/alanboy","followers_url":"https://api.github.com/users/alanboy/followers","following_url":"https://api.github.com/users/alanboy/following{/other_user}","gists_url":"https://api.github.com/users/alanboy/gists{/gist_id}","starred_url":"https://api.github.com/users/alanboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alanboy/subscriptions","organizations_url":"https://api.github.com/users/alanboy/orgs","repos_url":"https://api.github.com/users/alanboy/repos","events_url":"https://api.github.com/users/alanboy/events{/privacy}","received_events_url":"https://api.github.com/users/alanboy/received_events","type":"User","site_admin":false},"body":"que tanto nos va a alentar esto? me agrada no tener que cambiar el hashes en cada check-in pero no a costa de alentar el sitio, me imagino que es algo minimo pero dados suficientes requests me pregunto si sera algo que reconsiderar.  porque estamos leyendo todo el archivo en cada request, vdd?\r\n\r\ny de hecho.... estamos leyendo TODO el archivo cuando solamente estamos interesados en los primeros 6 caracteres?","created_at":"2016-10-11T04:06:52Z","updated_at":"2016-10-11T04:07:35Z","html_url":"https://github.com/omegaup/omegaup/pull/897#discussion_r82721822","pull_request_url":"https://api.github.com/repos/omegaup/omegaup/pulls/897","_links":{"self":{"href":"https://api.github.com/repos/omegaup/omegaup/pulls/comments/82721822"},"html":{"href":"https://github.com/omegaup/omegaup/pull/897#discussion_r82721822"},"pull_request":{"href":"https://api.github.com/repos/omegaup/omegaup/pulls/897"}}},"pull_request":{"url":"https://api.github.com/repos/omegaup/omegaup/pulls/897","id":88605325,"html_url":"https://github.com/omegaup/omegaup/pull/897","diff_url":"https://github.com/omegaup/omegaup/pull/897.diff","patch_url":"https://github.com/omegaup/omegaup/pull/897.patch","issue_url":"https://api.github.com/repos/omegaup/omegaup/issues/897","number":897,"state":"open","locked":false,"title":"Reemplazando stuff/update-templates.py por un plugin de Smarty","user":{"login":"lhchavez","id":168028,"avatar_url":"https://avatars.githubusercontent.com/u/168028?v=3","gravatar_id":"","url":"https://api.github.com/users/lhchavez","html_url":"https://github.com/lhchavez","followers_url":"https://api.github.com/users/lhchavez/followers","following_url":"https://api.github.com/users/lhchavez/following{/other_user}","gists_url":"https://api.github.com/users/lhchavez/gists{/gist_id}","starred_url":"https://api.github.com/users/lhchavez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lhchavez/subscriptions","organizations_url":"https://api.github.com/users/lhchavez/orgs","repos_url":"https://api.github.com/users/lhchavez/repos","events_url":"https://api.github.com/users/lhchavez/events{/privacy}","received_events_url":"https://api.github.com/users/lhchavez/received_events","type":"User","site_admin":false},"body":"En vez de requerir que cada cambio introduzca un montón de cambios en\r\nlos archivos .tpl, mejor hay que hacer un plugin de Smarty que haga\r\nexactamente lo mismo en tiempo de compilación! Este cambio quita _todos_\r\nlos '?ver=hash' de los .tpl y los reemplaza por un '{version_hash ...}',\r\nque se evalúa una única vez.\r\n\r\nCalcular el hash es costoso, así que para asegurarnos que no se va a\r\nestar invocando cada vez que se haga una petición al servidor, también\r\nse va a habilitar un cache más agresivo de Smarty, que requiere que los\r\ndesarrolladores establezcan `OMEGAUP_DEVELOPMENT_MODE` en su config.php,\r\ny que cada vez que se haga deployment se borre la carpeta de templates\r\ncompilados.","created_at":"2016-10-10T02:52:24Z","updated_at":"2016-10-11T04:08:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e572eeab1b60eb9bb7ad3d21a0309071d23eea13","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/omegaup/omegaup/pulls/897/commits","review_comments_url":"https://api.github.com/repos/omegaup/omegaup/pulls/897/comments","review_comment_url":"https://api.github.com/repos/omegaup/omegaup/pulls/comments{/number}","comments_url":"https://api.github.com/repos/omegaup/omegaup/issues/897/comments","statuses_url":"https://api.github.com/repos/omegaup/omegaup/statuses/902702595b769b3aede0f988e871d8afc1ef1568","head":{"label":"omegaup:template","ref":"template","sha":"902702595b769b3aede0f988e871d8afc1ef1568","user":{"login":"omegaup","id":558429,"avatar_url":"https://avatars.githubusercontent.com/u/558429?v=3","gravatar_id":"","url":"https://api.github.com/users/omegaup","html_url":"https://github.com/omegaup","followers_url":"https://api.github.com/users/omegaup/followers","following_url":"https://api.github.com/users/omegaup/following{/other_user}","gists_url":"https://api.github.com/users/omegaup/gists{/gist_id}","starred_url":"https://api.github.com/users/omegaup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omegaup/subscriptions","organizations_url":"https://api.github.com/users/omegaup/orgs","repos_url":"https://api.github.com/users/omegaup/repos","events_url":"https://api.github.com/users/omegaup/events{/privacy}","received_events_url":"https://api.github.com/users/omegaup/received_events","type":"Organization","site_admin":false},"repo":{"id":1243685,"name":"omegaup","full_name":"omegaup/omegaup","owner":{"login":"omegaup","id":558429,"avatar_url":"https://avatars.githubusercontent.com/u/558429?v=3","gravatar_id":"","url":"https://api.github.com/users/omegaup","html_url":"https://github.com/omegaup","followers_url":"https://api.github.com/users/omegaup/followers","following_url":"https://api.github.com/users/omegaup/following{/other_user}","gists_url":"https://api.github.com/users/omegaup/gists{/gist_id}","starred_url":"https://api.github.com/users/omegaup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omegaup/subscriptions","organizations_url":"https://api.github.com/users/omegaup/orgs","repos_url":"https://api.github.com/users/omegaup/repos","events_url":"https://api.github.com/users/omegaup/events{/privacy}","received_events_url":"https://api.github.com/users/omegaup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/omegaup/omegaup","description":"omegaUp automatic programming contest evaluator & arena","fork":false,"url":"https://api.github.com/repos/omegaup/omegaup","forks_url":"https://api.github.com/repos/omegaup/omegaup/forks","keys_url":"https://api.github.com/repos/omegaup/omegaup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omegaup/omegaup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omegaup/omegaup/teams","hooks_url":"https://api.github.com/repos/omegaup/omegaup/hooks","issue_events_url":"https://api.github.com/repos/omegaup/omegaup/issues/events{/number}","events_url":"https://api.github.com/repos/omegaup/omegaup/events","assignees_url":"https://api.github.com/repos/omegaup/omegaup/assignees{/user}","branches_url":"https://api.github.com/repos/omegaup/omegaup/branches{/branch}","tags_url":"https://api.github.com/repos/omegaup/omegaup/tags","blobs_url":"https://api.github.com/repos/omegaup/omegaup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omegaup/omegaup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omegaup/omegaup/git/refs{/sha}","trees_url":"https://api.github.com/repos/omegaup/omegaup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omegaup/omegaup/statuses/{sha}","languages_url":"https://api.github.com/repos/omegaup/omegaup/languages","stargazers_url":"https://api.github.com/repos/omegaup/omegaup/stargazers","contributors_url":"https://api.github.com/repos/omegaup/omegaup/contributors","subscribers_url":"https://api.github.com/repos/omegaup/omegaup/subscribers","subscription_url":"https://api.github.com/repos/omegaup/omegaup/subscription","commits_url":"https://api.github.com/repos/omegaup/omegaup/commits{/sha}","git_commits_url":"https://api.github.com/repos/omegaup/omegaup/git/commits{/sha}","comments_url":"https://api.github.com/repos/omegaup/omegaup/comments{/number}","issue_comment_url":"https://api.github.com/repos/omegaup/omegaup/issues/comments{/number}","contents_url":"https://api.github.com/repos/omegaup/omegaup/contents/{+path}","compare_url":"https://api.github.com/repos/omegaup/omegaup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omegaup/omegaup/merges","archive_url":"https://api.github.com/repos/omegaup/omegaup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omegaup/omegaup/downloads","issues_url":"https://api.github.com/repos/omegaup/omegaup/issues{/number}","pulls_url":"https://api.github.com/repos/omegaup/omegaup/pulls{/number}","milestones_url":"https://api.github.com/repos/omegaup/omegaup/milestones{/number}","notifications_url":"https://api.github.com/repos/omegaup/omegaup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omegaup/omegaup/labels{/name}","releases_url":"https://api.github.com/repos/omegaup/omegaup/releases{/id}","deployments_url":"https://api.github.com/repos/omegaup/omegaup/deployments","created_at":"2011-01-12T00:11:21Z","updated_at":"2016-08-22T03:58:20Z","pushed_at":"2016-10-11T04:00:20Z","git_url":"git://github.com/omegaup/omegaup.git","ssh_url":"git@github.com:omegaup/omegaup.git","clone_url":"https://github.com/omegaup/omegaup.git","svn_url":"https://github.com/omegaup/omegaup","homepage":"https://omegaup.com","size":219060,"stargazers_count":31,"watchers_count":31,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":148,"forks":34,"open_issues":148,"watchers":31,"default_branch":"master"}},"base":{"label":"omegaup:master","ref":"master","sha":"4cefd1e754efb7729d1a27eea13d7aec84c9b793","user":{"login":"omegaup","id":558429,"avatar_url":"https://avatars.githubusercontent.com/u/558429?v=3","gravatar_id":"","url":"https://api.github.com/users/omegaup","html_url":"https://github.com/omegaup","followers_url":"https://api.github.com/users/omegaup/followers","following_url":"https://api.github.com/users/omegaup/following{/other_user}","gists_url":"https://api.github.com/users/omegaup/gists{/gist_id}","starred_url":"https://api.github.com/users/omegaup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omegaup/subscriptions","organizations_url":"https://api.github.com/users/omegaup/orgs","repos_url":"https://api.github.com/users/omegaup/repos","events_url":"https://api.github.com/users/omegaup/events{/privacy}","received_events_url":"https://api.github.com/users/omegaup/received_events","type":"Organization","site_admin":false},"repo":{"id":1243685,"name":"omegaup","full_name":"omegaup/omegaup","owner":{"login":"omegaup","id":558429,"avatar_url":"https://avatars.githubusercontent.com/u/558429?v=3","gravatar_id":"","url":"https://api.github.com/users/omegaup","html_url":"https://github.com/omegaup","followers_url":"https://api.github.com/users/omegaup/followers","following_url":"https://api.github.com/users/omegaup/following{/other_user}","gists_url":"https://api.github.com/users/omegaup/gists{/gist_id}","starred_url":"https://api.github.com/users/omegaup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omegaup/subscriptions","organizations_url":"https://api.github.com/users/omegaup/orgs","repos_url":"https://api.github.com/users/omegaup/repos","events_url":"https://api.github.com/users/omegaup/events{/privacy}","received_events_url":"https://api.github.com/users/omegaup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/omegaup/omegaup","description":"omegaUp automatic programming contest evaluator & arena","fork":false,"url":"https://api.github.com/repos/omegaup/omegaup","forks_url":"https://api.github.com/repos/omegaup/omegaup/forks","keys_url":"https://api.github.com/repos/omegaup/omegaup/keys{/key_id}","collaborators_url":"https://api.github.com/repos/omegaup/omegaup/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/omegaup/omegaup/teams","hooks_url":"https://api.github.com/repos/omegaup/omegaup/hooks","issue_events_url":"https://api.github.com/repos/omegaup/omegaup/issues/events{/number}","events_url":"https://api.github.com/repos/omegaup/omegaup/events","assignees_url":"https://api.github.com/repos/omegaup/omegaup/assignees{/user}","branches_url":"https://api.github.com/repos/omegaup/omegaup/branches{/branch}","tags_url":"https://api.github.com/repos/omegaup/omegaup/tags","blobs_url":"https://api.github.com/repos/omegaup/omegaup/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/omegaup/omegaup/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/omegaup/omegaup/git/refs{/sha}","trees_url":"https://api.github.com/repos/omegaup/omegaup/git/trees{/sha}","statuses_url":"https://api.github.com/repos/omegaup/omegaup/statuses/{sha}","languages_url":"https://api.github.com/repos/omegaup/omegaup/languages","stargazers_url":"https://api.github.com/repos/omegaup/omegaup/stargazers","contributors_url":"https://api.github.com/repos/omegaup/omegaup/contributors","subscribers_url":"https://api.github.com/repos/omegaup/omegaup/subscribers","subscription_url":"https://api.github.com/repos/omegaup/omegaup/subscription","commits_url":"https://api.github.com/repos/omegaup/omegaup/commits{/sha}","git_commits_url":"https://api.github.com/repos/omegaup/omegaup/git/commits{/sha}","comments_url":"https://api.github.com/repos/omegaup/omegaup/comments{/number}","issue_comment_url":"https://api.github.com/repos/omegaup/omegaup/issues/comments{/number}","contents_url":"https://api.github.com/repos/omegaup/omegaup/contents/{+path}","compare_url":"https://api.github.com/repos/omegaup/omegaup/compare/{base}...{head}","merges_url":"https://api.github.com/repos/omegaup/omegaup/merges","archive_url":"https://api.github.com/repos/omegaup/omegaup/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/omegaup/omegaup/downloads","issues_url":"https://api.github.com/repos/omegaup/omegaup/issues{/number}","pulls_url":"https://api.github.com/repos/omegaup/omegaup/pulls{/number}","milestones_url":"https://api.github.com/repos/omegaup/omegaup/milestones{/number}","notifications_url":"https://api.github.com/repos/omegaup/omegaup/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/omegaup/omegaup/labels{/name}","releases_url":"https://api.github.com/repos/omegaup/omegaup/releases{/id}","deployments_url":"https://api.github.com/repos/omegaup/omegaup/deployments","created_at":"2011-01-12T00:11:21Z","updated_at":"2016-08-22T03:58:20Z","pushed_at":"2016-10-11T04:00:20Z","git_url":"git://github.com/omegaup/omegaup.git","ssh_url":"git@github.com:omegaup/omegaup.git","clone_url":"https://github.com/omegaup/omegaup.git","svn_url":"https://github.com/omegaup/omegaup","homepage":"https://omegaup.com","size":219060,"stargazers_count":31,"watchers_count":31,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":148,"forks":34,"open_issues":148,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/omegaup/omegaup/pulls/897"},"html":{"href":"https://github.com/omegaup/omegaup/pull/897"},"issue":{"href":"https://api.github.com/repos/omegaup/omegaup/issues/897"},"comments":{"href":"https://api.github.com/repos/omegaup/omegaup/issues/897/comments"},"review_comments":{"href":"https://api.github.com/repos/omegaup/omegaup/pulls/897/comments"},"review_comment":{"href":"https://api.github.com/repos/omegaup/omegaup/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/omegaup/omegaup/pulls/897/commits"},"statuses":{"href":"https://api.github.com/repos/omegaup/omegaup/statuses/902702595b769b3aede0f988e871d8afc1ef1568"}}}}
{"actor":{"display_login":"alanboy"}}