@@ -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)); |
@@ -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 | |
@@ -14,6 +14,9 @@ |
||
| 14 | 14 | public $cacheKey; |
| 15 | 15 | protected $_metadata; |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string|null $url |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($url, $maxHeight = 0, AdapterInterface $filesystem = null, ImageManager $imageManager = null) |
| 18 | 21 | { |
| 19 | 22 | $this->sourceUrl = $url; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->imageManager = $imageManager ?: app('Intervention\Image\ImageManager'); |
| 23 | 23 | $maxAge = 3153600; // 30 days |
| 24 | 24 | $this->fsConfig = new FlysystemConfig([ |
| 25 | - 'CacheControl' => 'max-age=' . $maxAge . ', public', |
|
| 25 | + 'CacheControl' => 'max-age='.$maxAge.', public', |
|
| 26 | 26 | ]); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | if (is_null($data)) { |
| 93 | 93 | $data = $this->download(); |
| 94 | 94 | if (!$data) { |
| 95 | - throw new \ErrorException('[CoverCache] Failed to download ' . $this->sourceUrl); |
|
| 95 | + throw new \ErrorException('[CoverCache] Failed to download '.$this->sourceUrl); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $img = $this->imageManager->make($data); |
| 100 | 100 | if ($this->maxHeight && $img->height() > $this->maxHeight) { |
| 101 | - \Log::debug('[CachedImage] Resizing from ' . $img->height() . ' to ' . $this->maxHeight); |
|
| 101 | + \Log::debug('[CachedImage] Resizing from '.$img->height().' to '.$this->maxHeight); |
|
| 102 | 102 | $img->heighten($this->maxHeight); |
| 103 | 103 | $data = strval($img->encode('jpg')); |
| 104 | 104 | } |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $this->setMetadata($data, $img); |
| 111 | 111 | |
| 112 | - \Log::debug('[CachedImage] Storing image as ' . $img->width() . ' x ' . $img->height() . ', ' . strlen($data) . ' bytes'); |
|
| 112 | + \Log::debug('[CachedImage] Storing image as '.$img->width().' x '.$img->height().', '.strlen($data).' bytes'); |
|
| 113 | 113 | if (!$this->filesystem->write($this->cacheKey, $data, $this->fsConfig)) { |
| 114 | 114 | throw new \ErrorException('[CoverCache] Failed to upload thumb to S3'); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - \Log::debug('[CachedImage] Wrote cached version as ' . $this->cacheKey); |
|
| 117 | + \Log::debug('[CachedImage] Wrote cached version as '.$this->cacheKey); |
|
| 118 | 118 | |
| 119 | 119 | return $this; |
| 120 | 120 | } |