Subversion Repositories oidplus

Rev

Rev 977 | Rev 998 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 977 Rev 978
Line 39... Line 39...
39
        }
39
        }
40
 
40
 
41
        private function ra_change_rec($id, $old_ra, $new_ra) {
41
        private function ra_change_rec($id, $old_ra, $new_ra) {
42
                if (is_null($old_ra)) $old_ra = '';
42
                if (is_null($old_ra)) $old_ra = '';
43
                OIDplus::db()->query("update ###objects set ra_email = ?, updated = ".OIDplus::db()->sqlDate()." where id = ? and ".OIDplus::db()->getSlang()->isNullFunction('ra_email',"''")." = ?", array($new_ra, $id, $old_ra));
43
                OIDplus::db()->query("update ###objects set ra_email = ?, updated = ".OIDplus::db()->sqlDate()." where id = ? and ".OIDplus::db()->getSlang()->isNullFunction('ra_email',"''")." = ?", array($new_ra, $id, $old_ra));
-
 
44
                OIDplusObject::resetObjectInformationCache();
44
 
45
 
45
                $res = OIDplus::db()->query("select id from ###objects where parent = ? and ".OIDplus::db()->getSlang()->isNullFunction('ra_email',"''")." = ?", array($id, $old_ra));
46
                $res = OIDplus::db()->query("select id from ###objects where parent = ? and ".OIDplus::db()->getSlang()->isNullFunction('ra_email',"''")." = ?", array($id, $old_ra));
46
                while ($row = $res->fetch_array()) {
47
                while ($row = $res->fetch_array()) {
47
                        $this->ra_change_rec($row['id'], $old_ra, $new_ra);
48
                        $this->ra_change_rec($row['id'], $old_ra, $new_ra);
48
                }
49
                }
Line 81... Line 82...
81
                                OIDplus::logger()->log("[WARN]OID($parent_oid)", "Object '$id' (recursively) deleted");
82
                                OIDplus::logger()->log("[WARN]OID($parent_oid)", "Object '$id' (recursively) deleted");
82
                        }
83
                        }
83
 
84
 
84
                        // Delete object
85
                        // Delete object
85
                        OIDplus::db()->query("delete from ###objects where id = ?", array($id));
86
                        OIDplus::db()->query("delete from ###objects where id = ?", array($id));
-
 
87
                        OIDplusObject::resetObjectInformationCache();
86
 
88
 
87
                        // Delete orphan stuff
89
                        // Delete orphan stuff
88
                        foreach (OIDplus::getEnabledObjectTypes() as $ot) {
90
                        foreach (OIDplus::getEnabledObjectTypes() as $ot) {
89
                                do {
91
                                do {
90
                                        $res = OIDplus::db()->query("select tchild.id from ###objects tchild " .
92
                                        $res = OIDplus::db()->query("select tchild.id from ###objects tchild " .
Line 94... Line 96...
94
 
96
 
95
                                        while ($row = $res->fetch_array()) {
97
                                        while ($row = $res->fetch_array()) {
96
                                                $id_to_delete = $row['id'];
98
                                                $id_to_delete = $row['id'];
97
                                                OIDplus::logger()->log("[CRIT]OIDRA($id_to_delete)!", "Lost ownership of object '$id_to_delete' because one of the superior objects ('$id') was recursively deleted");
99
                                                OIDplus::logger()->log("[CRIT]OIDRA($id_to_delete)!", "Lost ownership of object '$id_to_delete' because one of the superior objects ('$id') was recursively deleted");
98
                                                OIDplus::db()->query("delete from ###objects where id = ?", array($id_to_delete));
100
                                                OIDplus::db()->query("delete from ###objects where id = ?", array($id_to_delete));
-
 
101
                                                OIDplusObject::resetObjectInformationCache();
99
                                        }
102
                                        }
100
                                } while (true);
103
                                } while (true);
101
                        }
104
                        }
102
                        OIDplus::db()->query("delete from ###asn1id where well_known = ? and oid not in (select id from ###objects where id like 'oid:%')", array(false));
105
                        OIDplus::db()->query("delete from ###asn1id where well_known = ? and oid not in (select id from ###objects where id like 'oid:%')", array(false));
103
                        OIDplus::db()->query("delete from ###iri    where well_known = ? and oid not in (select id from ###objects where id like 'oid:%')", array(false));
106
                        OIDplus::db()->query("delete from ###iri    where well_known = ? and oid not in (select id from ###objects where id like 'oid:%')", array(false));
Line 209... Line 212...
209
                        }
212
                        }
210
 
213
 
211
                        if (isset($params['confidential'])) {
214
                        if (isset($params['confidential'])) {
212
                                $confidential = $params['confidential'] == 'true';
215
                                $confidential = $params['confidential'] == 'true';
213
                                OIDplus::db()->query("UPDATE ###objects SET confidential = ? WHERE id = ?", array($confidential, $id));
216
                                OIDplus::db()->query("UPDATE ###objects SET confidential = ? WHERE id = ?", array($confidential, $id));
-
 
217
                                OIDplusObject::resetObjectInformationCache();
214
                        }
218
                        }
