{"action":"created","issue":{"url":"https://api.github.com/repos/pkp/pkp-lib/issues/2582","repository_url":"https://api.github.com/repos/pkp/pkp-lib","labels_url":"https://api.github.com/repos/pkp/pkp-lib/issues/2582/labels{/name}","comments_url":"https://api.github.com/repos/pkp/pkp-lib/issues/2582/comments","events_url":"https://api.github.com/repos/pkp/pkp-lib/issues/2582/events","html_url":"https://github.com/pkp/pkp-lib/issues/2582","id":235380194,"number":2582,"title":"Fix HTML galley image migration in OJS2 to OJS3","user":{"login":"asmecher","id":200411,"avatar_url":"https://avatars3.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"asmecher","id":200411,"avatar_url":"https://avatars3.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"assignees":[{"login":"asmecher","id":200411,"avatar_url":"https://avatars3.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-06-12T22:08:36Z","updated_at":"2017-06-14T05:11:50Z","closed_at":null,"body":"The old OJS2.x mapping of dependent files is not migrated to OJS3's expectations.\r\n\r\n- Set the file_stage for dependent files to 17 (check what that constant is)\r\n- Set assoc_type and assoc_id to 515 (submission file) and file ID of HTML galley\r\n- Remove the defunct `submission_html_galley_images` table and references to it.\r\n- Rename and move images, e.g.:\r\n\r\n      mv files/journals/3/articles/244/public/244-1-4668-1-1-20170207.jpg files/journals/3/articles/244/submission/proof/244-1-4668-1-17-20170207.jpg"},"comment":{"url":"https://api.github.com/repos/pkp/pkp-lib/issues/comments/308321404","html_url":"https://github.com/pkp/pkp-lib/issues/2582#issuecomment-308321404","issue_url":"https://api.github.com/repos/pkp/pkp-lib/issues/2582","id":308321404,"user":{"login":"asmecher","id":200411,"avatar_url":"https://avatars3.githubusercontent.com/u/200411?v=3","gravatar_id":"","url":"https://api.github.com/users/asmecher","html_url":"https://github.com/asmecher","followers_url":"https://api.github.com/users/asmecher/followers","following_url":"https://api.github.com/users/asmecher/following{/other_user}","gists_url":"https://api.github.com/users/asmecher/gists{/gist_id}","starred_url":"https://api.github.com/users/asmecher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmecher/subscriptions","organizations_url":"https://api.github.com/users/asmecher/orgs","repos_url":"https://api.github.com/users/asmecher/repos","events_url":"https://api.github.com/users/asmecher/events{/privacy}","received_events_url":"https://api.github.com/users/asmecher/received_events","type":"User","site_admin":false},"created_at":"2017-06-14T05:11:50Z","updated_at":"2017-06-14T05:11:50Z","body":"So https://github.com/asmecher/ojs/commit/e6ec4aa7a29b03cd1dacf2ab02cd057e5af7d35e should resolve this for OJS master branch, and https://github.com/asmecher/ojs/commit/361ec474b586f3712ce53b2e9c2d00d88f5d6d9b is a near-identical port for the `ojs-stable-3_0_2` branch (i.e. an OJS 3.0.2 release). Apply whichever patch is relevant to your OJS version. Then, in order to kick off the repair without requiring a full re-upgrade, try creating the following tool in `tools/fixGalleyImages.php`:\r\n\r\n```\r\n<?php\r\n\r\n/**\r\n * @file tools/fixGalleyImages.php\r\n *\r\n * Copyright (c) 2014-2017 Simon Fraser University\r\n * Copyright (c) 2003-2017 John Willinsky\r\n * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.\r\n *\r\n * @class upgradeTool\r\n * @ingroup tools\r\n *\r\n * @brief CLI tool for upgrading OJS.\r\n *\r\n * Note: Some functions require fopen wrappers to be enabled.\r\n */\r\n\r\ndefine('RUNNING_UPGRADE', 1);\r\nrequire(dirname(__FILE__) . '/bootstrap.inc.php');\r\n\r\nimport('classes.install.Upgrade');\r\n\r\nclass FixGalleyImagesTool extends CommandLineTool {\r\n\t/**\r\n\t * Constructor.\r\n\t * @param $argv array command-line arguments\r\n\t */\r\n\tfunction __construct($argv = array()) {\r\n\t\tparent::__construct($argv);\r\n\t}\r\n\r\n\t/**\r\n\t * Execute the specified command.\r\n\t */\r\n\tfunction execute() {\r\n\t\t$installer = new Upgrade(array());\r\n\t\t$installer->repairImageAssociations();\r\n\t}\r\n}\r\n\r\n$tool = new FixGalleyImagesTool(isset($argv) ? $argv : array());\r\n$tool->execute();\r\n\r\n?>\r\n```\r\n\r\nTo run it, *take a backup of your database and files directory*, then run `php tools/fixGalleyImages.php`. It should return to the command line silently when finished. Check a galley before and after to verify whether it fixed the HTML images there.\r\n\r\nThis is still testing-level code, so please do take a backup first and review the published content afterwards to see whether it repaired the issue."}}
{"actor":{"display_login":"asmecher"}}