@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->comment('Available configurations:'); |
49 | 49 | $config = \Config::get('oaipmh.harvests', null); |
50 | 50 | foreach (array_keys($config) as $key) { |
51 | - $this->comment(' - ' . $key); |
|
51 | + $this->comment(' - '.$key); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | return false; |
61 | 61 | } |
62 | - $harvestConfig = \Config::get('oaipmh.harvests.' . $this->argument('name'), null); |
|
62 | + $harvestConfig = \Config::get('oaipmh.harvests.'.$this->argument('name'), null); |
|
63 | 63 | if (is_null($harvestConfig)) { |
64 | 64 | $this->error('Unknown configuration specified.'); |
65 | 65 | $this->listConfigurations(); |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | $harvestName = $this->argument('name'); |
111 | - $harvestConfig = \Config::get('oaipmh.harvests.' . $harvestName, null); |
|
111 | + $harvestConfig = \Config::get('oaipmh.harvests.'.$harvestName, null); |
|
112 | 112 | |
113 | 113 | $this->comment(sprintf('Dispatching new harvest job')); |
114 | 114 | |
115 | 115 | if ($this->option('from-dump')) { |
116 | 116 | $this->comment(' - From local dump'); |
117 | 117 | } else { |
118 | - $this->comment(' - Repo: ' . $harvestConfig['url']); |
|
119 | - $this->comment(' - Schema: ' . $harvestConfig['schema']); |
|
120 | - $this->comment(' - Set: ' . $harvestConfig['set']); |
|
118 | + $this->comment(' - Repo: '.$harvestConfig['url']); |
|
119 | + $this->comment(' - Schema: '.$harvestConfig['schema']); |
|
120 | + $this->comment(' - Set: '.$harvestConfig['set']); |
|
121 | 121 | |
122 | 122 | foreach (['from', 'until', 'resume', 'daily'] as $key) { |
123 | 123 | if (!is_null($this->option($key))) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function fromDump() |
90 | 90 | { |
91 | - $files = Storage::disk('local')->files('harvests/' . $this->name); |
|
91 | + $files = Storage::disk('local')->files('harvests/'.$this->name); |
|
92 | 92 | $recordsHarvested = 0; |
93 | 93 | foreach ($files as $filename) { |
94 | 94 | if (!preg_match('/.xml$/', $filename)) { |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | public function fromNetwork() |
113 | 113 | { |
114 | - $dest_path = 'harvests/' . $this->name . '/'; |
|
114 | + $dest_path = 'harvests/'.$this->name.'/'; |
|
115 | 115 | |
116 | 116 | Storage::disk('local')->deleteDir($dest_path); |
117 | 117 | |
118 | - $latest = $dest_path . 'latest.xml'; |
|
118 | + $latest = $dest_path.'latest.xml'; |
|
119 | 119 | |
120 | 120 | $client = new OaiPmhClient($this->url, [ |
121 | 121 | 'schema' => $this->schema, |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | 'sleep-time-on-error' => $this->sleepTimeOnError, |
125 | 125 | ]); |
126 | 126 | |
127 | - $client->on('request.error', function ($msg) { |
|
127 | + $client->on('request.error', function($msg) { |
|
128 | 128 | $this->error($msg); |
129 | 129 | }); |
130 | 130 | |
131 | 131 | // Store each response to disk just in case |
132 | - $client->on('request.complete', function ($verb, $args, $body) use ($latest) { |
|
132 | + $client->on('request.complete', function($verb, $args, $body) use ($latest) { |
|
133 | 133 | Storage::disk('local')->put($latest, $body); |
134 | 134 | }); |
135 | 135 | |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | if ($this->resume != $records->getResumptionToken()) { |
154 | 154 | $this->resume = $records->getResumptionToken(); |
155 | 155 | if (is_null($this->resume)) { |
156 | - Storage::disk('local')->delete($dest_path . '/resumption_token'); |
|
156 | + Storage::disk('local')->delete($dest_path.'/resumption_token'); |
|
157 | 157 | } else { |
158 | - Storage::disk('local')->put($dest_path . '/resumption_token', $this->resume); |
|
158 | + Storage::disk('local')->put($dest_path.'/resumption_token', $this->resume); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } catch (BadRequestError $e) { |
189 | 189 | $this->error($e->getMessage()); |
190 | 190 | $this->error($e->getCode()); |
191 | - $this->error('Bad request. Attempt ' . $attempt . ' of 100. Sleeping 10 secs.'); |
|
191 | + $this->error('Bad request. Attempt '.$attempt.' of 100. Sleeping 10 secs.'); |
|
192 | 192 | if ($attempt > 100) { |
193 | 193 | throw $e; |
194 | 194 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function handle() |
211 | 211 | { |
212 | - Log::info('[OaiPmhHarvest] Starting job. Requesting records from ' . ($this->start ?: '(no limit)') . ' until ' . ($this->until ?: '(no limit)') . '.'); |
|
212 | + Log::info('[OaiPmhHarvest] Starting job. Requesting records from '.($this->start ?: '(no limit)').' until '.($this->until ?: '(no limit)').'.'); |
|
213 | 213 | |
214 | 214 | // For timing |
215 | 215 | $this->startTime = $this->batchTime = microtime(true) - 1; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $recordsHarvested = $this->fromNetwork(); |
228 | 228 | } |
229 | 229 | |
230 | - Log::info('[OaiPmhHarvest] Harvest complete, got ' . $recordsHarvested . ' records.'); |
|
230 | + Log::info('[OaiPmhHarvest] Harvest complete, got '.$recordsHarvested.' records.'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $rec = MarcRecord::fromString($q); |
58 | 58 | |
59 | 59 | $itemMap = [ |
60 | - 'x' => 'location', // OBS: 1030310 |
|
61 | - 'y' => 'shelvinglocation', // OBS: k00475 |
|
60 | + 'x' => 'location', // OBS: 1030310 |
|
61 | + 'y' => 'shelvinglocation', // OBS: k00475 |
|
62 | 62 | 'b' => 'barcode', |
63 | 63 | 'z' => 'callcode', |
64 | 64 | 'a' => 'id', |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | try { |
191 | 191 | $doc->storeCover($biblio['cover_image']); |
192 | 192 | } catch (\ErrorException $e) { |
193 | - \Log::error('Failed to store cover: ' . $biblio['cover_image']); |
|
193 | + \Log::error('Failed to store cover: '.$biblio['cover_image']); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | try { |
208 | 208 | list($biblio, $holdings) = $this->parseRecord($record); |
209 | 209 | } catch (ParserException $e) { |
210 | - $this->error('Failed to parse MARC record. Error "' . $e->getMessage() . '" in: ' . $e->getFile() . ':' . $e->getLine() . "\nStack trace:\n" . $e->getTraceAsString()); |
|
210 | + $this->error('Failed to parse MARC record. Error "'.$e->getMessage().'" in: '.$e->getFile().':'.$e->getLine()."\nStack trace:\n".$e->getTraceAsString()); |
|
211 | 211 | |
212 | 212 | return null; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $doc = $this->importParsedRecord($biblio, $holdings); |
216 | 216 | |
217 | - \Log::debug('[Marc21Importer] Imported ' . $doc->bibsys_id . ' as ' . $doc->id); |
|
217 | + \Log::debug('[Marc21Importer] Imported '.$doc->bibsys_id.' as '.$doc->id); |
|
218 | 218 | |
219 | 219 | if (!is_null($doc)) { |
220 | 220 | Event::fire(new Marc21RecordImported($doc->id)); |
@@ -13,6 +13,9 @@ |
||
13 | 13 | public $maxHeight; |
14 | 14 | protected $_metadata; |
15 | 15 | |
16 | + /** |
|
17 | + * @param string|null $url |
|
18 | + */ |
|
16 | 19 | public function __construct($url, $maxHeight = 0, AdapterInterface $filesystem = null, ImageManager $imageManager = null) |
17 | 20 | { |
18 | 21 | $this->sourceUrl = $url; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->imageManager = $imageManager ?: app('Intervention\Image\ImageManager'); |
22 | 22 | $maxAge = 3153600; // 30 days |
23 | 23 | $this->fsConfig = new FlysystemConfig([ |
24 | - 'CacheControl' => 'max-age=' . $maxAge . ', public', |
|
24 | + 'CacheControl' => 'max-age='.$maxAge.', public', |
|
25 | 25 | ]); |
26 | 26 | } |
27 | 27 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function basename() |
71 | 71 | { |
72 | - return sha1($this->sourceUrl . $this->maxHeight); |
|
72 | + return sha1($this->sourceUrl.$this->maxHeight); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | if (is_null($data)) { |
97 | 97 | $data = $this->download(); |
98 | 98 | if (!$data) { |
99 | - throw new \ErrorException('[CoverCache] Failed to download ' . $this->sourceUrl); |
|
99 | + throw new \ErrorException('[CoverCache] Failed to download '.$this->sourceUrl); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | $img = $this->imageManager->make($data); |
104 | 104 | if ($this->maxHeight && $img->height() > $this->maxHeight) { |
105 | - \Log::debug('[CachedImage] Resizing from ' . $img->height() . ' to ' . $this->maxHeight); |
|
105 | + \Log::debug('[CachedImage] Resizing from '.$img->height().' to '.$this->maxHeight); |
|
106 | 106 | $img->heighten($this->maxHeight); |
107 | 107 | $data = strval($img->encode('jpg')); |
108 | 108 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->setMetadata($data, $img); |
115 | 115 | |
116 | - \Log::debug('[CachedImage] Storing image as ' . $img->width() . ' x ' . $img->height() . ', ' . strlen($data) . ' bytes'); |
|
116 | + \Log::debug('[CachedImage] Storing image as '.$img->width().' x '.$img->height().', '.strlen($data).' bytes'); |
|
117 | 117 | if (!$this->filesystem->write($this->basename(), $data, $this->fsConfig)) { |
118 | 118 | throw new \ErrorException('[CoverCache] Failed to upload thumb to S3'); |
119 | 119 | } |
120 | 120 | |
121 | - \Log::debug('[CachedImage] Wrote cached version as ' . $this->basename()); |
|
121 | + \Log::debug('[CachedImage] Wrote cached version as '.$this->basename()); |
|
122 | 122 | |
123 | 123 | return $this; |
124 | 124 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function invalidateCache() |
79 | 79 | { |
80 | 80 | if (!is_null($this->width) && !is_null($this->height)) { |
81 | - \Log::debug('[Cover] Invalidating cache. Old version was ' . $this->width . ' x ' . $this->height); |
|
81 | + \Log::debug('[Cover] Invalidating cache. Old version was '.$this->width.' x '.$this->height); |
|
82 | 82 | } |
83 | 83 | $this->width = null; |
84 | 84 | $this->height = null; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $orig = \CoverCache::putBlob($blob); |
134 | 134 | |
135 | 135 | } else { |
136 | - \Log::debug('[Cover] Add to cache from url: ' . $this->url); |
|
136 | + \Log::debug('[Cover] Add to cache from url: '.$this->url); |
|
137 | 137 | $orig = \CoverCache::putUrl($this->url); |
138 | 138 | } |
139 | 139 |