215
 
219
 
216
                        if (isset($params['comment'])) {
220
                        if (isset($params['comment'])) {
217
                                $comment = $params['comment'];
221
                                $comment = $params['comment'];
218
                                OIDplus::db()->query("UPDATE ###objects SET comment = ? WHERE id = ?", array($comment, $id));
222
                                OIDplus::db()->query("UPDATE ###objects SET comment = ? WHERE id = ?", array($comment, $id));
-
 
223
                                OIDplusObject::resetObjectInformationCache();
219
                        }
224
                        }
220
 
225
 
221
                        OIDplus::db()->query("UPDATE ###objects SET updated = ".OIDplus::db()->sqlDate()." WHERE id = ?", array($id));
226
                        OIDplus::db()->query("UPDATE ###objects SET updated = ".OIDplus::db()->sqlDate()." WHERE id = ?", array($id));
-
 
227
                        OIDplusObject::resetObjectInformationCache();
222
 
228
 
223
                        $status = 0;
229
                        $status = 0;
224
 
230
 
225
                        if (!empty($new_ra)) {
231
                        if (!empty($new_ra)) {
226
                                $res = OIDplus::db()->query("select ra_name from ###ra where email = ?", array($new_ra));
232
                                $res = OIDplus::db()->query("select ra_name from ###ra where email = ?", array($new_ra));
Line 269... Line 275...
269
                        OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]OIDRA($id)?/[?INFO/!OK]A?", "Title/Description of object '$id' updated");
275
                        OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]OIDRA($id)?/[?INFO/!OK]A?", "Title/Description of object '$id' updated");
270
 
276
 
271
                        if (isset($params['title'])) {
277
                        if (isset($params['title'])) {
272
                                $title = $params['title'];
278
                                $title = $params['title'];
273
                                OIDplus::db()->query("UPDATE ###objects SET title = ? WHERE id = ?", array($title, $id));
279
                                OIDplus::db()->query("UPDATE ###objects SET title = ? WHERE id = ?", array($title, $id));
-
 
280
                                OIDplusObject::resetObjectInformationCache();
274
                        }
281
                        }
275
 
282
 
276
                        if (isset($params['description'])) {
283
                        if (isset($params['description'])) {
277
                                $description = $params['description'];
284
                                $description = $params['description'];
278
                                OIDplus::db()->query("UPDATE ###objects SET description = ? WHERE id = ?", array($description, $id));
285
                                OIDplus::db()->query("UPDATE ###objects SET description = ? WHERE id = ?", array($description, $id));
-
 
286
                                OIDplusObject::resetObjectInformationCache();
279
                        }
287
                        }
280
 
288
 
281
                        OIDplus::db()->query("UPDATE ###objects SET updated = ".OIDplus::db()->sqlDate()." WHERE id = ?", array($id));
289
                        OIDplus::db()->query("UPDATE ###objects SET updated = ".OIDplus::db()->sqlDate()." WHERE id = ?", array($id));
-
 
290
                        OIDplusObject::resetObjectInformationCache();
282
 
291
 
283
                        foreach (OIDplus::getPagePlugins() as $plugin) {
292
                        foreach (OIDplus::getPagePlugins() as $plugin) {
284
                                if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) {
293
                                if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) {
285
                                        $plugin->afterObjectUpdateSelf($id, $params);
294
                                        $plugin->afterObjectUpdateSelf($id, $params);
286
                                }
295
                                }
Line 401... Line 410...
401
                                $maxlen = OIDplus::baseConfig()->getValue('LIMITS_MAX_ID_LENGTH');
410
                                $maxlen = OIDplus::baseConfig()->getValue('LIMITS_MAX_ID_LENGTH');
402
                                throw new OIDplusException(_L('The identifier %1 is too long (max allowed length: %2)',$id,$maxlen));
411
                                throw new OIDplusException(_L('The identifier %1 is too long (max allowed length: %2)',$id,$maxlen));
403
                        }
412
                        }
404
 
413
 
405
                        OIDplus::db()->query("INSERT INTO ###objects (id, parent, ra_email, confidential, comment, created, title, description) VALUES (?, ?, ?, ?, ?, ".OIDplus::db()->sqlDate().", ?, ?)", array($id, $parent, $ra_email, $confidential, $comment, $title, $description));
414
                        OIDplus::db()->query("INSERT INTO ###objects (id, parent, ra_email, confidential, comment, created, title, description) VALUES (?, ?, ?, ?, ?, ".OIDplus::db()->sqlDate().", ?, ?)", array($id, $parent, $ra_email, $confidential, $comment, $title, $description));
-
 
415
                        OIDplusObject::resetObjectInformationCache();
406
 
416
 
407
                        // Set ASN.1 IDs und IRIs
417
                        // Set ASN.1 IDs und IRIs
408
                        if ($obj::ns() == 'oid') {
418
                        if ($obj::ns() == 'oid') {
409
                                if (!$obj->isWellKnown()) {
419
                                if (!$obj->isWellKnown()) {
410
                                        if (isset($params['iris'])) {
420
                                        if (isset($params['iris'])) {