diff --git a/lib/Doctrine/deploy/AddCertificationStatuses.php b/lib/Doctrine/deploy/AddCertificationStatuses.php index a95afedc9..f931b79ac 100644 --- a/lib/Doctrine/deploy/AddCertificationStatuses.php +++ b/lib/Doctrine/deploy/AddCertificationStatuses.php @@ -2,9 +2,9 @@ require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/AddUtils.php"; -/* AddNGIs.php: Loads a list of cert statuses from an XML file and - * inserts them into the doctrine prototype. - * XML format is the xml input format of the cert status seed data +/* AddCertificationStatuses.php: Loads a list of cert statuses from + * an XML file and inserts them into the doctrine prototype. + * XML format is the xml input format of the cert status seed data. */ $certStatsFileName = __DIR__ . "/" . $GLOBALS['dataDir'] . "/CertificationStatuses.xml"; diff --git a/lib/Doctrine/deploy/AddDowntimes.php b/lib/Doctrine/deploy/AddDowntimes.php index da43206fc..4e9f5c088 100644 --- a/lib/Doctrine/deploy/AddDowntimes.php +++ b/lib/Doctrine/deploy/AddDowntimes.php @@ -30,10 +30,9 @@ // Hack: the above SEs appear twice with the same service type. (nightmare) // However in most cases both SEs share the same downtimes... -// AddDowntimes.php: Loads a list of downtimes from an +// AddDowntimes.php: Loads a list of downtimes from an // XML file and inserts them into the doctrine prototype. -// XML format is the output from get_service_endpoints PI query. -// +// XML format is the output from get_downtime PI query. $allDowntimes = array(); @@ -57,14 +56,17 @@ $downtime = null; // See if we've already entered a downtime with this prom ID if (isset($allDowntimes[$promId])) { - // load $downtime from db by $promId rather than loading from global + // Load $downtime from db by $promId rather than loading from global // array. This assumes xml ID attribute (without 'G0' appended) is // the same as xml PRIMARY_KEY attribute. // // $downtime = $entityManager->createQuery("select d FROM Downtime " . // "d WHERE d.primaryKey = ?1") - // ->setParameter(1, (string) $promId.'G0') - // ->getResult(); + // ->setParameter( + // 1, + // (string) $promId.'G0' + // ) + // ->getResult(); $downtime = $allDowntimes[$promId]; } @@ -78,7 +80,7 @@ ); // There are some edge cases where findSEs returns - // more than one SE (see the comment at the top of this file) + // more than one SE (see the comment at the top of this file). // However if the downtime isn't yet created we always // link to the first SE found. if (!isset($services[0])) { @@ -141,7 +143,7 @@ // Check whether this exception is caused by a known issue // with duplicate SEs (see comment at the top of the file). // Issue is known if two SEs are found and the hostname is - // a known duplicate + // a known duplicate. $twoSes = false; if (count($services) == 2) { $twoSes = true; diff --git a/lib/Doctrine/deploy/AddInfrastructures.php b/lib/Doctrine/deploy/AddInfrastructures.php index c2814b76c..f28e7dd6a 100644 --- a/lib/Doctrine/deploy/AddInfrastructures.php +++ b/lib/Doctrine/deploy/AddInfrastructures.php @@ -3,7 +3,7 @@ require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/AddUtils.php"; -/* AddNGIs.php: Loads a list of infrastructures from an XML file and +/* AddInfrastructures.php: Loads a list of infrastructures from an XML file and * inserts them into the doctrine prototype. * XML format is the xml input production status format. */ diff --git a/lib/Doctrine/deploy/AddNGIRoles.php b/lib/Doctrine/deploy/AddNGIRoles.php index 7894f63a4..d21f103f8 100644 --- a/lib/Doctrine/deploy/AddNGIRoles.php +++ b/lib/Doctrine/deploy/AddNGIRoles.php @@ -19,7 +19,7 @@ continue; } - // get roletype entity + // Get roletype entity $dql = "SELECT rt FROM RoleType rt WHERE rt.name = :roleType"; $roleTypes = $entityManager->createQuery($dql) ->setParameter( @@ -27,8 +27,9 @@ (string) $role->USER_ROLE ) ->getResult(); + // /* Error checking: ensure each role type refers to exactly - // * one role type*/ + // * one role type */ if (count($roleTypes) !== 1) { throw new Exception(count($roleTypes) . " role types found " . "with name: " . $role->USER_ROLE); @@ -59,8 +60,8 @@ $doctrineUser = $doctrineUser; } - // Check for invalid NGIs and skip - // typically these are decomissioned ROCs + // Check for invalid NGIs and skip. + // Typically these are decomissioned ROCs. if ( $role->ON_ENTITY == 'GridIreland' || $role->ON_ENTITY == 'NGS' @@ -71,7 +72,7 @@ continue; } - // get ngi entity + // Get ngi entity $ngiName = (string) $role->ON_ENTITY; $dql = "SELECT n FROM NGI n WHERE n.name = :ngi"; $ngis = $entityManager->createQuery($dql) @@ -80,6 +81,7 @@ $ngiName ) ->getResult(); + // /* Error checking: ensure each "ngi" refers to exactly // * one ngi */ if (count($ngis) !== 1) { @@ -91,7 +93,8 @@ $ngi = $ngi; } - //check that the role is not a duplicate (v4 data contaisn duplicates) + // Check that the role is not a duplicate + // (v4 data contains duplicates) $ExistingUserRoles = $doctrineUser->getRoles(); $thisIsADuplicateRole=false; foreach ($ExistingUserRoles as $role) { diff --git a/lib/Doctrine/deploy/AddNGIs.php b/lib/Doctrine/deploy/AddNGIs.php index 58441c329..30f02a7cc 100644 --- a/lib/Doctrine/deploy/AddNGIs.php +++ b/lib/Doctrine/deploy/AddNGIs.php @@ -16,11 +16,12 @@ $egiProject = $entityManager->getRepository('Project') ->findOneBy(array("name" => "EGI")); -//Find the EGI scope tag +// Find the EGI scope tag $egiScope = $entityManager->getRepository('Scope') ->findOneBy(array("name" => "EGI")); -//Add Local Scope so specified NGI is not part of EGI project +// Add Local Scope so that the specified NGI is +// not part of the EGI project $localScope = $entityManager->getRepository('Scope') ->findOneBy(array("name" => "Local")); @@ -68,7 +69,7 @@ // '12-JAN-10 14.12.56.000000' $cdateonString = (string) $value; - //convert to date time + // Convert to date time $creationDate = DateTime::createFromFormat( 'd-M-y G.i.s.u', $cdateonString, @@ -94,12 +95,12 @@ //if ($cdateon == null) throw new Exception("CDATEON is null"); //$doctrineNgi->setCreationDate($cdateon); - // if the NGI has id 67518 (NGI_HU) do not add it to EGI Project + // If the NGI has id 67518 (NGI_HU) do not add it to EGI Project if ($objectID == "67518") { $doctrineNgi->addScope($localScope); $entityManager->persist($doctrineNgi); } else { - // add NGI to EGI project and give it EGI scope + // Add NGI to EGI project and give it EGI scope $egiProject->addNgi($doctrineNgi); $doctrineNgi->addScope($egiScope); $entityManager->persist($doctrineNgi); @@ -107,6 +108,6 @@ } -// don't need to merge egiProject -//$entityManager->merge($egiProject); +// Don't need to merge egiProject +// $entityManager->merge($egiProject); $entityManager->flush(); diff --git a/lib/Doctrine/deploy/AddProjectRoles.php b/lib/Doctrine/deploy/AddProjectRoles.php index f626ea76e..140d76bb3 100644 --- a/lib/Doctrine/deploy/AddProjectRoles.php +++ b/lib/Doctrine/deploy/AddProjectRoles.php @@ -4,7 +4,7 @@ require_once __DIR__ . "/AddUtils.php"; /** - * AddEgiRoles.php: Loads a list of roles from the get_user PI + * AddProjectRoles.php: Loads a list of roles from the get_user PI * query output (XML), finds what project entity the role is over, * if the project entity refers to exactly one project the role is * added to that project and inserted into the doctrine prototype. @@ -28,7 +28,7 @@ continue; } - // get roletype entity + // Get roletype entity $dql = "SELECT rt FROM RoleType rt WHERE rt.name = :roleType"; $roleTypes = $entityManager->createQuery($dql) ->setParameter( @@ -36,8 +36,9 @@ (string) $role->USER_ROLE ) ->getResult(); + // /* Error checking: ensure each role type refers to exactly - // * one role type*/ + // * one role type */ if (count($roleTypes) !== 1) { throw new Exception(count($roleTypes) . " role types found " . "with name: " . $role->USER_ROLE); diff --git a/lib/Doctrine/deploy/AddScopes.php b/lib/Doctrine/deploy/AddScopes.php index 2d52e1d1f..9b20f53a4 100644 --- a/lib/Doctrine/deploy/AddScopes.php +++ b/lib/Doctrine/deploy/AddScopes.php @@ -3,7 +3,7 @@ require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/AddUtils.php"; -/* AddNGIs.php: Loads a list of scopes from an XML file and +/* AddScopes.php: Loads a list of scopes from an XML file and * inserts them into the doctrine prototype. * XML format is the xml input format for scope data */ diff --git a/lib/Doctrine/deploy/AddServiceEndpoints.php b/lib/Doctrine/deploy/AddServiceEndpoints.php index c2c44f2bc..d7827e489 100644 --- a/lib/Doctrine/deploy/AddServiceEndpoints.php +++ b/lib/Doctrine/deploy/AddServiceEndpoints.php @@ -41,7 +41,7 @@ foreach ($ses as $xmlSe) { $doctrineSe = new Service(); - // get the hosting site entity + // Get the hosting site entity $dql = "SELECT s from Site s WHERE s.shortName = ?1"; $parentSites = $entityManager->createQuery($dql) ->setParameter( @@ -64,7 +64,7 @@ $doctrineSe->setParentSiteDoJoin($parentSite); - // get the hosting service type + // Get the hosting service type $dql = "SELECT s from ServiceType s WHERE s.name = ?1"; $sts = $entityManager->createQuery($dql) ->setParameter( @@ -117,7 +117,7 @@ " for SE " . $xmlSe->HOSTNAME); } - //set creation date + // Set creation date $creationDate = new \DateTime("now", new DateTimeZone('UTC')); diff --git a/lib/Doctrine/deploy/AddServiceGroupRoles.php b/lib/Doctrine/deploy/AddServiceGroupRoles.php index 81f0f1a5c..38a556f33 100644 --- a/lib/Doctrine/deploy/AddServiceGroupRoles.php +++ b/lib/Doctrine/deploy/AddServiceGroupRoles.php @@ -19,7 +19,7 @@ continue; } - // get roletype entity + // Get roletype entity $userRole = (string) $role->USER_ROLE; $dql = "SELECT rt FROM RoleType rt WHERE rt.name = :roleType"; $roleTypes = $entityManager->createQuery($dql) @@ -65,7 +65,7 @@ // Set $doctrineUser as the first and only user in the users array $doctrineUser = $users[0]; - // get serviceGroup entity + // Get serviceGroup entity $sgName = (string) $role->ON_ENTITY; $dql = "SELECT sg FROM ServiceGroup sg WHERE " . "sg.name = :service_group"; diff --git a/lib/Doctrine/deploy/AddSiteRoles.php b/lib/Doctrine/deploy/AddSiteRoles.php index b3a1e6315..68fe495d2 100644 --- a/lib/Doctrine/deploy/AddSiteRoles.php +++ b/lib/Doctrine/deploy/AddSiteRoles.php @@ -4,7 +4,7 @@ require_once __DIR__ . "/AddUtils.php"; /** - * AddNGIs.php: Loads a list of Site roles from an XML file and + * AddSiteRoles.php: Loads a list of Site roles from an XML file and * inserts them into the doctrine prototype. * XML format is the output from get_user_doctrine PI query. */ @@ -24,8 +24,7 @@ continue; } - // Find the role type - // get the roletype entity + // Find the role type and get the roletype entity $dql = "SELECT rt FROM RoleType rt WHERE rt.name = ?1"; $roleTypes = $entityManager->createQuery($dql) ->setParameter( @@ -33,6 +32,7 @@ (string) $role->USER_ROLE ) ->getResult(); + // /* Error checking: ensure each role type refers to exactly // * one role type */ if (count($roleTypes) !== 1) { @@ -73,14 +73,14 @@ throw new Exception("Not a doctrine user"); } - // Check for invalid sites and skip adding this role - // typically these sites don't have an NGI, - // country or production status + // Check for invalid sites and skip adding this role. + // Typically these sites don't have an NGI, + // country or production status. if (isBad((string) $role->ON_ENTITY)) { continue; } - // get the site entity + // Get the site entity $dql = "SELECT s FROM Site s WHERE s.shortName = ?1"; $sites = $entityManager->createQuery($dql) ->setParameter( @@ -88,6 +88,7 @@ (string) $role->ON_ENTITY ) ->getResult(); + // /* Error checking: ensure each "site" refers to exactly // * one site */ if (count($sites) !== 1) { @@ -103,7 +104,8 @@ throw new Exception("Not a doctrine site"); } - //check that the role is not a duplicate (v4 data contaisn duplicates) + // Check that the role is not a duplicate + // (v4 data contains duplicates) $ExistingUserRoles = $doctrineUser->getRoles(); $thisIsADuplicateRole=false; foreach ($ExistingUserRoles as $role) { diff --git a/lib/Doctrine/deploy/AddSites.php b/lib/Doctrine/deploy/AddSites.php index 3f6296e5c..601e6f850 100644 --- a/lib/Doctrine/deploy/AddSites.php +++ b/lib/Doctrine/deploy/AddSites.php @@ -20,7 +20,7 @@ // Check whether this site has a larger v4 primary key // than any other recorded so far $v4pkGO = trim((string) $xmlSite->PRIMARY_KEY); - // isolate just the number part (slice the 'GO' off the end) + // Isolate just the number part (slice the 'GO' off the end) $v4pk = (int) substr($v4pkGO, 0, strlen($v4pkGO)-2); if ($v4pk > $largestV4SitePk) { $largestV4SitePk = $v4pk; @@ -53,7 +53,7 @@ $doctrineSite->setAlarmEmail((string) $xmlSite->ALARM_EMAIL); $doctrineSite->setHelpdeskEmail((string) $xmlSite->HELPDESKEMAIL); - // get the parent NGI entity + // Get the parent NGI entity $dql = "SELECT n FROM NGI n WHERE n.name = ?1"; $parentNgis = $entityManager->createQuery($dql) ->setParameter( @@ -75,7 +75,7 @@ $doctrineSite->setNgiDoJoin($parentNgi); - // get the target infrastructure + // Get the target infrastructure $dql = "SELECT i FROM Infrastructure i WHERE i.name = :name"; $infs = $entityManager->createQuery($dql) ->setParameter( @@ -97,7 +97,7 @@ $doctrineSite->setInfrastructure($inf); - // get the cert status + // Get the cert status $dql = "SELECT c FROM CertificationStatus c WHERE c.name = ?1"; $certStatuses = $entityManager->createQuery($dql) ->setParameter( @@ -126,7 +126,7 @@ ) ); - // get / set the country + // Get / set the country $dql = "SELECT c FROM Country c WHERE c.name = ?1"; $countries = $entityManager->createQuery($dql) ->setParameter( @@ -149,7 +149,7 @@ $doctrineSite->setCountry($country); - // get the Tier (optional value) + // Get the Tier (optional value) $dql = "SELECT t FROM Tier t WHERE t.name = ?1"; $tiers = $entityManager->createQuery($dql) ->setParameter( @@ -168,7 +168,7 @@ $doctrineSite->setTier($tier); } - // get the SubGrid (optional value) + // Get the SubGrid (optional value) $dql = "SELECT s FROM SubGrid s WHERE s.name = ?1"; $subGrids = $entityManager->createQuery($dql) ->setParameter( @@ -189,7 +189,7 @@ - //set creation date + // Set creation date $creationDate = new \DateTime( "now", new DateTimeZone('UTC') @@ -203,7 +203,7 @@ // store this date as an attribute on the Site. foreach ($xmlCertStatusLinkDates as $xmlCertStatusLinkDate) { $targetSiteName = (string) $xmlCertStatusLinkDate->name; - // only interested in the current site + // Only interested in the current site if ($targetSiteName == $doctrineSite->getShortName()) { // '01-JUL-13 11.09.10.000000 AM' which has the php datetime // format of 'd-M-y H.i.s A' provided we @@ -245,7 +245,7 @@ // a link/linkType object using the dateOn property. foreach ($xmlCertStatusChanges as $xmlCertStatusChange) { $targetSiteName = (string) $xmlCertStatusChange->SITE; - // only interested in the current site + // Only interested in the current site if ($targetSiteName == $doctrineSite->getShortName()) { $doctrineCertStatusChangeLog = new \CertificationStatusLog(); $doctrineCertStatusChangeLog->setAddedBy((string) diff --git a/lib/Doctrine/deploy/AddUsers.php b/lib/Doctrine/deploy/AddUsers.php index e75ca6124..e7227c535 100644 --- a/lib/Doctrine/deploy/AddUsers.php +++ b/lib/Doctrine/deploy/AddUsers.php @@ -43,7 +43,8 @@ $user->WORKING_HOURS_END); $doctrineUser->setAdmin(false); - // Roughly half of users don't have a home site set + // Check if users don't have a homesite set, or + // if the homesite is 'bad'. if ($user->HOMESITE !== "" && !isBad($user->HOMESITE)) { // Get the home site entity $dql = "SELECT s from Site s WHERE s.shortName = ?1"; @@ -55,7 +56,7 @@ ->getResult(); /* Error checking: ensure each "home site" refers to exactly - * one home site */ + * one home site */ if (count($homeSites) !== 1) { throw new \Exception(count($homeSites) . " sites found " . "with short name: " . $user->HOMESITE . diff --git a/lib/Doctrine/deploy/AddUtils.php b/lib/Doctrine/deploy/AddUtils.php index 9ff328e64..6ec5c60c7 100644 --- a/lib/Doctrine/deploy/AddUtils.php +++ b/lib/Doctrine/deploy/AddUtils.php @@ -44,7 +44,7 @@ function isBad($site) { 'UIS-BUCARAMANGA', 'UTP-PANAMA', 'ITWM-PPS' , 'HU-BERLIN', 'SCAI-PPS', 'FZK-SC', 'FZK-Test', 'FZK-Test', 'GRIDOPS-GRIDVIEW', 'GSI-LCG2-PPS', - // next lot is from NGI_IE which was deleted. + // Next lot is from NGI_IE which was deleted. 'csTCDie', 'mpUCDie', 'giNUIMie', 'cpDIASie', 'csQUBuk', 'csUCCie', 'scgNUIGie', 'giITTAie', 'obsARMuk', 'giHECie', 'giRCSIie', 'giDCUie'); @@ -63,14 +63,14 @@ function isBad($site) { * @return \Scope */ function getScope($entityManager, $scope) { - // get the scope + // Get the scope $dql = "SELECT s FROM Scope s WHERE s.name = ?1"; $scopes = $entityManager->createQuery($dql) ->setParameter(1, $scope) ->getResult(); /* Error checking: ensure each Site's "SCOPE" refers to exactly - * one SCOPE */ + * one SCOPE */ if (count($scopes) !== 1) { throw new Exception(count($scopes) . " SCOPEs found " . "with name: " . $scope);