@@ -213,7 +213,7 @@ |
||
| 213 | 213 | $midgard = midgard_connection::get_instance(); |
| 214 | 214 | if ($midgard->config->logfilename) { |
| 215 | 215 | $logdir = dirname($midgard->config->logfilename); |
| 216 | - if ( !is_dir($logdir) |
|
| 216 | + if (!is_dir($logdir) |
|
| 217 | 217 | && !mkdir($logdir, 0777, true)) { |
| 218 | 218 | throw exception::user_data('Log directory could not be created'); |
| 219 | 219 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $mgd_config = midgard_connection::get_instance()->config; |
| 57 | 57 | $mgdschema_file = $mgd_config->vardir . '/mgdschema_classes.php'; |
| 58 | - if ( file_exists($mgdschema_file) |
|
| 58 | + if (file_exists($mgdschema_file) |
|
| 59 | 59 | && !unlink($mgdschema_file)) { |
| 60 | 60 | throw new \RuntimeException('Could not unlink ' . $mgdschema_file); |
| 61 | 61 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $cms = $em->getMetadataFactory()->getAllMetadata(); |
| 73 | 73 | |
| 74 | 74 | // create storage |
| 75 | - if ( !midgard_storage::create_base_storage() |
|
| 75 | + if (!midgard_storage::create_base_storage() |
|
| 76 | 76 | && midgard_connection::get_instance()->get_error_string() != 'MGD_ERR_OK') { |
| 77 | 77 | throw new \Exception("Failed to create base database structures" . midgard_connection::get_instance()->get_error_string()); |
| 78 | 78 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $parsed = $this->parse_constraint_name($property); |
| 64 | 64 | |
| 65 | 65 | // for properties like up.name |
| 66 | - if ( strpos($property, ".") !== false |
|
| 66 | + if (strpos($property, ".") !== false |
|
| 67 | 67 | && !(strpos($property, "metadata") === 0)) { |
| 68 | 68 | return $parsed['name'] . " as " . str_replace(".", "_", $property); |
| 69 | 69 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function get($key) |
| 136 | 136 | { |
| 137 | - if ( !$this->_has_results() |
|
| 137 | + if (!$this->_has_results() |
|
| 138 | 138 | || !isset($this->_results[$key])) { |
| 139 | 139 | return false; |
| 140 | 140 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } else { |
| 66 | 66 | if ($property->parentfield) { |
| 67 | 67 | $this->parentfield = $property->name; |
| 68 | - if ( empty($this->parent) |
|
| 68 | + if (empty($this->parent) |
|
| 69 | 69 | && $property->link) { |
| 70 | 70 | $this->parent = $property->link['target']; |
| 71 | 71 | } |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | |
| 157 | 157 | foreach ($type->get_properties() as $name => $property) { |
| 158 | 158 | // doctrine can handle id links only |
| 159 | - if ( $property->link |
|
| 159 | + if ($property->link |
|
| 160 | 160 | && $target_class = $this->manager->resolve_targetclass($property)) { |
| 161 | 161 | $link_mapping = [ |
| 162 | 162 | 'fieldName' => $property->name, |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function read_file_at_path($path) |
| 34 | 34 | { |
| 35 | - if ( !file_exists($path) |
|
| 35 | + if (!file_exists($path) |
|
| 36 | 36 | || !is_readable($path)) { |
| 37 | 37 | return false; |
| 38 | 38 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $subdirs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F']; |
| 146 | 146 | foreach ($subdirs as $dir) { |
| 147 | 147 | foreach ($subdirs as $subdir) { |
| 148 | - if ( !is_dir($this->blobdir . '/' . $dir . '/' . $subdir) |
|
| 148 | + if (!is_dir($this->blobdir . '/' . $dir . '/' . $subdir) |
|
| 149 | 149 | && !mkdir($this->blobdir . '/' . $dir . '/' . $subdir, 0777, true)) { |
| 150 | 150 | return false; |
| 151 | 151 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | private function load_by_properties(array $properties) |
| 63 | 63 | { |
| 64 | - if ( !array_key_exists('authtype', $properties) |
|
| 64 | + if (!array_key_exists('authtype', $properties) |
|
| 65 | 65 | || !array_key_exists('login', $properties)) { |
| 66 | 66 | throw exception::invalid_property_value(); |
| 67 | 67 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | public function &get_person() |
| 111 | 111 | { |
| 112 | - if ( $this->person_object === null |
|
| 112 | + if ($this->person_object === null |
|
| 113 | 113 | && $this->person !== null) { |
| 114 | 114 | $this->person_object = connection::get_em()->getRepository('midgard:midgard_person')->findOneBy(['guid' => $this->person]); |
| 115 | 115 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | public function create() |
| 120 | 120 | { |
| 121 | - if ( empty($this->authtype) |
|
| 121 | + if (empty($this->authtype) |
|
| 122 | 122 | || !empty($this->id)) { |
| 123 | 123 | exception::invalid_property_value(); |
| 124 | 124 | return false; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | protected function is_unique() |
| 184 | 184 | { |
| 185 | - if ( empty($this->login) |
|
| 185 | + if (empty($this->login) |
|
| 186 | 186 | || empty($this->authtype)) { |
| 187 | 187 | return true; |
| 188 | 188 | } |
@@ -201,19 +201,19 @@ |
||
| 201 | 201 | break; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if ( $dbobject->id > 0 |
|
| 204 | + if ($dbobject->id > 0 |
|
| 205 | 205 | && $dbobject->metadata->revised->format('U') >= $object->metadata->revised->format('U')) { |
| 206 | 206 | midgard_connection::get_instance()->set_error(exception::OBJECT_IMPORTED); |
| 207 | 207 | return false; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if ( $dbobject->metadata->deleted |
|
| 210 | + if ($dbobject->metadata->deleted |
|
| 211 | 211 | && !$object->metadata->deleted) { |
| 212 | 212 | if (!midgard_object_class::undelete($dbobject->guid)) { |
| 213 | 213 | return false; |
| 214 | 214 | } |
| 215 | 215 | $dbobject->metadata_deleted = false; |
| 216 | - } elseif ( !$dbobject->metadata->deleted |
|
| 216 | + } elseif (!$dbobject->metadata->deleted |
|
| 217 | 217 | && $object->metadata->deleted) { |
| 218 | 218 | return $dbobject->delete(); |
| 219 | 219 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if (!($entity instanceof repligard)) { |
| 100 | 100 | $repligard_entry = $em->getRepository('midgard:midgard_repligard')->findOneBy(['guid' => $entity->guid]); |
| 101 | 101 | |
| 102 | - if ( $entity instanceof metadata |
|
| 102 | + if ($entity instanceof metadata |
|
| 103 | 103 | && $entity->{metadata::DELETED_FIELD}) { |
| 104 | 104 | $repligard_entry->object_action = self::ACTION_DELETE; |
| 105 | 105 | } else { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | foreach ($columns as $name => &$config) { |
| 142 | 142 | if ($platform->getName() === 'sqlite') { |
| 143 | - if ( !empty($config['primary']) |
|
| 143 | + if (!empty($config['primary']) |
|
| 144 | 144 | && !empty($config['autoincrement'])) { |
| 145 | 145 | /* |
| 146 | 146 | * This is essentially a workaround for http://www.doctrine-project.org/jira/browse/DBAL-642 |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $modified = true; |
| 150 | 150 | $config['columnDefinition'] = 'INTEGER PRIMARY KEY AUTOINCREMENT'; |
| 151 | 151 | } |
| 152 | - if ( !empty($config['comment']) |
|
| 152 | + if (!empty($config['comment']) |
|
| 153 | 153 | && $config['comment'] == 'BINARY') { |
| 154 | 154 | $modified = true; |
| 155 | 155 | $config['columnDefinition'] = $config['type']->getSQLDeclaration($config, $platform) . ' COLLATE BINARY' . $platform->getDefaultValueDeclarationSQL($config); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $config['columnDefinition'] = $config['comment'] . $platform->getDefaultValueDeclarationSQL($config); |
| 167 | 167 | } |
| 168 | 168 | if (!empty($config['columnDefinition']) && $platform->supportsInlineColumnComments()) { |
| 169 | - $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
| 169 | + $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $args) |
| 261 | 261 | { |
| 262 | 262 | $table = $args->getClassTable(); |
| 263 | - if ( !$table->hasOption('engine') |
|
| 263 | + if (!$table->hasOption('engine') |
|
| 264 | 264 | || $table->getOption('engine') !== 'MyISAM') { |
| 265 | 265 | return; |
| 266 | 266 | } |