@@ -342,31 +342,34 @@ public static function migrateLegacyMeta($shareCenter, $shareStore, $shareRightM
342
342
rename ($ legacyLinkFile , $ legacyLinkFile .".migrated " );
343
343
if (isSet ($ share ["minisite " ])){
344
344
print ("\n--Migrate legacy minisite to new minisite? " );
345
- $ sharedRepoId = $ publiclet ["REPOSITORY " ];
346
- $ sharedRepo = ConfService::getRepositoryById ($ sharedRepoId );
347
- if ($ sharedRepo == null ){
348
- print ("\n--ERROR: Cannot find repository with id " .$ sharedRepoId );
349
- continue ;
350
- }
351
- $ shareLink = new ShareLink ($ shareStore , $ publiclet );
352
- $ user = $ shareLink ->getUniqueUser ();
353
- if (AuthService::userExists ($ user )){
354
- $ userObject = ConfService::getConfStorageImpl ()->createUserObject ($ user );
355
- $ userObject ->setHidden (true );
356
- print ("\n--Should set existing user $ user as hidden " );
345
+ try {
346
+ $ sharedRepoId = $ publiclet ["REPOSITORY " ];
347
+ $ sharedRepo = ConfService::getRepositoryById ($ sharedRepoId );
348
+ if ($ sharedRepo == null ){
349
+ print ("\n--ERROR: Cannot find repository with id " .$ sharedRepoId );
350
+ continue ;
351
+ }
352
+ $ shareLink = new ShareLink ($ shareStore , $ publiclet );
353
+ $ user = $ shareLink ->getUniqueUser ();
354
+ if (AuthService::userExists ($ user )){
355
+ $ userObject = ConfService::getConfStorageImpl ()->createUserObject ($ user );
356
+ $ userObject ->setHidden (true );
357
+ print ("\n--Should set existing user $ user as hidden " );
358
+ if (!$ dryRun ){
359
+ $ userObject ->save ();
360
+ }
361
+ }
362
+ $ shareLink ->parseHttpVars (["custom_handle " => $ element ]);
363
+ $ shareLink ->setParentRepositoryId ($ sharedRepo ->getParentId ());
364
+ print ("\n--Creating the following share object " );
365
+ print_r ($ shareLink ->getJsonData ($ shareCenter ->getPublicAccessManager (), ConfService::getMessages ()));
357
366
if (!$ dryRun ){
358
- $ userObject ->save ();
367
+ $ shareLink ->save ();
359
368
}
369
+ $ meta ["ajxp_shared " ] = ["shares " => [$ element => ["type " => "minisite " ], $ sharedRepoId => ["type " => "repository " ]]];
370
+ }catch (Exception $ e ){
371
+ print ("\n-- Error " .$ e ->getMessage ());
360
372
}
361
- $ shareLink ->parseHttpVars (["custom_handle " => $ element ]);
362
- $ shareLink ->setParentRepositoryId ($ sharedRepo ->getParentId ());
363
- print ("\n--Creating the following share object " );
364
- print_r ($ shareLink ->getJsonData ($ shareCenter ->getPublicAccessManager (), ConfService::getMessages ()));
365
- if (!$ dryRun ){
366
- $ shareLink ->save ();
367
- }
368
- $ meta ["ajxp_shared " ] = ["shares " => [$ element => ["type " => "minisite " ], $ sharedRepoId => ["type " => "repository " ]]];
369
-
370
373
371
374
}else {
372
375
print ("\n--Should migrate legacy link to new minisite with ContentFilter " );
0 commit comments