@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | public function import() { |
| 53 | 53 | $dumpIds = $this->insertMetaInformation(); |
| 54 | 54 | |
| 55 | - $this->log( "\nDelete old database entries...\n" ); |
|
| 55 | + $this->log("\nDelete old database entries...\n"); |
|
| 56 | 56 | |
| 57 | - foreach ( $dumpIds as $dumpId ) { |
|
| 58 | - $this->externalDataRepo->deleteOfDump( $dumpId, $this->importSettings->getBatchSize() ); |
|
| 57 | + foreach ($dumpIds as $dumpId) { |
|
| 58 | + $this->externalDataRepo->deleteOfDump($dumpId, $this->importSettings->getBatchSize()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $this->log( "\n" ); |
|
| 61 | + $this->log("\n"); |
|
| 62 | 62 | |
| 63 | 63 | $this->insertExternalValues(); |
| 64 | 64 | } |
@@ -69,52 +69,52 @@ discard block |
||
| 69 | 69 | * @return array |
| 70 | 70 | */ |
| 71 | 71 | protected function insertMetaInformation() { |
| 72 | - $this->log( "Insert new dump meta information\n" ); |
|
| 72 | + $this->log("Insert new dump meta information\n"); |
|
| 73 | 73 | |
| 74 | - $csvFile = fopen( $this->importSettings->getDumpInformationFilePath(), 'rb' ); |
|
| 75 | - if ( !$csvFile ) { |
|
| 76 | - exit( 'Error while reading CSV file.' ); |
|
| 74 | + $csvFile = fopen($this->importSettings->getDumpInformationFilePath(), 'rb'); |
|
| 75 | + if (!$csvFile) { |
|
| 76 | + exit('Error while reading CSV file.'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $i = 0; |
| 80 | 80 | $dumpIds = []; |
| 81 | - while ( $data = fgetcsv( $csvFile ) ) { |
|
| 81 | + while ($data = fgetcsv($csvFile)) { |
|
| 82 | 82 | $identifierPropertyIds = array_map( |
| 83 | - function ( $propertyId ) { |
|
| 84 | - return new PropertyId( $propertyId ); |
|
| 83 | + function($propertyId) { |
|
| 84 | + return new PropertyId($propertyId); |
|
| 85 | 85 | }, |
| 86 | - json_decode( $data[2] ) |
|
| 86 | + json_decode($data[2]) |
|
| 87 | 87 | ); |
| 88 | 88 | try { |
| 89 | 89 | $dumpMetaInformation = new DumpMetaInformation( |
| 90 | 90 | $data[0], |
| 91 | - new ItemId( $data[1] ), |
|
| 91 | + new ItemId($data[1]), |
|
| 92 | 92 | $identifierPropertyIds, |
| 93 | 93 | $data[3], |
| 94 | 94 | $data[4], |
| 95 | 95 | $data[5], |
| 96 | - intval( $data[6] ), |
|
| 97 | - new ItemId( $data[7] ) |
|
| 96 | + intval($data[6]), |
|
| 97 | + new ItemId($data[7]) |
|
| 98 | 98 | ); |
| 99 | - } catch ( \InvalidArgumentException $e ) { |
|
| 100 | - exit( 'Input file has bad formatted values.' ); |
|
| 99 | + } catch (\InvalidArgumentException $e) { |
|
| 100 | + exit('Input file has bad formatted values.'); |
|
| 101 | 101 | } |
| 102 | 102 | $dumpIds[] = $dumpMetaInformation->getDumpId(); |
| 103 | 103 | |
| 104 | 104 | try { |
| 105 | - $this->dumpMetaInformationStore->save( $dumpMetaInformation ); |
|
| 106 | - } catch ( DBError $e ) { |
|
| 107 | - exit( 'Unknown database error occurred.' ); |
|
| 105 | + $this->dumpMetaInformationStore->save($dumpMetaInformation); |
|
| 106 | + } catch (DBError $e) { |
|
| 107 | + exit('Unknown database error occurred.'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $i++; |
| 111 | - $this->log( "\r\033[K" ); |
|
| 112 | - $this->log( "$i rows inserted or updated" ); |
|
| 111 | + $this->log("\r\033[K"); |
|
| 112 | + $this->log("$i rows inserted or updated"); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - fclose( $csvFile ); |
|
| 115 | + fclose($csvFile); |
|
| 116 | 116 | |
| 117 | - $this->log( "\n" ); |
|
| 117 | + $this->log("\n"); |
|
| 118 | 118 | |
| 119 | 119 | return $dumpIds; |
| 120 | 120 | } |
@@ -123,31 +123,31 @@ discard block |
||
| 123 | 123 | * Inserts external values stored in csv file into database |
| 124 | 124 | */ |
| 125 | 125 | private function insertExternalValues() { |
| 126 | - $this->log( "Insert new data values\n" ); |
|
| 126 | + $this->log("Insert new data values\n"); |
|
| 127 | 127 | |
| 128 | - $csvFile = fopen( $this->importSettings->getExternalValuesFilePath(), 'rb' ); |
|
| 129 | - if ( !$csvFile ) { |
|
| 130 | - exit( 'Error while reading CSV file.' ); |
|
| 128 | + $csvFile = fopen($this->importSettings->getExternalValuesFilePath(), 'rb'); |
|
| 129 | + if (!$csvFile) { |
|
| 130 | + exit('Error while reading CSV file.'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $i = 0; |
| 134 | 134 | $accumulator = []; |
| 135 | - while ( true ) { |
|
| 136 | - $data = fgetcsv( $csvFile ); |
|
| 137 | - if ( $data === false || ++$i % $this->importSettings->getBatchSize() === 0 ) { |
|
| 135 | + while (true) { |
|
| 136 | + $data = fgetcsv($csvFile); |
|
| 137 | + if ($data === false || ++$i % $this->importSettings->getBatchSize() === 0) { |
|
| 138 | 138 | try { |
| 139 | - $this->externalDataRepo->insertBatch( $accumulator ); |
|
| 140 | - } catch ( DBError $e ) { |
|
| 141 | - exit( 'Unknown database error occurred.' ); |
|
| 139 | + $this->externalDataRepo->insertBatch($accumulator); |
|
| 140 | + } catch (DBError $e) { |
|
| 141 | + exit('Unknown database error occurred.'); |
|
| 142 | 142 | } |
| 143 | 143 | wfGetLBFactory()->waitForReplication(); |
| 144 | 144 | |
| 145 | - $this->log( "\r\033[K" ); |
|
| 146 | - $this->log( "$i rows inserted" ); |
|
| 145 | + $this->log("\r\033[K"); |
|
| 146 | + $this->log("$i rows inserted"); |
|
| 147 | 147 | |
| 148 | 148 | $accumulator = []; |
| 149 | 149 | |
| 150 | - if ( $data === false ) { |
|
| 150 | + if ($data === false) { |
|
| 151 | 151 | break; |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | $accumulator[] = $data; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - fclose( $csvFile ); |
|
| 158 | + fclose($csvFile); |
|
| 159 | 159 | |
| 160 | - $this->log( "\n" ); |
|
| 160 | + $this->log("\n"); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * @param string $text |
| 165 | 165 | */ |
| 166 | - private function log( $text ) { |
|
| 167 | - if ( !$this->importSettings->isQuiet() ) { |
|
| 166 | + private function log($text) { |
|
| 167 | + if (!$this->importSettings->isQuiet()) { |
|
| 168 | 168 | print $text; |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -24,23 +24,23 @@ discard block |
||
| 24 | 24 | * @param PropertyId[] $propertyIds |
| 25 | 25 | * @return array |
| 26 | 26 | */ |
| 27 | - public function getExternalData( array $dumpIds, array $externalIds, array $propertyIds ) { |
|
| 28 | - Assert::parameterElementType( 'string', $dumpIds, '$dumpIds' ); |
|
| 29 | - Assert::parameterElementType( 'string', $externalIds, '$externalIds' ); |
|
| 30 | - Assert::parameterElementType( PropertyId::class, $propertyIds, '$propertyIds' ); |
|
| 31 | - Assert::parameter( count( $dumpIds ) > 0, '$dumpIds', '$dumpIds has to contain at least one element.' ); |
|
| 32 | - Assert::parameter( count( $externalIds ) > 0, '$externalIds', '$externalIds has to contain at least one element.' ); |
|
| 27 | + public function getExternalData(array $dumpIds, array $externalIds, array $propertyIds) { |
|
| 28 | + Assert::parameterElementType('string', $dumpIds, '$dumpIds'); |
|
| 29 | + Assert::parameterElementType('string', $externalIds, '$externalIds'); |
|
| 30 | + Assert::parameterElementType(PropertyId::class, $propertyIds, '$propertyIds'); |
|
| 31 | + Assert::parameter(count($dumpIds) > 0, '$dumpIds', '$dumpIds has to contain at least one element.'); |
|
| 32 | + Assert::parameter(count($externalIds) > 0, '$externalIds', '$externalIds has to contain at least one element.'); |
|
| 33 | 33 | |
| 34 | 34 | $conditions = [ |
| 35 | 35 | 'dump_id' => $dumpIds, |
| 36 | 36 | 'external_id' => $externalIds |
| 37 | 37 | ]; |
| 38 | - if ( $propertyIds ) { |
|
| 38 | + if ($propertyIds) { |
|
| 39 | 39 | $conditions['pid'] = $propertyIds; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $externalData = []; |
| 43 | - $db = wfGetDB( DB_REPLICA ); |
|
| 43 | + $db = wfGetDB(DB_REPLICA); |
|
| 44 | 44 | $result = $db->select( |
| 45 | 45 | self::TABLE_NAME, |
| 46 | 46 | [ |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $conditions |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - foreach ( $result as $row ) { |
|
| 55 | + foreach ($result as $row) { |
|
| 56 | 56 | $externalData[$row->dump_id][$row->external_id][$row->pid][] = $row->external_value; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string $externalValue |
| 69 | 69 | * @return bool |
| 70 | 70 | */ |
| 71 | - public function insert( $dumpId, $externalId, PropertyId $propertyId, $externalValue ) { |
|
| 72 | - Assert::parameterType( 'string', $dumpId, '$dumpId' ); |
|
| 73 | - Assert::parameterType( 'string', $externalId, '$externalId' ); |
|
| 74 | - Assert::parameterType( 'string', $externalValue, '$externalValue' ); |
|
| 71 | + public function insert($dumpId, $externalId, PropertyId $propertyId, $externalValue) { |
|
| 72 | + Assert::parameterType('string', $dumpId, '$dumpId'); |
|
| 73 | + Assert::parameterType('string', $externalId, '$externalId'); |
|
| 74 | + Assert::parameterType('string', $externalValue, '$externalValue'); |
|
| 75 | 75 | |
| 76 | - $externalDataBatch = [ func_get_args() ]; |
|
| 77 | - return $this->insertBatch( $externalDataBatch ); |
|
| 76 | + $externalDataBatch = [func_get_args()]; |
|
| 77 | + return $this->insertBatch($externalDataBatch); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | * @throws DBError |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | - public function insertBatch( array $externalDataBatch ) { |
|
| 88 | - $db = wfGetDB( DB_MASTER ); |
|
| 87 | + public function insertBatch(array $externalDataBatch) { |
|
| 88 | + $db = wfGetDB(DB_MASTER); |
|
| 89 | 89 | $accumulator = array_map( |
| 90 | - function ( $externalData ) use ( $db ) { |
|
| 90 | + function($externalData) use ($db) { |
|
| 91 | 91 | return [ |
| 92 | 92 | 'dump_id' => $externalData[0], |
| 93 | 93 | 'external_id' => $externalData[1], |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | try { |
| 102 | 102 | $db->begin(); |
| 103 | - $result = $db->insert( self::TABLE_NAME, $accumulator ); |
|
| 103 | + $result = $db->insert(self::TABLE_NAME, $accumulator); |
|
| 104 | 104 | $db->commit(); |
| 105 | - } catch ( DBError $ex ) { |
|
| 105 | + } catch (DBError $ex) { |
|
| 106 | 106 | $db->rollback(); |
| 107 | 107 | throw $ex; |
| 108 | 108 | } |
@@ -117,21 +117,21 @@ discard block |
||
| 117 | 117 | * @param int $batchSize |
| 118 | 118 | * @throws \Wikimedia\Rdbms\DBUnexpectedError |
| 119 | 119 | */ |
| 120 | - public function deleteOfDump( $dumpId, $batchSize = 1000 ) { |
|
| 121 | - Assert::parameterType( 'string', $dumpId, '$dumpId' ); |
|
| 122 | - Assert::parameterType( 'integer', $batchSize, 'batchSize' ); |
|
| 120 | + public function deleteOfDump($dumpId, $batchSize = 1000) { |
|
| 121 | + Assert::parameterType('string', $dumpId, '$dumpId'); |
|
| 122 | + Assert::parameterType('integer', $batchSize, 'batchSize'); |
|
| 123 | 123 | |
| 124 | - $db = wfGetDB( DB_MASTER ); |
|
| 125 | - if ( $db->getType() === 'sqlite' ) { |
|
| 126 | - $db->delete( self::TABLE_NAME, [ 'dump_id' => $dumpId ] ); |
|
| 124 | + $db = wfGetDB(DB_MASTER); |
|
| 125 | + if ($db->getType() === 'sqlite') { |
|
| 126 | + $db->delete(self::TABLE_NAME, ['dump_id' => $dumpId]); |
|
| 127 | 127 | } else { |
| 128 | 128 | do { |
| 129 | - $db->commit( __METHOD__, 'flush' ); |
|
| 129 | + $db->commit(__METHOD__, 'flush'); |
|
| 130 | 130 | wfGetLBFactory()->waitForReplication(); |
| 131 | - $table = $db->tableName( self::TABLE_NAME ); |
|
| 132 | - $condition = 'dump_id = ' . $db->addQuotes( $dumpId ); |
|
| 133 | - $db->query( sprintf( 'DELETE FROM %s WHERE %s LIMIT %d', $table, $condition, $batchSize ) ); |
|
| 134 | - } while ( $db->affectedRows() > 0 ); |
|
| 131 | + $table = $db->tableName(self::TABLE_NAME); |
|
| 132 | + $condition = 'dump_id = '.$db->addQuotes($dumpId); |
|
| 133 | + $db->query(sprintf('DELETE FROM %s WHERE %s LIMIT %d', $table, $condition, $batchSize)); |
|
| 134 | + } while ($db->affectedRows() > 0); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | * @return DumpMetaInformation[] |
| 30 | 30 | * @throws InvalidArgumentException |
| 31 | 31 | */ |
| 32 | - public function getWithIds( array $dumpIds ) { |
|
| 33 | - if ( $dumpIds === [] ) { |
|
| 32 | + public function getWithIds(array $dumpIds) { |
|
| 33 | + if ($dumpIds === []) { |
|
| 34 | 34 | return []; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - foreach ( $dumpIds as $dumpId ) { |
|
| 38 | - if ( !is_string( $dumpId ) ) { |
|
| 39 | - throw new InvalidArgumentException( '$dumpIds must contain only strings.' ); |
|
| 37 | + foreach ($dumpIds as $dumpId) { |
|
| 38 | + if (!is_string($dumpId)) { |
|
| 39 | + throw new InvalidArgumentException('$dumpIds must contain only strings.'); |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $db = wfGetDB( DB_REPLICA ); |
|
| 43 | + $db = wfGetDB(DB_REPLICA); |
|
| 44 | 44 | $result = $db->select( |
| 45 | 45 | [ |
| 46 | 46 | self::META_TABLE_NAME, |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ] |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - return $this->buildDumpMetaInformationFromResult( $result ); |
|
| 63 | + return $this->buildDumpMetaInformationFromResult($result); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -72,20 +72,20 @@ discard block |
||
| 72 | 72 | * @throws InvalidArgumentException |
| 73 | 73 | * @return DumpMetaInformation[] |
| 74 | 74 | */ |
| 75 | - public function getWithIdentifierProperties( array $identifierPropertyIds ) { |
|
| 76 | - if ( $identifierPropertyIds === [] ) { |
|
| 75 | + public function getWithIdentifierProperties(array $identifierPropertyIds) { |
|
| 76 | + if ($identifierPropertyIds === []) { |
|
| 77 | 77 | return []; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - foreach ( $identifierPropertyIds as $propertyId ) { |
|
| 81 | - if ( !( $propertyId instanceof PropertyId ) ) { |
|
| 82 | - throw new InvalidArgumentException( '$identifierProperties must contain only PropertyIds.' ); |
|
| 80 | + foreach ($identifierPropertyIds as $propertyId) { |
|
| 81 | + if (!($propertyId instanceof PropertyId)) { |
|
| 82 | + throw new InvalidArgumentException('$identifierProperties must contain only PropertyIds.'); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $db = wfGetDB( DB_REPLICA ); |
|
| 86 | + $db = wfGetDB(DB_REPLICA); |
|
| 87 | 87 | $identifierPropertyIds = array_map( |
| 88 | - function( PropertyId $id ) { |
|
| 88 | + function(PropertyId $id) { |
|
| 89 | 89 | return $id->getSerialization(); |
| 90 | 90 | }, |
| 91 | 91 | $identifierPropertyIds |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | ] |
| 99 | 99 | ); |
| 100 | 100 | $dumpIds = []; |
| 101 | - foreach ( $result as $row ) { |
|
| 102 | - if ( !in_array( $row->dump_id, $dumpIds ) ) { |
|
| 101 | + foreach ($result as $row) { |
|
| 102 | + if (!in_array($row->dump_id, $dumpIds)) { |
|
| 103 | 103 | $dumpIds[] = $row->dump_id; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - return $this->getWithIds( $dumpIds ); |
|
| 107 | + return $this->getWithIds($dumpIds); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return DumpMetaInformation[] |
| 115 | 115 | */ |
| 116 | 116 | public function getAll() { |
| 117 | - $db = wfGetDB( DB_REPLICA ); |
|
| 117 | + $db = wfGetDB(DB_REPLICA); |
|
| 118 | 118 | $result = $db->select( |
| 119 | 119 | [ |
| 120 | 120 | self::META_TABLE_NAME, |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | ] |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | - return $this->buildDumpMetaInformationFromResult( $result ); |
|
| 135 | + return $this->buildDumpMetaInformationFromResult($result); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -140,34 +140,34 @@ discard block |
||
| 140 | 140 | * @return null|array |
| 141 | 141 | * @throws UnexpectedValueException |
| 142 | 142 | */ |
| 143 | - private function buildDumpMetaInformationFromResult( ResultWrapper $result ) { |
|
| 143 | + private function buildDumpMetaInformationFromResult(ResultWrapper $result) { |
|
| 144 | 144 | $aggregatedRows = []; |
| 145 | - foreach ( $result as $row ) { |
|
| 146 | - if ( array_key_exists( $row->id, $aggregatedRows ) ) { |
|
| 147 | - $propertyId = new PropertyId( $row->identifier_pid ); |
|
| 145 | + foreach ($result as $row) { |
|
| 146 | + if (array_key_exists($row->id, $aggregatedRows)) { |
|
| 147 | + $propertyId = new PropertyId($row->identifier_pid); |
|
| 148 | 148 | $aggregatedRows[$row->id]->identifier_pid[] = $propertyId; |
| 149 | 149 | } else { |
| 150 | - if ( $row->identifier_pid !== null ) { |
|
| 151 | - $propertyId = new PropertyId( $row->identifier_pid ); |
|
| 152 | - $row->identifier_pid = [ $propertyId ]; |
|
| 150 | + if ($row->identifier_pid !== null) { |
|
| 151 | + $propertyId = new PropertyId($row->identifier_pid); |
|
| 152 | + $row->identifier_pid = [$propertyId]; |
|
| 153 | 153 | } |
| 154 | 154 | $aggregatedRows[$row->id] = $row; |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $dumpMetaInformation = []; |
| 159 | - foreach ( $aggregatedRows as $row ) { |
|
| 159 | + foreach ($aggregatedRows as $row) { |
|
| 160 | 160 | $dumpId = $row->id; |
| 161 | - $sourceItemId = new ItemId( $row->source_qid ); |
|
| 162 | - $importDate = wfTimestamp( TS_MW, $row->import_date ); |
|
| 161 | + $sourceItemId = new ItemId($row->source_qid); |
|
| 162 | + $importDate = wfTimestamp(TS_MW, $row->import_date); |
|
| 163 | 163 | $language = $row->language; |
| 164 | 164 | $sourceUrl = $row->source_url; |
| 165 | 165 | $size = (int)$row->size; |
| 166 | - $licenseItemId = new ItemId( $row->license_qid ); |
|
| 166 | + $licenseItemId = new ItemId($row->license_qid); |
|
| 167 | 167 | $identifierPropertyIds = $row->identifier_pid; |
| 168 | 168 | |
| 169 | 169 | $dumpMetaInformation[$row->dump_id] = |
| 170 | - new DumpMetaInformation( $dumpId, |
|
| 170 | + new DumpMetaInformation($dumpId, |
|
| 171 | 171 | $sourceItemId, |
| 172 | 172 | $identifierPropertyIds, |
| 173 | 173 | $importDate, |
@@ -186,22 +186,22 @@ discard block |
||
| 186 | 186 | * |
| 187 | 187 | * @param DumpMetaInformation $dumpMetaInformation |
| 188 | 188 | */ |
| 189 | - public function save( DumpMetaInformation $dumpMetaInformation ) { |
|
| 190 | - $db = wfGetDB( DB_REPLICA ); |
|
| 189 | + public function save(DumpMetaInformation $dumpMetaInformation) { |
|
| 190 | + $db = wfGetDB(DB_REPLICA); |
|
| 191 | 191 | $dumpId = $dumpMetaInformation->getDumpId(); |
| 192 | - $accumulator = $this->getDumpInformationFields( $db, $dumpMetaInformation ); |
|
| 192 | + $accumulator = $this->getDumpInformationFields($db, $dumpMetaInformation); |
|
| 193 | 193 | |
| 194 | 194 | $existing = $db->selectRow( |
| 195 | 195 | self::META_TABLE_NAME, |
| 196 | - [ 'id' ], |
|
| 197 | - [ 'id' => $dumpId ] |
|
| 196 | + ['id'], |
|
| 197 | + ['id' => $dumpId] |
|
| 198 | 198 | ); |
| 199 | 199 | |
| 200 | - if ( $existing ) { |
|
| 200 | + if ($existing) { |
|
| 201 | 201 | $db->update( |
| 202 | 202 | self::META_TABLE_NAME, |
| 203 | 203 | $accumulator, |
| 204 | - [ 'id' => $dumpId ] |
|
| 204 | + ['id' => $dumpId] |
|
| 205 | 205 | ); |
| 206 | 206 | } else { |
| 207 | 207 | $db->insert( |
@@ -212,12 +212,12 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $db->delete( |
| 214 | 214 | self::IDENTIFIER_PROPERTIES_TABLE_NAME, |
| 215 | - [ 'dump_id' => $dumpId ] |
|
| 215 | + ['dump_id' => $dumpId] |
|
| 216 | 216 | ); |
| 217 | 217 | $db->insert( |
| 218 | 218 | self::IDENTIFIER_PROPERTIES_TABLE_NAME, |
| 219 | 219 | array_map( |
| 220 | - function ( PropertyId $identifierPropertyId ) use ( $dumpId ) { |
|
| 220 | + function(PropertyId $identifierPropertyId) use ($dumpId) { |
|
| 221 | 221 | return [ |
| 222 | 222 | 'dump_id' => $dumpId, |
| 223 | 223 | 'identifier_pid' => $identifierPropertyId->getSerialization() |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | * @param DumpMetaInformation $dumpMetaInformation |
| 234 | 234 | * @return array |
| 235 | 235 | */ |
| 236 | - private function getDumpInformationFields( IDatabase $db, DumpMetaInformation $dumpMetaInformation ) { |
|
| 236 | + private function getDumpInformationFields(IDatabase $db, DumpMetaInformation $dumpMetaInformation) { |
|
| 237 | 237 | return [ |
| 238 | 238 | 'id' => $dumpMetaInformation->getDumpId(), |
| 239 | 239 | 'source_qid' => $dumpMetaInformation->getSourceItemId()->getSerialization(), |
| 240 | - 'import_date' => $db->timestamp( $dumpMetaInformation->getImportDate() ), |
|
| 240 | + 'import_date' => $db->timestamp($dumpMetaInformation->getImportDate()), |
|
| 241 | 241 | 'language' => $dumpMetaInformation->getLanguageCode(), |
| 242 | 242 | 'source_url' => $dumpMetaInformation->getSourceUrl(), |
| 243 | 243 | 'size' => $dumpMetaInformation->getSize(), |