19 declare(strict_types=1);
31 return "Migration of available copyrights.";
36 return Migration::INFINITE;
50 $this->db = $environment->
getResource(Environment::RESOURCE_DATABASE);
55 $res = $this->db->query(
56 'SELECT entry_id, copyright FROM il_md_cpr_selections WHERE migrated = 0 LIMIT 1' 59 if ($row = $this->db->fetchAssoc(
$res)) {
60 if (!isset($row[
'entry_id'])) {
63 $fields = $this->
extractFields((
string) ($row[
'copyright'] ??
''));
66 'il_md_cpr_selections',
75 $res = $this->db->query(
76 'SELECT COUNT(*) AS count FROM il_md_cpr_selections WHERE migrated = 0' 79 $row = $this->db->fetchAssoc(
$res);
80 return (
int) $row[
'count'];
91 if (preg_match(
'/<\s*img((?:.|\n)*?)\/>/i', $copyright, $img_matches)) {
92 if (preg_match(
'/src\s*=\s*(?:"|\')(.*?)(?:"|\')/i', $img_matches[1], $src_matches)) {
93 $image_link = strip_tags($src_matches[1]);
95 if (preg_match(
'/alt\s*=\s*(?:"|\')(.*?)(?:"|\')/i', $img_matches[1], $alt_matches)) {
96 $alt_text = strip_tags($alt_matches[1]);
101 if (preg_match(
'/<\s*a((?:.|\n)[^<]*?)<\s*\/a>/i', $copyright, $link_matches)) {
102 if (preg_match(
'/href\s*=\s*(?:"|\')(.*?)(?:"|\')/i', $link_matches[1], $name_matches)) {
103 $link = strip_tags($name_matches[1]);
105 if (preg_match(
'/>((?:\n|.)*)/i', $link_matches[1], $href_matches)) {
106 $full_name = strip_tags($href_matches[1]);
109 $full_name = strip_tags($copyright);
126 'https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg',
127 'https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg',
128 'https://i.creativecommons.org/l/by-nc/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg',
129 'https://i.creativecommons.org/l/by-nd/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nd.svg',
130 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg',
131 'https://i.creativecommons.org/l/by/4.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg',
133 'http://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg',
134 'http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg',
135 'http://i.creativecommons.org/l/by-nc/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg',
136 'http://i.creativecommons.org/l/by-nd/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nd.svg',
137 'http://i.creativecommons.org/l/by-sa/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg',
138 'http://i.creativecommons.org/l/by/3.0/88x31.png' =>
'https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg' 141 if (key_exists($image_link, $mapping)) {
142 return $mapping[$image_link];
getPreconditions(Environment $environment)
getRemainingAmountOfSteps()
extractFields(string $copyright)
getDefaultAmountOfStepsPerRun()
step(Environment $environment)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
prepare(Environment $environment)
translatePreInstalledLinksToSVG(string $image_link)