resourceType is not valid (wms, wfs, dataset, wmc).
'; die(); } $resourceType = $testMatch; $testMatch = NULL; } if (isset($_REQUEST["maintenanceFunction"]) & $_REQUEST["maintenanceFunction"] != "") { $testMatch = $_REQUEST["maintenanceFunction"]; if (!($testMatch == 'reindex' or $testMatch == 'monitor')){ echo 'Parameter maintenanceFunction is not valid (reindex, monitor).
'; die(); } $maintenanceFunction = $testMatch; $testMatch = NULL; } if (isset($_REQUEST["resourceIds"]) & $_REQUEST["resourceIds"] != "") { //validate to csv integer list $testMatch = $_REQUEST["resourceIds"]; $pattern = '/^[\d,]*$/'; if (!preg_match($pattern,$testMatch)){ //echo 'resourceIds: '.$testMatch.' is not valid.
'; echo 'Parameter resourceIds is not valid (integer or cs integer list).
'; die(); } $resourceIds = $testMatch; $testMatch = NULL; } $allowedFunctions = array( 'wms' => array('reindex','monitor'), 'wfs' => array('reindex'), 'dataset' => array('reindex'), 'wmc' => array('reindex') ); $functionThatNeedIdList = array('monitor'); //check for allowedFunction if (!in_array($maintenanceFunction, $allowedFunctions[$resourceType])) { echo 'Maintenance function not allowed for requested resource type.
'; die(); } //check for given id if demanded /*if (in_array($maintenanceFunction, $functionThatNeedIdList) && !isset($resourceIds)) { echo 'Maintenance function need parameter resourceIds, but this is not given.
'; die(); }*/ ?> '; ?> <?php switch ($maintenanceFunction) { case "reindex": $title = _mb('Re-Index search database for '); break; case "monitor": $title = _mb('Start monitoring process for '); break; } switch ($resourceType) { case "wms": $title .= _mb('WebMapService(s)'); break; case "wfs": $title .= _mb('WebFeatureService(s)'); break; case "dataset": $title .= _mb('Dataset(s)'); break; case "wmc": $title .= _mb('WebMapContext Document(s)'); break; } echo $title; //collect number of objects to reindex $count = 0; if ($maintenanceFunction == 'reindex') { switch ($resourceType) { case "wms": $sqlCount = "SELECT count(layer_id) from layer WHERE layer_searchable = 1;"; break; case "wfs": $sqlCount = "SELECT count(featuretype_id) from wfs_featuretype WHERE featuretype_searchable = 1;"; break; case "dataset": $sqlCount = "SELECT count(metadata_id) from mb_metadata WHERE searchable;"; break; case "wmc": $sqlCount = "SELECT count(wmc_serial_id) from mb_user_wmc WHERE wmc_public = 1;"; break; } $resCount = db_query($sqlCount); if (!$resCount) { $count = 0; } else { $row = db_fetch_array($resCount); $count = $row['count']; } $title .= " (".$count." "._mb("searchable resources").")"; } switch ($maintenanceFunction) { case "reindex": $sql = file_get_contents(dirname(__FILE__)."/../../resources/db/materialize_".$resourceType."_view.sql"); break; } ?>
"._mb("Resource Ids").":
"; $form .= ""; } $form .= ""; } $form .= ""; echo $form; ?>